package com.airlock.iam.login.app.misc.configuration.oneshot;

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 = "Defines an HTTP header.")
public final class HTTPHeader {
   @StringProperty(description = "The name of the header.", exampleValues = {"Location", "Server", "WWW-Authenticate"}, optional = false)
   private String name;
   @StringProperty(
      description = "The value of the header.",
      exampleValues = {"http://www.example.com", "Apache/1.3.27 (Unix) (Red-Hat/Linux)", "Bearer realm=\"myrealm\", error=\"invalid_request\""},
      optional = false
   )
   private String value;

   public String getName() {
      return this.name;
   }

   public String getValue() {
      return this.value;
   }

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

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

   @SuppressFBWarnings(justification = "generated code")
   public HTTPHeader(String name, String value) {
      this.name = name;
      this.value = value;
   }

   @SuppressFBWarnings(justification = "generated code")
   public static class HTTPHeaderBuilder {
      @SuppressFBWarnings(justification = "generated code")
      private String name;
      @SuppressFBWarnings(justification = "generated code")
      private String value;

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

      @SuppressFBWarnings(justification = "generated code")
      public HTTPHeader.HTTPHeaderBuilder name(String name) {
         this.name = name;
         return this;
      }

      @SuppressFBWarnings(justification = "generated code")
      public HTTPHeader.HTTPHeaderBuilder value(String value) {
         this.value = value;
         return this;
      }

      @SuppressFBWarnings(justification = "generated code")
      public HTTPHeader build() {
         return new HTTPHeader(this.name, this.value);
      }

      @SuppressFBWarnings(justification = "generated code")
      @Override
      public String toString() {
         return "HTTPHeader.HTTPHeaderBuilder(name=" + this.name + ", value=" + this.value + ")";
      }
   }
}
