package com.airlock.iam.flow.shared.domain.model.attributes;

import com.airlock.iam.base.api.domain.model.mapification.MapifiedValues;
import com.airlock.iam.base.domain.model.mapification.MapifiedValuesBuilder;
import com.airlock.iam.flow.shared.api.domain.model.session.UserSessionScopedFlowAttribute;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import java.util.Map;

public final class AuthTokenIdFlowSessionAttribute implements UserSessionScopedFlowAttribute<AuthTokenIdFlowSessionAttribute> {
   public static final String AUTH_TOKEN_ID_KEY = "authTokenIdKey";
   private final String authTokenId;

   public static AuthTokenIdFlowSessionAttribute authTokenIdFlowSessionAttribute(String rawAuthTokenId) {
      return new AuthTokenIdFlowSessionAttribute(rawAuthTokenId);
   }

   public AuthTokenIdFlowSessionAttribute mergeWith(AuthTokenIdFlowSessionAttribute newAttribute) {
      return newAttribute;
   }

   @Override
   public MapifiedValues mapify() {
      return MapifiedValuesBuilder.mapifiedValues().put("authTokenIdKey", this.authTokenId).build();
   }

   public AuthTokenIdFlowSessionAttribute copyAttribute() {
      return authTokenIdFlowSessionAttribute(this.authTokenId);
   }

   public static AuthTokenIdFlowSessionAttribute deserializeSessionAttribute(Map<String, String> rawValues) {
      return authTokenIdFlowSessionAttribute(rawValues.get("authTokenIdKey"));
   }

   public static AuthTokenIdFlowSessionAttribute demapify(MapifiedValues values) {
      return new AuthTokenIdFlowSessionAttribute(values.get("authTokenIdKey"));
   }

   @SuppressFBWarnings(justification = "generated code")
   public AuthTokenIdFlowSessionAttribute(String authTokenId) {
      this.authTokenId = authTokenId;
   }

   @SuppressFBWarnings(justification = "generated code")
   @Override
   public boolean equals(Object o) {
      if (o == this) {
         return true;
      } else if (!(o instanceof AuthTokenIdFlowSessionAttribute other)) {
         return false;
      } else {
         Object this$authTokenId = this.authTokenId;
         Object other$authTokenId = other.authTokenId;
         return this$authTokenId == null ? other$authTokenId == null : this$authTokenId.equals(other$authTokenId);
      }
   }

   @SuppressFBWarnings(justification = "generated code")
   @Override
   public int hashCode() {
      int PRIME = 59;
      int result = 1;
      Object $authTokenId = this.authTokenId;
      return result * 59 + ($authTokenId == null ? 43 : $authTokenId.hashCode());
   }

   @SuppressFBWarnings(justification = "generated code")
   @Override
   public String toString() {
      return "AuthTokenIdFlowSessionAttribute(authTokenId=" + this.getAuthTokenId() + ")";
   }

   @SuppressFBWarnings(justification = "generated code")
   public String getAuthTokenId() {
      return this.authTokenId;
   }
}
