package com.airlock.iam.publicselfservice.domain.model.step;

import com.airlock.iam.common.api.domain.model.authmethod.AuthenticationMethod;
import com.airlock.iam.core.misc.util.password.hash.PasswordHash;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import java.util.List;
import lombok.NonNull;

public final class SecretQuestionsIdentityVerificationStepSettings {
   private final boolean checkUsingLatin1Encoding;
   @NonNull
   private final List<String> questionResourceKeys;
   private final int numberOfRequiredQuestions;
   private final int maxFailedAttempts;
   @NonNull
   private final AuthenticationMethod authMethodId;
   private final PasswordHash passwordHash;

   @SuppressFBWarnings(justification = "generated code")
   public static SecretQuestionsIdentityVerificationStepSettings.SecretQuestionsIdentityVerificationStepSettingsBuilder builder() {
      return new SecretQuestionsIdentityVerificationStepSettings.SecretQuestionsIdentityVerificationStepSettingsBuilder();
   }

   @SuppressFBWarnings(justification = "generated code")
   public boolean isCheckUsingLatin1Encoding() {
      return this.checkUsingLatin1Encoding;
   }

   @NonNull
   @SuppressFBWarnings(justification = "generated code")
   public List<String> getQuestionResourceKeys() {
      return this.questionResourceKeys;
   }

   @SuppressFBWarnings(justification = "generated code")
   public int getNumberOfRequiredQuestions() {
      return this.numberOfRequiredQuestions;
   }

   @SuppressFBWarnings(justification = "generated code")
   public int getMaxFailedAttempts() {
      return this.maxFailedAttempts;
   }

   @NonNull
   @SuppressFBWarnings(justification = "generated code")
   public AuthenticationMethod getAuthMethodId() {
      return this.authMethodId;
   }

   @SuppressFBWarnings(justification = "generated code")
   public PasswordHash getPasswordHash() {
      return this.passwordHash;
   }

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

         if (this.numberOfRequiredQuestions != other.numberOfRequiredQuestions) {
            return false;
         }

         if (this.maxFailedAttempts != other.maxFailedAttempts) {
            return false;
         }

