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

import com.fasterxml.jackson.annotation.JsonTypeName;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.annotation.Nullable;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;

@JsonTypeName("sms.send")
public class SmsSendRequest {
   public static final String SMS_SEND_TYPE = "sms.send";
   @Nullable
   @Schema(
      description = "The originator of the message. If the originator is pre-configured, this value must not be set. Otherwise, the client can choose the originator. The limitations regarding length are: <ul> <li>For alphanumeric originators, the maximal length is 11.</li> <li>For numeric originators, the maximal length is 16.</li> </ul>",
      minLength = 1,
      maxLength = 16
   )
   @Size(min = 1, max = 16)
   private String originator;
   @NotNull
   @Schema(
      description = "The phone number to send the message to. The phone number is expected to be normalized (no characters other than an (optional) leading + followed by numbers). For example: +41791234567 or 0041791234567",
      minLength = 1
   )
   @Size(min = 1)
   private String phoneNumber;
   @NotNull
   @Schema(description = "The message itself.", minLength = 1)
   @Size(min = 1)
   private String message;
   @NotNull
   @Schema(description = "Whether or not to use a flash message.")
   private Boolean isFlash;

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

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

   @SuppressFBWarnings(justification = "generated code")
   public String getPhoneNumber() {
      return this.phoneNumber;
   }

   @SuppressFBWarnings(justification = "generated code")
   public String getMessage() {
      return this.message;
   }

   @SuppressFBWarnings(justification = "generated code")
   public Boolean getIsFlash() {
      return this.isFlash;
   }

   @SuppressFBWarnings(justification = "generated code")
   public void setOriginator(@Nullable String originator) {
      this.originator = originator;
   }

   @SuppressFBWarnings(justification = "generated code")
   public void setPhoneNumber(String phoneNumber) {
      this.phoneNumber = phoneNumber;
   }

   @SuppressFBWarnings(justification = "generated code")
   public void setMessage(String message) {
      this.message = message;
   }

   @SuppressFBWarnings(justification = "generated code")
   public void setIsFlash(Boolean isFlash) {
      this.isFlash = isFlash;
   }

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

         Object this$isFlash = this.isFlash;
         Object other$isFlash = other.isFlash;
         if (this$isFlash == null ? other$isFlash == null : this$isFlash.equals(other$isFlash)) {
            Object this$originator = this.originator;
            Object other$originator = other.originator;
            if (this$originator == null ? other$originator == null : this$originator.equals(other$originator)) {
               Object this$phoneNumber = this.phoneNumber;
               Object other$phoneNumber = other.phoneNumber;
               if (this$phoneNumber == null ? other$phoneNumber == null : this$phoneNumber.equals(other$phoneNumber)) {
                  Object this$message = this.message;
                  Object other$message = other.message;
                  return this$message == null ? other$message == null : this$message.equals(other$message);
               } else {
                  return false;
               }
            } else {
               return false;
            }
         } else {
            return false;
         }
      }
   }

   @SuppressFBWarnings(justification = "generated code")
   protected boolean canEqual(Object other) {
      return other instanceof SmsSendRequest;
   }

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

   @SuppressFBWarnings(justification = "generated code")
   @Override
   public String toString() {
      return "SmsSendRequest(originator="
         + this.getOriginator()
         + ", phoneNumber="
         + this.getPhoneNumber()
         + ", message="
         + this.getMessage()
         + ", isFlash="
         + this.getIsFlash()
         + ")";
   }

   @SuppressFBWarnings(justification = "generated code")
   public SmsSendRequest() {
   }

   @SuppressFBWarnings(justification = "generated code")
   public SmsSendRequest(@Nullable String originator, String phoneNumber, String message, Boolean isFlash) {
      this.originator = originator;
      this.phoneNumber = phoneNumber;
      this.message = message;
      this.isFlash = isFlash;
   }

   @SuppressFBWarnings(justification = "generated code")
   public static class SmsSendRequestBuilder {
      @SuppressFBWarnings(justification = "generated code")
      private String originator;
      @SuppressFBWarnings(justification = "generated code")
      private String phoneNumber;
      @SuppressFBWarnings(justification = "generated code")
      private String message;
      @SuppressFBWarnings(justification = "generated code")
      private Boolean isFlash;

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

      @SuppressFBWarnings(justification = "generated code")
      public SmsSendRequest.SmsSendRequestBuilder originator(@Nullable String originator) {
         this.originator = originator;
         return this;
      }

      @SuppressFBWarnings(justification = "generated code")
      public SmsSendRequest.SmsSendRequestBuilder phoneNumber(String phoneNumber) {
         this.phoneNumber = phoneNumber;
         return this;
      }

      @SuppressFBWarnings(justification = "generated code")
      public SmsSendRequest.SmsSendRequestBuilder message(String message) {
         this.message = message;
         return this;
      }

      @SuppressFBWarnings(justification = "generated code")
      public SmsSendRequest.SmsSendRequestBuilder isFlash(Boolean isFlash) {
         this.isFlash = isFlash;
         return this;
      }

      @SuppressFBWarnings(justification = "generated code")
      public SmsSendRequest build() {
         return new SmsSendRequest(this.originator, this.phoneNumber, this.message, this.isFlash);
      }

      @SuppressFBWarnings(justification = "generated code")
      @Override
      public String toString() {
         return "SmsSendRequest.SmsSendRequestBuilder(originator="
            + this.originator
            + ", phoneNumber="
            + this.phoneNumber
            + ", message="
            + this.message
            + ", isFlash="
            + this.isFlash
            + ")";
      }
   }
}
