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

import com.airlock.iam.base.infrastructure.validation.NotNullOptionalValue;
import com.airlock.iam.base.misc.data.OptionalBoolean;
import com.airlock.iam.base.misc.data.OptionalString;
import com.airlock.iam.base.misc.data.OptionalValue;
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;
import jakarta.annotation.Nullable;
import java.util.Date;
import java.util.Map;

@JsonTypeName("maintenance-message.patch")
@JsonDeserialize(builder = MaintenanceMessagePatchRequest.MaintenanceMessagePatchDataJsonBuilder.class)
@JsonInclude(Include.NON_EMPTY)
public final class MaintenanceMessagePatchRequest {
   public static final String MAINTENANCE_MESSAGE_PATCH_TYPE = "maintenance-message.patch";
   @Nullable
   @Schema(type = "string", nullable = true, description = "The location (optional, depending on configuration).")
   private OptionalString location;
   @NotNullOptionalValue
   @Schema(type = "boolean", nullable = true, description = "Whether the message is active or not.")
   private OptionalBoolean active;
   @NotNullOptionalValue
   @Schema(type = "boolean", nullable = true, description = "Whether the system is available when this message is displayed or not.")
   private OptionalBoolean systemAvailable;
   @Schema(nullable = true, type = "string", description = "The validity start date of this message.")
   private OptionalValue<Date> validFrom;
   @Schema(nullable = true, type = "string", description = "The validity end date of this message.")
   private OptionalValue<Date> validTo;
   @NotNullOptionalValue
   @Schema(ref = "#/components/schemas/MaintenanceMessagePatchDataTranslationsOverride")
   private OptionalValue<Map<String, String>> translations;

   private MaintenanceMessagePatchRequest() {
      this.location = OptionalString.none();
      this.active = OptionalBoolean.none();
      this.systemAvailable = OptionalBoolean.none();
      this.validFrom = OptionalValue.none();
      this.validTo = OptionalValue.none();
      this.translations = OptionalValue.none();
   }

   public static MaintenanceMessagePatchRequest.MaintenanceMessagePatchRequestBuilder builder() {
      return new MaintenanceMessagePatchRequest().toBuilder();
   }

   @SuppressFBWarnings(justification = "generated code")
   public MaintenanceMessagePatchRequest.MaintenanceMessagePatchRequestBuilder toBuilder() {
      return new MaintenanceMessagePatchRequest.MaintenanceMessagePatchRequestBuilder()
         .location(this.location)
         .active(this.active)
         .systemAvailable(this.systemAvailable)
         .validFrom(this.validFrom)
         .validTo(this.validTo)
         .translations(this.translations);
   }

   @Nullable
   @SuppressFBWarnings(justification = "generated code")
   public OptionalString getLocation() {
      return this.location;
   }

   @SuppressFBWarnings(justification = "generated code")
   public OptionalBoolean getActive() {
      return this.active;
   }

   @SuppressFBWarnings(justification = "generated code")
   public OptionalBoolean getSystemAvailable() {
      return this.systemAvailable;
   }

   @SuppressFBWarnings(justification = "generated code")
   public OptionalValue<Date> getValidFrom() {
      return this.validFrom;
   }

   @SuppressFBWarnings(justification = "generated code")
   public OptionalValue<Date> getValidTo() {
      return this.validTo;
   }

   @SuppressFBWarnings(justification = "generated code")
   public OptionalValue<Map<String, String>> getTranslations() {
      return this.translations;
   }

   @SuppressFBWarnings(justification = "generated code")
   public void setLocation(@Nullable OptionalString location) {
      this.location = location;
   }

   @SuppressFBWarnings(justification = "generated code")
   public void setActive(OptionalBoolean active) {
      this.active = active;
   }

   @SuppressFBWarnings(justification = "generated code")
   public void setSystemAvailable(OptionalBoolean systemAvailable) {
      this.systemAvailable = systemAvailable;
   }

   @SuppressFBWarnings(justification = "generated code")
   public void setValidFrom(OptionalValue<Date> validFrom) {
      this.validFrom = validFrom;
   }

