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

import com.airlock.iam.common.api.domain.model.authmethod.AuthenticationMethod;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import java.time.Duration;
import lombok.NonNull;

public final class SmsIdentityVerificationStepSettings {
   private final int maxFailedAttempts;
   @NonNull
   private final Duration otpValidity;
   private final boolean otpCaseSensitive;
   @NonNull
   private final AuthenticationMethod authMethodId;

   @SuppressFBWarnings(justification = "generated code")
   public SmsIdentityVerificationStepSettings(
      int maxFailedAttempts, @NonNull Duration otpValidity, boolean otpCaseSensitive, @NonNull AuthenticationMethod authMethodId
   ) {
      if (otpValidity == null) {
         throw new NullPointerException("otpValidity is marked non-null but is null");
      }

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

      this.maxFailedAttempts = maxFailedAttempts;
      this.otpValidity = otpValidity;
      this.otpCaseSensitive = otpCaseSensitive;
      this.authMethodId = authMethodId;
   }

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

   @NonNull
   @SuppressFBWarnings(justification = "generated code")
   public Duration getOtpValidity() {
      return this.otpValidity;
   }

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

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

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

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

   @SuppressFBWarnings(justification = "generated code")
   @Override
   public String toString() {
      return "SmsIdentityVerificationStepSettings(maxFailedAttempts="
         + this.getMaxFailedAttempts()
         + ", otpValidity="
         + this.getOtpValidity()
         + ", otpCaseSensitive="
         + this.isOtpCaseSensitive()
         + ", authMethodId="
         + this.getAuthMethodId()
         + ")";
   }
}
