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

import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import java.util.regex.Pattern;
import lombok.NonNull;

public final class OAuth2CustomSessionAttributeValidatorRule {
   @NonNull
   private final String name;
   @NonNull
   private final Pattern pattern;
   private final boolean updatable;

   @SuppressFBWarnings(justification = "generated code")
   OAuth2CustomSessionAttributeValidatorRule(@NonNull String name, @NonNull Pattern pattern, boolean updatable) {
      if (name == null) {
         throw new NullPointerException("name is marked non-null but is null");
      }

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

      this.name = name;
      this.pattern = pattern;
      this.updatable = updatable;
   }

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

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

   @NonNull
   @SuppressFBWarnings(justification = "generated code")
   public Pattern getPattern() {
      return this.pattern;
   }

   @SuppressFBWarnings(justification = "generated code")
   public boolean isUpdatable() {
      return this.updatable;
   }

   @SuppressFBWarnings(justification = "generated code")
   @Override
   public boolean equals(Object o) {
      if (o == this) {
         return true;
      } else if (!(o instanceof OAuth2CustomSessionAttributeValidatorRule other)) {
         return false;
      } else if (this.updatable != other.updatable) {
         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$pattern = this.pattern;
            Object other$pattern = other.pattern;
            return this$pattern == null ? other$pattern == null : this$pattern.equals(other$pattern);
         } else {
            return false;
         }
      }
   }

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

   @SuppressFBWarnings(justification = "generated code")
   @Override
   public String toString() {
      return "OAuth2CustomSessionAttributeValidatorRule(name=" + this.getName() + ", pattern=" + this.getPattern() + ", updatable=" + this.isUpdatable() + ")";
   }

   @SuppressFBWarnings(justification = "generated code")
   public static class OAuth2CustomSessionAttributeValidatorRuleBuilder {
      @SuppressFBWarnings(justification = "generated code")
      private String name;
      @SuppressFBWarnings(justification = "generated code")
      private Pattern pattern;
      @SuppressFBWarnings(justification = "generated code")
      private boolean updatable;

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

      @SuppressFBWarnings(justification = "generated code")
      public OAuth2CustomSessionAttributeValidatorRule.OAuth2CustomSessionAttributeValidatorRuleBuilder 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 OAuth2CustomSessionAttributeValidatorRule.OAuth2CustomSessionAttributeValidatorRuleBuilder pattern(@NonNull Pattern pattern) {
         if (pattern == null) {
            throw new NullPointerException("pattern is marked non-null but is null");
         }

         this.pattern = pattern;
         return this;
      }

      @SuppressFBWarnings(justification = "generated code")
      public OAuth2CustomSessionAttributeValidatorRule.OAuth2CustomSessionAttributeValidatorRuleBuilder updatable(boolean updatable) {
         this.updatable = updatable;
         return this;
      }

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

      @SuppressFBWarnings(justification = "generated code")
      @Override
      public String toString() {
         return "OAuth2CustomSessionAttributeValidatorRule.OAuth2CustomSessionAttributeValidatorRuleBuilder(name="
            + this.name
            + ", pattern="
            + this.pattern
            + ", updatable="
            + this.updatable
            + ")";
      }
   }
}