   @SuppressFBWarnings(justification = "generated code")
   public void setValidTo(OptionalValue<Date> validTo) {
      this.validTo = validTo;
   }

   @SuppressFBWarnings(justification = "generated code")
   public void setTranslations(OptionalValue<Map<String, String>> translations) {
      this.translations = translations;
   }

   @SuppressFBWarnings(justification = "generated code")
   @Override
   public boolean equals(Object o) {
      if (o == this) {
         return true;
      } else if (!(o instanceof MaintenanceMessagePatchRequest other)) {
         return false;
      } else {
         Object this$location = this.location;
         Object other$location = other.location;
         if (this$location == null ? other$location == null : this$location.equals(other$location)) {
            Object this$active = this.active;
            Object other$active = other.active;
            if (this$active == null ? other$active == null : this$active.equals(other$active)) {
               Object this$systemAvailable = this.systemAvailable;
               Object other$systemAvailable = other.systemAvailable;
               if (this$systemAvailable == null ? other$systemAvailable == null : this$systemAvailable.equals(other$systemAvailable)) {
                  Object this$validFrom = this.validFrom;
                  Object other$validFrom = other.validFrom;
                  if (this$validFrom == null ? other$validFrom == null : this$validFrom.equals(other$validFrom)) {
                     Object this$validTo = this.validTo;
                     Object other$validTo = other.validTo;
                     if (this$validTo == null ? other$validTo == null : this$validTo.equals(other$validTo)) {
                        Object this$translations = this.translations;
                        Object other$translations = other.translations;
                        return this$translations == null ? other$translations == null : this$translations.equals(other$translations);
                     } else {
                        return false;
                     }
                  } else {
                     return false;
                  }
               } else {
                  return false;
               }
            } else {
               return false;
            }
         } else {
            return false;
         }
      }
   }

   @SuppressFBWarnings(justification = "generated code")
   @Override
   public int hashCode() {
      int PRIME = 59;
      int result = 1;
      Object $location = this.location;
      result = result * 59 + ($location == null ? 43 : $location.hashCode());
      Object $active = this.active;
      result = result * 59 + ($active == null ? 43 : $active.hashCode());
      Object $systemAvailable = this.systemAvailable;
      result = result * 59 + ($systemAvailable == null ? 43 : $systemAvailable.hashCode());
      Object $validFrom = this.validFrom;
      result = result * 59 + ($validFrom == null ? 43 : $validFrom.hashCode());
      Object $validTo = this.validTo;
      result = result * 59 + ($validTo == null ? 43 : $validTo.hashCode());
      Object $translations = this.translations;
      return result * 59 + ($translations == null ? 43 : $translations.hashCode());
   }

   @SuppressFBWarnings(justification = "generated code")
   @Override
   public String toString() {
      return "MaintenanceMessagePatchRequest(location="
         + this.getLocation()
         + ", active="
         + this.getActive()
         + ", systemAvailable="
         + this.getSystemAvailable()
         + ", validFrom="
         + this.getValidFrom()
         + ", validTo="
         + this.getValidTo()
         + ", translations="
         + this.getTranslations()
         + ")";
   }

   @SuppressFBWarnings(justification = "generated code")
   public MaintenanceMessagePatchRequest(
      @Nullable OptionalString location,
      OptionalBoolean active,
      OptionalBoolean systemAvailable,
      OptionalValue<Date> validFrom,
      OptionalValue<Date> validTo,
      OptionalValue<Map<String, String>> translations
   ) {
      this.location = location;
      this.active = active;
      this.systemAvailable = systemAvailable;
      this.validFrom = validFrom;
      this.validTo = validTo;
      this.translations = translations;
   }

   @JsonPOJOBuilder(withPrefix = "")
   public static class MaintenanceMessagePatchDataJsonBuilder {
      private final MaintenanceMessagePatchRequest.MaintenanceMessagePatchRequestBuilder builder = MaintenanceMessagePatchRequest.builder();

      public MaintenanceMessagePatchRequest.MaintenanceMessagePatchDataJsonBuilder location(String location) {
         this.builder.location(OptionalString.of(location));
         return this;
      }

