package com.airlock.iam.oauth2.domain.model.session;

import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import lombok.NonNull;

public final class OAuth2CustomSessionAttribute {
   @NonNull
   private final String name;
   @NonNull
   private final String value;

   @SuppressFBWarnings(justification = "generated code")
   OAuth2CustomSessionAttribute(@NonNull String name, @NonNull String value) {
      if (name == null) {
         throw new NullPointerException("name is marked non-null but is null");
      }

      if (value == null) {
         throw new NullPointerException("value is marked non-null but is null");
      }

      this.name = name;
      this.value = value;
   }

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

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

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

   @SuppressFBWarnings(justification = "generated code")
   @Override
   public boolean equals(Object o) {
      if (o == this) {
         return true;
      } else if (!(o instanceof OAuth2CustomSessionAttribute other)) {
         return false;
      } else {
         Object this$name = this.name;
         Object other$name = other.name;
         if (this$name == null ? other$name == null : this$name.equals(other$name)) {
            Object this$value = this.value;
            Object other$value = other.value;
            return this$value == null ? other$value == null : this$value.equals(other$value);
         } else {
            return false;
         }
      }
   }

   @SuppressFBWarnings(justification = "generated code")
   @Override
   public int hashCode() {
      int PRIME = 59;
      int result = 1;
      Object $name = this.name;
      result = result * 59 + ($name == null ? 43 : $name.hashCode());
      Object $value = this.value;
      return result * 59 + ($value == null ? 43 : $value.hashCode());
   }

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

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

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

      @SuppressFBWarnings(justification = "generated code")
      public OAuth2CustomSessionAttribute.OAuth2CustomSessionAttributeBuilder name(@NonNull String name) {
         if (name == null) {
            throw new NullPointerException("name is marked non-null but is null");
         }

         this.name = name;
         return this;
      }

      @SuppressFBWarnings(justification = "generated code")
      public OAuth2CustomSessionAttribute.OAuth2CustomSessionAttributeBuilder value(@NonNull String value) {
         if (value == null) {
            throw new NullPointerException("value is marked non-null but is null");
         }

         this.value = value;
         return this;
      }

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

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