package com.airlock.iam.flow.shared.application.configuration.condition;

import com.airlock.iam.flow.api.application.configuration.selection.FlowConditionConfig;
import com.airlock.iam.plugin.api.annotation.config.Plugin;
import com.airlock.iam.plugin.api.annotation.property.StringProperty;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;

@Plugin(
   description = "Condition that is fulfilled if the configured \"Auth Method\" matches the user's active authentication method.",
   displayName = "Active Authentication Method"
)
public final class AuthMethodBasedConditionConfig implements FlowConditionConfig {
   @StringProperty(
      description = "Expected value of the auth method field on the user for this condition to be fulfilled.",
      suggestedValues = {"AIRLOCK_2FA", "CRONTO", "EMAILOTP", "FIDO", "MATRIX", "MTAN", "OATH_OTP", "OTP", "PASSWORD"},
      optional = false
   )
   private String authMethod;

   public String getAuthMethod() {
      return this.authMethod;
   }

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

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

   @SuppressFBWarnings(justification = "generated code")
   public AuthMethodBasedConditionConfig() {
   }

   @SuppressFBWarnings(justification = "generated code")
   public static class AuthMethodBasedConditionConfigBuilder {
      @SuppressFBWarnings(justification = "generated code")
      private String authMethod;

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

      @SuppressFBWarnings(justification = "generated code")
      public AuthMethodBasedConditionConfig.AuthMethodBasedConditionConfigBuilder authMethod(String authMethod) {
         this.authMethod = authMethod;
         return this;
      }

      @SuppressFBWarnings(justification = "generated code")
      public AuthMethodBasedConditionConfig build() {
         return new AuthMethodBasedConditionConfig(this.authMethod);
      }

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