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 = "HTTP REST Request header with a static string value.", displayName = "Plain Static REST Request Header")
public class PlainStaticRestRequestHeaderConfig 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,
      validationRegex = "[\\x20-\\x7E]+",
      exampleValues = {"App-1", "Key-123"}
   )
   private String headerValue;

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

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

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

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

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

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

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

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

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

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

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