         Object this$questionResourceKeys = this.questionResourceKeys;
         Object other$questionResourceKeys = other.questionResourceKeys;
         if (this$questionResourceKeys == null ? other$questionResourceKeys == null : this$questionResourceKeys.equals(other$questionResourceKeys)) {
            Object this$authMethodId = this.authMethodId;
            Object other$authMethodId = other.authMethodId;
            if (this$authMethodId == null ? other$authMethodId == null : this$authMethodId.equals(other$authMethodId)) {
               Object this$passwordHash = this.passwordHash;
               Object other$passwordHash = other.passwordHash;
               return this$passwordHash == null ? other$passwordHash == null : this$passwordHash.equals(other$passwordHash);
            } else {
               return false;
            }
         } else {
            return false;
         }
      }
   }

   @SuppressFBWarnings(justification = "generated code")
   @Override
   public int hashCode() {
      int PRIME = 59;
      int result = 1;
      result = result * 59 + (this.checkUsingLatin1Encoding ? 79 : 97);
      result = result * 59 + this.numberOfRequiredQuestions;
      result = result * 59 + this.maxFailedAttempts;
      Object $questionResourceKeys = this.questionResourceKeys;
      result = result * 59 + ($questionResourceKeys == null ? 43 : $questionResourceKeys.hashCode());
      Object $authMethodId = this.authMethodId;
      result = result * 59 + ($authMethodId == null ? 43 : $authMethodId.hashCode());
      Object $passwordHash = this.passwordHash;
      return result * 59 + ($passwordHash == null ? 43 : $passwordHash.hashCode());
   }

   @SuppressFBWarnings(justification = "generated code")
   @Override
   public String toString() {
      return "SecretQuestionsIdentityVerificationStepSettings(checkUsingLatin1Encoding="
         + this.isCheckUsingLatin1Encoding()
         + ", questionResourceKeys="
         + this.getQuestionResourceKeys()
         + ", numberOfRequiredQuestions="
         + this.getNumberOfRequiredQuestions()
         + ", maxFailedAttempts="
         + this.getMaxFailedAttempts()
         + ", authMethodId="
         + this.getAuthMethodId()
         + ", passwordHash="
         + this.getPasswordHash()
         + ")";
   }

   @SuppressFBWarnings(justification = "generated code")
   public SecretQuestionsIdentityVerificationStepSettings(
      boolean checkUsingLatin1Encoding,
      @NonNull List<String> questionResourceKeys,
      int numberOfRequiredQuestions,
      int maxFailedAttempts,
      @NonNull AuthenticationMethod authMethodId,
      PasswordHash passwordHash
   ) {
      if (questionResourceKeys == null) {
         throw new NullPointerException("questionResourceKeys is marked non-null but is null");
      }

      if (authMethodId == null) {
         throw new NullPointerException("authMethodId is marked non-null but is null");
      }

      this.checkUsingLatin1Encoding = checkUsingLatin1Encoding;
      this.questionResourceKeys = questionResourceKeys;
      this.numberOfRequiredQuestions = numberOfRequiredQuestions;
      this.maxFailedAttempts = maxFailedAttempts;
      this.authMethodId = authMethodId;
      this.passwordHash = passwordHash;
   }

   @SuppressFBWarnings(justification = "generated code")
   public static class SecretQuestionsIdentityVerificationStepSettingsBuilder {
      @SuppressFBWarnings(justification = "generated code")
      private boolean checkUsingLatin1Encoding;
      @SuppressFBWarnings(justification = "generated code")
      private List<String> questionResourceKeys;
      @SuppressFBWarnings(justification = "generated code")
      private int numberOfRequiredQuestions;
      @SuppressFBWarnings(justification = "generated code")
      private int maxFailedAttempts;
      @SuppressFBWarnings(justification = "generated code")
      private AuthenticationMethod authMethodId;
      @SuppressFBWarnings(justification = "generated code")
      private PasswordHash passwordHash;

      @SuppressFBWarnings(justification = "generated code")
      SecretQuestionsIdentityVerificationStepSettingsBuilder() {
      }

      @SuppressFBWarnings(justification = "generated code")
      public SecretQuestionsIdentityVerificationStepSettings.SecretQuestionsIdentityVerificationStepSettingsBuilder checkUsingLatin1Encoding(
         boolean checkUsingLatin1Encoding
      ) {
         this.checkUsingLatin1Encoding = checkUsingLatin1Encoding;
         return this;
      }

      @SuppressFBWarnings(justification = "generated code")
      public SecretQuestionsIdentityVerificationStepSettings.SecretQuestionsIdentityVerificationStepSettingsBuilder questionResourceKeys(
         @NonNull List<String> questionResourceKeys
      ) {
         if (questionResourceKeys == null) {
            throw new NullPointerException("questionResourceKeys is marked non-null but is null");
         }

         this.questionResourceKeys = questionResourceKeys;
         return this;
      }

      @SuppressFBWarnings(justification = "generated code")
      public SecretQuestionsIdentityVerificationStepSettings.SecretQuestionsIdentityVerificationStepSettingsBuilder numberOfRequiredQuestions(
         int numberOfRequiredQuestions
      ) {
         this.numberOfRequiredQuestions = numberOfRequiredQuestions;
         return this;
      }

      @SuppressFBWarnings(justification = "generated code")
      public SecretQuestionsIdentityVerificationStepSettings.SecretQuestionsIdentityVerificationStepSettingsBuilder maxFailedAttempts(int maxFailedAttempts) {
         this.maxFailedAttempts = maxFailedAttempts;
         return this;
      }

      @SuppressFBWarnings(justification = "generated code")
      public SecretQuestionsIdentityVerificationStepSettings.SecretQuestionsIdentityVerificationStepSettingsBuilder authMethodId(
         @NonNull AuthenticationMethod authMethodId
      ) {
         if (authMethodId == null) {
            throw new NullPointerException("authMethodId is marked non-null but is null");
         }

         this.authMethodId = authMethodId;
         return this;
      }

      @SuppressFBWarnings(justification = "generated code")
      public SecretQuestionsIdentityVerificationStepSettings.SecretQuestionsIdentityVerificationStepSettingsBuilder passwordHash(PasswordHash passwordHash) {
         this.passwordHash = passwordHash;
         return this;
      }

      @SuppressFBWarnings(justification = "generated code")
      public SecretQuestionsIdentityVerificationStepSettings build() {
         return new SecretQuestionsIdentityVerificationStepSettings(
            this.checkUsingLatin1Encoding,
            this.questionResourceKeys,
            this.numberOfRequiredQuestions,
            this.maxFailedAttempts,
            this.authMethodId,
            this.passwordHash
         );
      }

      @SuppressFBWarnings(justification = "generated code")
      @Override
      public String toString() {
         return "SecretQuestionsIdentityVerificationStepSettings.SecretQuestionsIdentityVerificationStepSettingsBuilder(checkUsingLatin1Encoding="
            + this.checkUsingLatin1Encoding
            + ", questionResourceKeys="
            + this.questionResourceKeys
            + ", numberOfRequiredQuestions="
            + this.numberOfRequiredQuestions
            + ", maxFailedAttempts="
            + this.maxFailedAttempts
            + ", authMethodId="
            + this.authMethodId
            + ", passwordHash="
            + this.passwordHash
            + ")";
      }
   }
}
