package com.airlock.iam.admin.domain.model.authmethod;

import com.airlock.iam.admin.api.domain.model.user.AuthenticationMethods;
import com.airlock.iam.base.api.domain.model.user.UserId;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import java.util.Optional;

public interface AuthenticationMethod {
   AuthenticationMethod.TokenType getTokenType();

   AuthenticationMethods.AuthenticationMethodId getConfiguredId();

   boolean isAllowedAsActiveAuthMethodForUser(UserId var1);

   boolean isAllowedAsNextAuthMethod();

   boolean isAllowedAsNewAuthMethod(UserId var1);

   boolean isVisible(UserId var1);

   Optional<AuthenticationMethod.AddAuthMethodErrorCode> addToUser(UserId var1);

   void handleUserCreated(UserId var1);

   default boolean allowMigrationToSameToken() {
      return false;
   }

   default boolean isGeneric() {
      return false;
   }

   interface AddAuthMethodErrorCode {
      String name();
   }

   enum GenericAddAuthMethodErrorCodes implements AuthenticationMethod.AddAuthMethodErrorCode {
      NO_SUCH_AUTH_METHOD;
   }

   final class TokenType {
      private final String id;

      public static AuthenticationMethod.TokenType tokenType(String id) {
         return new AuthenticationMethod.TokenType(id);
      }

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

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

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

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

      @SuppressFBWarnings(justification = "generated code")
      @Override
      public String toString() {
         return "AuthenticationMethod.TokenType(id=" + this.getId() + ")";
      }
   }
}
