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

import com.airlock.iam.common.api.application.configuration.valueprovider.StringValueProviderConfig;
import com.airlock.iam.plugin.api.annotation.config.Plugin;
import com.airlock.iam.plugin.api.annotation.property.BooleanProperty;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;

@Plugin(description = "Provides the mTAN label stored in the flow session for mTAN number registration.", displayName = "mTAN Registration Label Provider")
public class MtanRegistrationLabelProviderConfig implements StringValueProviderConfig {
   @BooleanProperty(
      description = "<p>If enabled, the value provided is not allowed to be null.</p>\n<p>If this option is enabled and the value is null (e.g. if the there is no mTAN label in the flow session),\nan exception will be thrown at runtime.</p>",
      optional = true,
      defaultValue = "true"
   )
   private boolean mandatory;

   public boolean isMandatory() {
      return this.mandatory;
   }

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

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

   @SuppressFBWarnings(justification = "generated code")
   public MtanRegistrationLabelProviderConfig(boolean mandatory) {
      this.mandatory = mandatory;
   }

   @SuppressFBWarnings(justification = "generated code")
   public static class MtanRegistrationLabelProviderConfigBuilder {
      @SuppressFBWarnings(justification = "generated code")
      private boolean mandatory;

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

      @SuppressFBWarnings(justification = "generated code")
      public MtanRegistrationLabelProviderConfig.MtanRegistrationLabelProviderConfigBuilder mandatory(boolean mandatory) {
         this.mandatory = mandatory;
         return this;
      }

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

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