package com.airlock.iam.admin.application.configuration.airlock2fa;

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.BooleanProperty;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;

@Plugin(
   displayName = "Order Airlock 2FA Device Activation Letters",
   description = "Generates an order for an Airlock 2FA activation letter.<p>An order indicates the intention to later create an activation letter for the given user to allow for example the registration of the first Airlock 2FA device.</p><p>Compared to \"Create Airlock 2FA Device Activation Letters\", this plugin does not generate any activation letter. All orders can be batch processed by configuring an \"Airlock 2FA Activation Letter Order Task\" in the service container which will create the necessary activation letters.</p>"
)
@PluginLicenseRestriction(moduleAffiliation = "Airlock2FA")
public final class Airlock2FAOrderActivationLettersConfig {
   public static final String ORDER_AIRLOCK_2FA_ACTIVATION_LETTER_PLUGIN_NAME = "Order Airlock 2FA Device Activation Letters";
   @BooleanProperty(
      description = "Automatically creates an order for an Airlock 2FA activation letter upon adding this authentication method to the user.",
      optional = true,
      defaultValue = "false"
   )
   private boolean autoOrder;

   public boolean isAutoOrder() {
      return this.autoOrder;
   }

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

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

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

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

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

      @SuppressFBWarnings(justification = "generated code")
      public Airlock2FAOrderActivationLettersConfig.Airlock2FAOrderActivationLettersConfigBuilder autoOrder(boolean autoOrder) {
         this.autoOrder = autoOrder;
         return this;
      }

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

      @SuppressFBWarnings(justification = "generated code")
      @Override
      public String toString() {
         return "Airlock2FAOrderActivationLettersConfig.Airlock2FAOrderActivationLettersConfigBuilder(autoOrder=" + this.autoOrder + ")";
      }
   }
}
