package com.airlock.iam.common.domain.model.sms;

import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import org.apache.commons.lang3.StringUtils;

public final class Sms {
   private final String originator;
   private final String phoneNumber;
   private final String message;
   private final boolean flashMessage;

   public boolean hasMessage() {
      return !StringUtils.isBlank(this.message);
   }

   public boolean hasPhoneNumber() {
      return !StringUtils.isBlank(this.phoneNumber);
   }

   public boolean hasOriginator() {
      return !StringUtils.isBlank(this.originator);
   }

   @SuppressFBWarnings(justification = "generated code")
   Sms(String originator, String phoneNumber, String message, boolean flashMessage) {
      this.originator = originator;
      this.phoneNumber = phoneNumber;
      this.message = message;
      this.flashMessage = flashMessage;
   }

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

   @SuppressFBWarnings(justification = "generated code")
   public Sms.SmsBuilder toBuilder() {
      return new Sms.SmsBuilder().originator(this.originator).phoneNumber(this.phoneNumber).message(this.message).flashMessage(this.flashMessage);
   }

   @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 isFlashMessage() {
      return this.flashMessage;
   }

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

         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;
         }
      }
   }

   @SuppressFBWarnings(justification = "generated code")
   @Override
   public int hashCode() {
      int PRIME = 59;
      int result = 1;
      result = result * 59 + (this.flashMessage ? 79 : 97);
      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 "Sms(originator="
         + this.getOriginator()
         + ", phoneNumber="
         + this.getPhoneNumber()
         + ", message="
         + this.getMessage()
         + ", flashMessage="
         + this.isFlashMessage()
         + ")";
   }

   @SuppressFBWarnings(justification = "generated code")
   public static class SmsBuilder {
      @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 flashMessage;

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

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

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

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

      @SuppressFBWarnings(justification = "generated code")
      public Sms.SmsBuilder flashMessage(boolean flashMessage) {
         this.flashMessage = flashMessage;
         return this;
      }

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

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