      public MaintenanceMessagePatchRequest.MaintenanceMessagePatchDataJsonBuilder active(Boolean active) {
         this.builder.active(OptionalBoolean.of(active));
         return this;
      }

      public MaintenanceMessagePatchRequest.MaintenanceMessagePatchDataJsonBuilder systemAvailable(Boolean systemAvailable) {
         this.builder.systemAvailable(OptionalBoolean.of(systemAvailable));
         return this;
      }

      public MaintenanceMessagePatchRequest.MaintenanceMessagePatchDataJsonBuilder validFrom(Date validFrom) {
         this.builder.validFrom(OptionalValue.of(validFrom));
         return this;
      }

      public MaintenanceMessagePatchRequest.MaintenanceMessagePatchDataJsonBuilder validTo(Date validTo) {
         this.builder.validTo(OptionalValue.of(validTo));
         return this;
      }

      public MaintenanceMessagePatchRequest.MaintenanceMessagePatchDataJsonBuilder translations(Map<String, String> translations) {
         this.builder.translations(OptionalValue.of(translations));
         return this;
      }

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

      public static MaintenanceMessagePatchRequest.MaintenanceMessagePatchDataJsonBuilder get() {
         return new MaintenanceMessagePatchRequest.MaintenanceMessagePatchDataJsonBuilder();
      }
   }

   @SuppressFBWarnings(justification = "generated code")
   public static class MaintenanceMessagePatchRequestBuilder {
      @SuppressFBWarnings(justification = "generated code")
      private OptionalString location;
      @SuppressFBWarnings(justification = "generated code")
      private OptionalBoolean active;
      @SuppressFBWarnings(justification = "generated code")
      private OptionalBoolean systemAvailable;
      @SuppressFBWarnings(justification = "generated code")
      private OptionalValue<Date> validFrom;
      @SuppressFBWarnings(justification = "generated code")
      private OptionalValue<Date> validTo;
      @SuppressFBWarnings(justification = "generated code")
      private OptionalValue<Map<String, String>> translations;

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

      @SuppressFBWarnings(justification = "generated code")
      public MaintenanceMessagePatchRequest.MaintenanceMessagePatchRequestBuilder location(@Nullable OptionalString location) {
         this.location = location;
         return this;
      }

      @SuppressFBWarnings(justification = "generated code")
      public MaintenanceMessagePatchRequest.MaintenanceMessagePatchRequestBuilder active(OptionalBoolean active) {
         this.active = active;
         return this;
      }

      @SuppressFBWarnings(justification = "generated code")
      public MaintenanceMessagePatchRequest.MaintenanceMessagePatchRequestBuilder systemAvailable(OptionalBoolean systemAvailable) {
         this.systemAvailable = systemAvailable;
         return this;
      }

      @SuppressFBWarnings(justification = "generated code")
      public MaintenanceMessagePatchRequest.MaintenanceMessagePatchRequestBuilder validFrom(OptionalValue<Date> validFrom) {
         this.validFrom = validFrom;
         return this;
      }

      @SuppressFBWarnings(justification = "generated code")
      public MaintenanceMessagePatchRequest.MaintenanceMessagePatchRequestBuilder validTo(OptionalValue<Date> validTo) {
         this.validTo = validTo;
         return this;
      }

      @SuppressFBWarnings(justification = "generated code")
      public MaintenanceMessagePatchRequest.MaintenanceMessagePatchRequestBuilder translations(OptionalValue<Map<String, String>> translations) {
         this.translations = translations;
         return this;
      }

      @SuppressFBWarnings(justification = "generated code")
      public MaintenanceMessagePatchRequest build() {
         return new MaintenanceMessagePatchRequest(this.location, this.active, this.systemAvailable, this.validFrom, this.validTo, this.translations);
      }

      @SuppressFBWarnings(justification = "generated code")
      @Override
      public String toString() {
         return "MaintenanceMessagePatchRequest.MaintenanceMessagePatchRequestBuilder(location="
            + this.location
            + ", active="
            + this.active
            + ", systemAvailable="
            + this.systemAvailable
            + ", validFrom="
            + this.validFrom
            + ", validTo="
            + this.validTo
            + ", translations="
            + this.translations
            + ")";
      }
   }
}
