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

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

@Plugin(
   description = "Specifies the format of the client secret passed as a parameter of OAuth 2.0 requests.",
   displayName = "OAuth 2.0 Parameter Client Secret (AS)"
)
@PluginLicenseRestriction(moduleAffiliation = "OAuthServer")
public class OAuth2ParameterClientSecretMethodConfig implements OAuth2ClientSecretMethodConfig {
   @StringProperty(description = "Parameter name of the request parameter containing the client ID.", optional = true, defaultValue = "client_id")
   private String clientIdName;
   @StringProperty(description = "Parameter name of the request parameter containing the client secret.", optional = true, defaultValue = "client_secret")
   private String parameterName;

   public String getClientIdName() {
      return this.clientIdName;
   }

   public String getParameterName() {
      return this.parameterName;
   }

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

   @SuppressFBWarnings(justification = "generated code")
   public OAuth2ParameterClientSecretMethodConfig(String clientIdName, String parameterName) {
      this.clientIdName = clientIdName;
      this.parameterName = parameterName;
   }

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

   @SuppressFBWarnings(justification = "generated code")
   public static class OAuth2ParameterClientSecretMethodConfigBuilder {
      @SuppressFBWarnings(justification = "generated code")
      private String clientIdName;
      @SuppressFBWarnings(justification = "generated code")
      private String parameterName;

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

      @SuppressFBWarnings(justification = "generated code")
      public OAuth2ParameterClientSecretMethodConfig.OAuth2ParameterClientSecretMethodConfigBuilder clientIdName(String clientIdName) {
         this.clientIdName = clientIdName;
         return this;
      }

      @SuppressFBWarnings(justification = "generated code")
      public OAuth2ParameterClientSecretMethodConfig.OAuth2ParameterClientSecretMethodConfigBuilder parameterName(String parameterName) {
         this.parameterName = parameterName;
         return this;
      }

      @SuppressFBWarnings(justification = "generated code")
      public OAuth2ParameterClientSecretMethodConfig build() {
         return new OAuth2ParameterClientSecretMethodConfig(this.clientIdName, this.parameterName);
      }

      @SuppressFBWarnings(justification = "generated code")
      @Override
      public String toString() {
         return "OAuth2ParameterClientSecretMethodConfig.OAuth2ParameterClientSecretMethodConfigBuilder(clientIdName="
            + this.clientIdName
            + ", parameterName="
            + this.parameterName
            + ")";
      }
   }
}
