package com.airlock.iam.publicselfservice.application.configuration.restrictions;

import com.airlock.iam.core.misc.impl.authen.mtan.MtanHandler;
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 = "<p>Does not allow users without an mTAN token to perform public self-services and returns a corresponding feedback message.</p><p>For public self-service flows using mTAN identity verification, the purpose of this restriction is only to add an informative feedback message. This increases usability but could allow user enumeration since it makes it possible to find existing users without an mTAN token.</p><p>We recommend to configure this restriction as the last restriction to be checked.</p>",
   displayName = "No mTAN Token Restriction"
)
public class NoMtanTokenRestrictionConfig implements InternalPublicSelfServiceRestrictionConfig {
   @PluginProperty(description = "Retrieves 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 NoMtanTokenRestrictionConfig.NoMtanTokenRestrictionConfigBuilder builder() {
      return new NoMtanTokenRestrictionConfig.NoMtanTokenRestrictionConfigBuilder();
   }

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

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

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

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

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

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

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