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

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

public final class StringValueGenericTokenUiElement implements GenericTokenUiElement {
   @NonNull
   private final String label;
   @NonNull
   private final String property;
   private final boolean hideIfEmpty;

   @SuppressFBWarnings(justification = "generated code")
   StringValueGenericTokenUiElement(@NonNull String label, @NonNull String property, boolean hideIfEmpty) {
      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.hideIfEmpty = hideIfEmpty;
   }

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

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

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

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

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

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

   @SuppressFBWarnings(justification = "generated code")
   @Override
   public String toString() {
      return "StringValueGenericTokenUiElement(label=" + this.getLabel() + ", property=" + this.getProperty() + ", hideIfEmpty=" + this.isHideIfEmpty() + ")";
   }

   @SuppressFBWarnings(justification = "generated code")
   public static class StringValueGenericTokenUiElementBuilder {
      @SuppressFBWarnings(justification = "generated code")
      private String label;
      @SuppressFBWarnings(justification = "generated code")
      private String property;
      @SuppressFBWarnings(justification = "generated code")
      private boolean hideIfEmpty;

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

      @SuppressFBWarnings(justification = "generated code")
      public StringValueGenericTokenUiElement.StringValueGenericTokenUiElementBuilder 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 StringValueGenericTokenUiElement.StringValueGenericTokenUiElementBuilder 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 StringValueGenericTokenUiElement.StringValueGenericTokenUiElementBuilder hideIfEmpty(boolean hideIfEmpty) {
         this.hideIfEmpty = hideIfEmpty;
         return this;
      }

      @SuppressFBWarnings(justification = "generated code")
      public StringValueGenericTokenUiElement build() {
         return new StringValueGenericTokenUiElement(this.label, this.property, this.hideIfEmpty);
      }

      @SuppressFBWarnings(justification = "generated code")
      @Override
      public String toString() {
         return "StringValueGenericTokenUiElement.StringValueGenericTokenUiElementBuilder(label="
            + this.label
            + ", property="
            + this.property
            + ", hideIfEmpty="
            + this.hideIfEmpty
            + ")";
      }
   }
}
