package com.airlock.iam.common.application.configuration.restclient;

import com.airlock.iam.plugin.api.annotation.config.Plugin;
import com.airlock.iam.plugin.api.annotation.property.StringProperty;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;

@Plugin(description = "A HTTP REST Request header with a sensitive header value.", displayName = "Sensitive Static REST Request Header")
public class SensitiveStaticRestRequestHeaderConfig implements StaticRestRequestHeaderConfig {
   @StringProperty(
      description = "The header name of the HTTP REST Request header.",
      optional = false,
      validationRegex = "[a-zA-Z0-9_-]+",
      exampleValues = {"App-ID", "App-Key"}
   )
   private String headerName;
   @StringProperty(description = "The header value of the HTTP REST Request header.", optional = false, isSensitive = true, exampleValues = "App-1")
   private String headerValue;

   @Override
   public String getHeaderName() {
      return this.headerName;
   }

   @Override
   public String getHeaderValue() {
      return this.headerValue;
   }

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

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

   @SuppressFBWarnings(justification = "generated code")
   public SensitiveStaticRestRequestHeaderConfig(String headerName, String headerValue) {
      this.headerName = headerName;
      this.headerValue = headerValue;
   }

   @SuppressFBWarnings(justification = "generated code")
   public static class SensitiveStaticRestRequestHeaderConfigBuilder {
      @SuppressFBWarnings(justification = "generated code")
      private String headerName;
      @SuppressFBWarnings(justification = "generated code")
      private String headerValue;

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

      @SuppressFBWarnings(justification = "generated code")
      public SensitiveStaticRestRequestHeaderConfig.SensitiveStaticRestRequestHeaderConfigBuilder headerName(String headerName) {
         this.headerName = headerName;
         return this;
      }

      @SuppressFBWarnings(justification = "generated code")
      public SensitiveStaticRestRequestHeaderConfig.SensitiveStaticRestRequestHeaderConfigBuilder headerValue(String headerValue) {
         this.headerValue = headerValue;
         return this;
      }

      @SuppressFBWarnings(justification = "generated code")
      public SensitiveStaticRestRequestHeaderConfig build() {
         return new SensitiveStaticRestRequestHeaderConfig(this.headerName, this.headerValue);
      }

      @SuppressFBWarnings(justification = "generated code")
      @Override
      public String toString() {
         return "SensitiveStaticRestRequestHeaderConfig.SensitiveStaticRestRequestHeaderConfigBuilder(headerName="
            + this.headerName
            + ", headerValue="
            + this.headerValue
            + ")";
      }
   }
}
