package com.airlock.iam.admin.infrastructure.transfer.request.techclient;

import com.airlock.iam.base.infrastructure.validation.NotNullOptionalValue;
import com.airlock.iam.base.infrastructure.validation.SizeOptionalString;
import com.airlock.iam.base.misc.data.OptionalString;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import io.swagger.v3.oas.annotations.media.Schema;

@JsonTypeName("tech-client")
@JsonDeserialize(builder = PlainTechClientUpdateRequest.PlainTechClientUpdateRequestJsonBuilder.class)
@JsonInclude(Include.NON_EMPTY)
public final class PlainTechClientUpdateRequest {
   @SizeOptionalString(min = 1, max = 100)
   @NotNullOptionalValue
   @Schema(
      type = "string",
      nullable = true,
      minLength = 1,
      maxLength = 100,
      description = "Human-readable name of the client. The name does not have to be unique and must be between 1 and 100 characters."
   )
   private OptionalString displayName;
   @SizeOptionalString(min = 1, max = 100)
   @Schema(
      type = "string",
      nullable = true,
      minLength = 1,
      maxLength = 100,
      description = "Description of the technical client. If present, must be between 1 and 100 characters."
   )
   private OptionalString description;
   @SizeOptionalString(min = 1, max = 100)
   @Schema(
      type = "string",
      nullable = true,
      minLength = 1,
      maxLength = 100,
      description = "Label of the technical client. If present, must be between 1 and 100 characters."
   )
   private OptionalString label;

   private PlainTechClientUpdateRequest() {
      this.displayName = OptionalString.none();
      this.description = OptionalString.none();
      this.label = OptionalString.none();
   }

   public static PlainTechClientUpdateRequest.PlainTechClientUpdateRequestBuilder builder() {
      return new PlainTechClientUpdateRequest().toBuilder();
   }

   @SuppressFBWarnings(justification = "generated code")
   public PlainTechClientUpdateRequest.PlainTechClientUpdateRequestBuilder toBuilder() {
      return new PlainTechClientUpdateRequest.PlainTechClientUpdateRequestBuilder()
         .displayName(this.displayName)
         .description(this.description)
         .label(this.label);
   }

   @SuppressFBWarnings(justification = "generated code")
   public OptionalString getDisplayName() {
      return this.displayName;
   }

   @SuppressFBWarnings(justification = "generated code")
   public OptionalString getDescription() {
      return this.description;
   }

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

   @SuppressFBWarnings(justification = "generated code")
   public void setDisplayName(OptionalString displayName) {
      this.displayName = displayName;
   }

   @SuppressFBWarnings(justification = "generated code")
   public void setDescription(OptionalString description) {
      this.description = description;
   }

   @SuppressFBWarnings(justification = "generated code")
   public void setLabel(OptionalString label) {
      this.label = label;
   }

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

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

   @SuppressFBWarnings(justification = "generated code")
   @Override
   public String toString() {
      return "PlainTechClientUpdateRequest(displayName="
         + this.getDisplayName()
         + ", description="
         + this.getDescription()
         + ", label="
         + this.getLabel()
         + ")";
   }

   @SuppressFBWarnings(justification = "generated code")
   public PlainTechClientUpdateRequest(OptionalString displayName, OptionalString description, OptionalString label) {
      this.displayName = displayName;
      this.description = description;
      this.label = label;
   }

   @SuppressFBWarnings(justification = "generated code")
   public static class PlainTechClientUpdateRequestBuilder {
      @SuppressFBWarnings(justification = "generated code")
      private OptionalString displayName;
      @SuppressFBWarnings(justification = "generated code")
      private OptionalString description;
      @SuppressFBWarnings(justification = "generated code")
      private OptionalString label;

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

      @SuppressFBWarnings(justification = "generated code")
      public PlainTechClientUpdateRequest.PlainTechClientUpdateRequestBuilder displayName(OptionalString displayName) {
         this.displayName = displayName;
         return this;
      }

      @SuppressFBWarnings(justification = "generated code")
      public PlainTechClientUpdateRequest.PlainTechClientUpdateRequestBuilder description(OptionalString description) {
         this.description = description;
         return this;
      }

      @SuppressFBWarnings(justification = "generated code")
      public PlainTechClientUpdateRequest.PlainTechClientUpdateRequestBuilder label(OptionalString label) {
         this.label = label;
         return this;
      }

      @SuppressFBWarnings(justification = "generated code")
      public PlainTechClientUpdateRequest build() {
         return new PlainTechClientUpdateRequest(this.displayName, this.description, this.label);
      }

      @SuppressFBWarnings(justification = "generated code")
      @Override
      public String toString() {
         return "PlainTechClientUpdateRequest.PlainTechClientUpdateRequestBuilder(displayName="
            + this.displayName
            + ", description="
            + this.description
            + ", label="
            + this.label
            + ")";
      }
   }

   @JsonPOJOBuilder(withPrefix = "")
   public static class PlainTechClientUpdateRequestJsonBuilder {
      private final PlainTechClientUpdateRequest.PlainTechClientUpdateRequestBuilder builder = PlainTechClientUpdateRequest.builder();

      public PlainTechClientUpdateRequest.PlainTechClientUpdateRequestJsonBuilder displayName(String displayName) {
         this.builder.displayName(OptionalString.of(displayName));
         return this;
      }

      public PlainTechClientUpdateRequest.PlainTechClientUpdateRequestJsonBuilder description(String description) {
         this.builder.description(OptionalString.of(description));
         return this;
      }

      public PlainTechClientUpdateRequest.PlainTechClientUpdateRequestJsonBuilder label(String label) {
         this.builder.label(OptionalString.of(label));
         return this;
      }

      public PlainTechClientUpdateRequest build() {
         return this.builder.build();
      }

      public static PlainTechClientUpdateRequest.PlainTechClientUpdateRequestJsonBuilder get() {
         return new PlainTechClientUpdateRequest.PlainTechClientUpdateRequestJsonBuilder();
      }
   }
}
