package com.airlock.iam.login.application.configuration.oauth2;

import com.airlock.iam.login.application.configuration.targetapp.ApplicationIdConfig;
import com.airlock.iam.plugin.api.annotation.config.Plugin;
import com.airlock.iam.plugin.api.annotation.property.PluginProperty;
import com.airlock.iam.plugin.api.annotation.property.StringProperty;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;

@Plugin(
   description = "An authentication flow can be started based on a requested ACR value. If a configured ACR Value is found in the OpenID Connect request, the authentication flow of the configured application ID is started.",
   displayName = "ACR to Flow Application ID Mapping"
)
public class OpenIdConnectAcrToApplicationIdConfig {
   @StringProperty(
      description = "When a requested ACR value matches this ACR, the configured Flow Application ID is started. Note: The ACR value is case sensitive.",
      displayName = "ACR Value",
      optional = false
   )
   private String acrValue;
   @PluginProperty(
      description = "Application ID Flow to start, if a configured ACR is found in the OpenID Connect request.",
      displayName = "Flow Application ID",
      optional = false
   )
   private ApplicationIdConfig flowApplicationId;

   public String getAcrValue() {
      return this.acrValue;
   }

   public ApplicationIdConfig getFlowApplicationId() {
      return this.flowApplicationId;
   }

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

   @SuppressFBWarnings(justification = "generated code")
   public OpenIdConnectAcrToApplicationIdConfig(String acrValue, ApplicationIdConfig flowApplicationId) {
      this.acrValue = acrValue;
      this.flowApplicationId = flowApplicationId;
   }

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

   @SuppressFBWarnings(justification = "generated code")
   public static class OpenIdConnectAcrToApplicationIdConfigBuilder {
      @SuppressFBWarnings(justification = "generated code")
      private String acrValue;
      @SuppressFBWarnings(justification = "generated code")
      private ApplicationIdConfig flowApplicationId;

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

      @SuppressFBWarnings(justification = "generated code")
      public OpenIdConnectAcrToApplicationIdConfig.OpenIdConnectAcrToApplicationIdConfigBuilder acrValue(String acrValue) {
         this.acrValue = acrValue;
         return this;
      }

      @SuppressFBWarnings(justification = "generated code")
      public OpenIdConnectAcrToApplicationIdConfig.OpenIdConnectAcrToApplicationIdConfigBuilder flowApplicationId(ApplicationIdConfig flowApplicationId) {
         this.flowApplicationId = flowApplicationId;
         return this;
      }

      @SuppressFBWarnings(justification = "generated code")
      public OpenIdConnectAcrToApplicationIdConfig build() {
         return new OpenIdConnectAcrToApplicationIdConfig(this.acrValue, this.flowApplicationId);
      }

      @SuppressFBWarnings(justification = "generated code")
      @Override
      public String toString() {
         return "OpenIdConnectAcrToApplicationIdConfig.OpenIdConnectAcrToApplicationIdConfigBuilder(acrValue="
            + this.acrValue
            + ", flowApplicationId="
            + this.flowApplicationId
            + ")";
      }
   }
}
