package com.airlock.iam.login.application.configuration.location.propagate;

import com.airlock.iam.login.api.application.configuration.location.propagate.URIPropagationConfig;
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 = "Propagates a target URI as a HTTP header.")
public class HeaderURIPropagationConfig implements URIPropagationConfig {
   @StringProperty(description = "The name of the HTTP header.", optional = false, exampleValues = {"X-Forward-URL", "X-Location"})
   private String headerName;

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

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

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

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

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

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

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

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

      @SuppressFBWarnings(justification = "generated code")
      @Override
      public String toString() {
         return "HeaderURIPropagationConfig.HeaderURIPropagationConfigBuilder(headerName=" + this.headerName + ")";
      }
   }
}
