package com.airlock.iam.login.application.service.validity;

import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;

public final class UserValidityCheckError {
   private final UserValidityCheckError.UserValidityError errorCode;

   public static UserValidityCheckError userInvalid() {
      return new UserValidityCheckError(UserValidityCheckError.UserValidityError.USER_INVALID);
   }

   public static UserValidityCheckError userLocked() {
      return new UserValidityCheckError(UserValidityCheckError.UserValidityError.USER_LOCKED);
   }

   private UserValidityCheckError(UserValidityCheckError.UserValidityError errorCode) {
      this.errorCode = errorCode;
   }

   public boolean isLockedUser() {
      return UserValidityCheckError.UserValidityError.USER_LOCKED == this.errorCode;
   }

   public boolean isInvalidUser() {
      return UserValidityCheckError.UserValidityError.USER_INVALID == this.errorCode;
   }

   public String errorCode() {
      return this.errorCode.toString();
   }

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

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

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

   private enum UserValidityError {
      USER_LOCKED,
      USER_INVALID;
   }
}
