package com.airlock.iam.admin.domain.model.token.generic;

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

public final class StringInputGenericTokenUiElement implements GenericTokenUiElement {
   @NonNull
   private final String label;
   @NonNull
   private final String property;
   @Nullable
   private final String placeholder;
   private final boolean required;
   private final boolean readOnly;
   private final boolean hideIfEmpty;
   private final Pattern validation;

   @SuppressFBWarnings(justification = "generated code")
   StringInputGenericTokenUiElement(
      @NonNull String label,
      @NonNull String property,
      @Nullable String placeholder,
      boolean required,
      boolean readOnly,
      boolean hideIfEmpty,
      Pattern validation
   ) {
      if (label == null) {
         throw new NullPointerException("label is marked non-null but is null");
      }

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

      this.label = label;
      this.property = property;
      this.placeholder = placeholder;
      this.required = required;
      this.readOnly = readOnly;
      this.hideIfEmpty = hideIfEmpty;
      this.validation = validation;
   }

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

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

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

   @Nullable
   @SuppressFBWarnings(justification = "generated code")
   public String getPlaceholder() {
      return this.placeholder;
   }

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

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

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

   @SuppressFBWarnings(justification = "generated code")
   public Pattern getValidation() {
      return this.validation;
   }

   @SuppressFBWarnings(justification = "generated code")
   @Override
   public boolean equals(Object o) {
      if (o == this) {
         return true;
      } else if (!(o instanceof StringInputGenericTokenUiElement other)) {
         return false;
      } else {
         if (this.required != other.required) {
            return false;
         }

         if (this.readOnly != other.readOnly) {
            return false;
         }

         if (this.hideIfEmpty != other.hideIfEmpty) {
            return false;
         }

         Object this$label = this.label;
         Object other$label = other.label;
         if (this$label == null ? other$label == null : this$label.equals(other$label)) {
            Object this$property = this.property;
            Object other$property = other.property;
            if (this$property == null ? other$property == null : this$property.equals(other$property)) {
               Object this$placeholder = this.placeholder;
               Object other$placeholder = other.placeholder;
               if (this$placeholder == null ? other$placeholder == null : this$placeholder.equals(other$placeholder)) {
                  Object this$validation = this.validation;
                  Object other$validation = other.validation;
                  return this$validation == null ? other$validation == null : this$validation.equals(other$validation);
               } else {
                  return false;
               }
            } else {
               return false;
            }
         } else {
            return false;
         }
      }
   }

   @SuppressFBWarnings(justification = "generated code")
   @Override
   public int hashCode() {
      int PRIME = 59;
      int result = 1;
      result = result * 59 + (this.required ? 79 : 97);
      result = result * 59 + (this.readOnly ? 79 : 97);
      result = result * 59 + (this.hideIfEmpty ? 79 : 97);
      Object $label = this.label;
      result = result * 59 + ($label == null ? 43 : $label.hashCode());
      Object $property = this.property;
      result = result * 59 + ($property == null ? 43 : $property.hashCode());
      Object $placeholder = this.placeholder;
      result = result * 59 + ($placeholder == null ? 43 : $placeholder.hashCode());
      Object $validation = this.validation;
      return result * 59 + ($validation == null ? 43 : $validation.hashCode());
   }

   @SuppressFBWarnings(justification = "generated code")
   @Override
   public String toString() {
      return "StringInputGenericTokenUiElement(label="
         + this.getLabel()
         + ", property="
         + this.getProperty()
         + ", placeholder="
         + this.getPlaceholder()
         + ", required="
         + this.isRequired()
         + ", readOnly="
         + this.isReadOnly()
         + ", hideIfEmpty="
         + this.isHideIfEmpty()
         + ", validation="
         + this.getValidation()
         + ")";
   }

   @SuppressFBWarnings(justification = "generated code")
   public static class StringInputGenericTokenUiElementBuilder {
      @SuppressFBWarnings(justification = "generated code")
      private String label;
      @SuppressFBWarnings(justification = "generated code")
      private String property;
      @SuppressFBWarnings(justification = "generated code")
      private String placeholder;
      @SuppressFBWarnings(justification = "generated code")
      private boolean required;
      @SuppressFBWarnings(justification = "generated code")
      private boolean readOnly;
      @SuppressFBWarnings(justification = "generated code")
      private boolean hideIfEmpty;
      @SuppressFBWarnings(justification = "generated code")
      private Pattern validation;

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

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

         this.label = label;
         return this;
      }

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

         this.property = property;
         return this;
      }

      @SuppressFBWarnings(justification = "generated code")
      public StringInputGenericTokenUiElement.StringInputGenericTokenUiElementBuilder placeholder(@Nullable String placeholder) {
         this.placeholder = placeholder;
         return this;
      }

      @SuppressFBWarnings(justification = "generated code")
      public StringInputGenericTokenUiElement.StringInputGenericTokenUiElementBuilder required(boolean required) {
         this.required = required;
         return this;
      }

      @SuppressFBWarnings(justification = "generated code")
      public StringInputGenericTokenUiElement.StringInputGenericTokenUiElementBuilder readOnly(boolean readOnly) {
         this.readOnly = readOnly;
         return this;
      }

      @SuppressFBWarnings(justification = "generated code")
      public StringInputGenericTokenUiElement.StringInputGenericTokenUiElementBuilder hideIfEmpty(boolean hideIfEmpty) {
         this.hideIfEmpty = hideIfEmpty;
         return this;
      }

      @SuppressFBWarnings(justification = "generated code")
      public StringInputGenericTokenUiElement.StringInputGenericTokenUiElementBuilder validation(Pattern validation) {
         this.validation = validation;
         return this;
      }

      @SuppressFBWarnings(justification = "generated code")
      public StringInputGenericTokenUiElement build() {
         return new StringInputGenericTokenUiElement(
            this.label, this.property, this.placeholder, this.required, this.readOnly, this.hideIfEmpty, this.validation
         );
      }

      @SuppressFBWarnings(justification = "generated code")
      @Override
      public String toString() {
         return "StringInputGenericTokenUiElement.StringInputGenericTokenUiElementBuilder(label="
            + this.label
            + ", property="
            + this.property
            + ", placeholder="
            + this.placeholder
            + ", required="
            + this.required
            + ", readOnly="
            + this.readOnly
            + ", hideIfEmpty="
            + this.hideIfEmpty
            + ", validation="
            + this.validation
            + ")";
      }
   }
}
