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

import com.airlock.iam.core.misc.impl.tokenverifier.oathotp.OathOtpSettings;
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.license.PluginLicenseRestriction;
import com.airlock.iam.plugin.api.annotation.property.PluginProperty;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;

@Plugin(
   description = "Flow selection condition that selects the subflow depending on whether the user has an active OATH OTP token.",
   displayName = "Has OATH OTP Token"
)
@PluginLicenseRestriction(moduleAffiliation = {"OathOtp", "MobileOTP"})
public class OathOtpCredentialConditionConfig implements FlowConditionConfig {
   static final String MOBILE_OTP = "MobileOTP";
   @PluginProperty(
      description = "The OATH OTP settings to load the user's OATH OTP information.",
      optional = false,
      globalPluginReference = "globalOathOtpSettings"
   )
   private OathOtpSettings oathOtpSettings;

   public OathOtpSettings getOathOtpSettings() {
      return this.oathOtpSettings;
   }

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

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

   @SuppressFBWarnings(justification = "generated code")
   public OathOtpCredentialConditionConfig(OathOtpSettings oathOtpSettings) {
      this.oathOtpSettings = oathOtpSettings;
   }

   @SuppressFBWarnings(justification = "generated code")
   public static class OathOtpCredentialConditionConfigBuilder {
      @SuppressFBWarnings(justification = "generated code")
      private OathOtpSettings oathOtpSettings;

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

      @SuppressFBWarnings(justification = "generated code")
      public OathOtpCredentialConditionConfig.OathOtpCredentialConditionConfigBuilder oathOtpSettings(OathOtpSettings oathOtpSettings) {
         this.oathOtpSettings = oathOtpSettings;
         return this;
      }

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

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