package com.airlock.iam.admin.infrastructure.transfer.response.user;

import com.airlock.iam.admin.infrastructure.transfer.response.user.tokens.UserAuthenticationMethodData;
import com.fasterxml.jackson.annotation.JsonTypeName;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.annotation.Nullable;

@JsonTypeName("user")
public class UserData {
   public static final String USER_TYPE = "user";
   @Schema(description = "Details about an authentication method migration for the user.")
   private UserAuthenticationMethodData authenticationMethod;
   @Schema(description = "User statistics properties.")
   private UserStatisticsData statistics;
   @Nullable
   @Schema(description = "Whether or not the user is locked. If missing, the user is not locked.")
   private LockData lock;
   @Schema(description = "The user's context data.")
   private UserContextData contextData;

   public UserData addContextData(String name, Object value) {
      if (this.contextData == null) {
         this.contextData = new UserContextData();
      }

      this.contextData.addValue(name, value);
      return this;
   }

   @SuppressFBWarnings(justification = "generated code")
   public UserAuthenticationMethodData getAuthenticationMethod() {
      return this.authenticationMethod;
   }

   @SuppressFBWarnings(justification = "generated code")
   public UserStatisticsData getStatistics() {
      return this.statistics;
   }

   @Nullable
   @SuppressFBWarnings(justification = "generated code")
   public LockData getLock() {
      return this.lock;
   }

   @SuppressFBWarnings(justification = "generated code")
   public UserContextData getContextData() {
      return this.contextData;
   }

   @SuppressFBWarnings(justification = "generated code")
   public void setAuthenticationMethod(UserAuthenticationMethodData authenticationMethod) {
      this.authenticationMethod = authenticationMethod;
   }

   @SuppressFBWarnings(justification = "generated code")
   public void setStatistics(UserStatisticsData statistics) {
      this.statistics = statistics;
   }

   @SuppressFBWarnings(justification = "generated code")
   public void setLock(@Nullable LockData lock) {
      this.lock = lock;
   }

   @SuppressFBWarnings(justification = "generated code")
   public void setContextData(UserContextData contextData) {
      this.contextData = contextData;
   }

   @SuppressFBWarnings(justification = "generated code")
   @Override
   public boolean equals(Object o) {
      if (o == this) {
         return true;
      } else if (!(o instanceof UserData other)) {
         return false;
      } else {
         if (!other.canEqual(this)) {
            return false;
         }

         Object this$authenticationMethod = this.authenticationMethod;
         Object other$authenticationMethod = other.authenticationMethod;
         if (this$authenticationMethod == null ? other$authenticationMethod == null : this$authenticationMethod.equals(other$authenticationMethod)) {
            Object this$statistics = this.statistics;
            Object other$statistics = other.statistics;
            if (this$statistics == null ? other$statistics == null : this$statistics.equals(other$statistics)) {
               Object this$lock = this.lock;
               Object other$lock = other.lock;
               if (this$lock == null ? other$lock == null : this$lock.equals(other$lock)) {
                  Object this$contextData = this.contextData;
                  Object other$contextData = other.contextData;
                  return this$contextData == null ? other$contextData == null : this$contextData.equals(other$contextData);
               } else {
                  return false;
               }
            } else {
               return false;
            }
         } else {
            return false;
         }
      }
   }

   @SuppressFBWarnings(justification = "generated code")
   protected boolean canEqual(Object other) {
      return other instanceof UserData;
   }

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

   @SuppressFBWarnings(justification = "generated code")
   @Override
   public String toString() {
      return "UserData(authenticationMethod="
         + this.getAuthenticationMethod()
         + ", statistics="
         + this.getStatistics()
         + ", lock="
         + this.getLock()
         + ", contextData="
         + this.getContextData()
         + ")";
   }
}
