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

import com.airlock.iam.core.misc.impl.authen.mtan.MtanHandler;
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.PluginProperty;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;

@Plugin(description = "Flow condition that is fulfilled depending on whether the user has an active mTAN token.", displayName = "Has mTAN Token")
public class MtanCredentialConditionConfig implements FlowConditionConfig {
   @PluginProperty(description = "The mTAN handler to load the user's mTAN tokens.", optional = false, displayName = "MTAN Handler")
   private MtanHandler mtanHandler;

   public MtanHandler getMtanHandler() {
      return this.mtanHandler;
   }

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

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

   @SuppressFBWarnings(justification = "generated code")
   public MtanCredentialConditionConfig(MtanHandler mtanHandler) {
      this.mtanHandler = mtanHandler;
   }

   @SuppressFBWarnings(justification = "generated code")
   public static class MtanCredentialConditionConfigBuilder {
      @SuppressFBWarnings(justification = "generated code")
      private MtanHandler mtanHandler;

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

      @SuppressFBWarnings(justification = "generated code")
      public MtanCredentialConditionConfig.MtanCredentialConditionConfigBuilder mtanHandler(MtanHandler mtanHandler) {
         this.mtanHandler = mtanHandler;
         return this;
      }

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

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