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

import com.airlock.iam.factor.domain.model.airlock2fa.activation.Airlock2FAActivationCode;
import com.airlock.iam.factor.domain.model.airlock2fa.activation.Airlock2FAActivationCodeShort;
import com.airlock.iam.factor.domain.model.airlock2fa.qrcode.Airlock2FAQrCodeImage;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import java.util.Optional;
import lombok.NonNull;

public final class Airlock2FAConfidentialActivation {
   @NonNull
   private final Airlock2FAActivationCode activationCode;
   @NonNull
   private final Airlock2FAQrCodeImage activationQrCode;
   @NonNull
   private final Optional<Airlock2FAActivationCodeShort> activationCodeShort;

   public static Airlock2FAConfidentialActivation confidentialAirlock2FAActivation(
      @NonNull Airlock2FAActivationCode airlock2FAActivationCode,
      @NonNull Airlock2FAQrCodeImage airlock2FAActivationQrCode,
      @NonNull Optional<Airlock2FAActivationCodeShort> activationCodeShort
   ) {
      if (airlock2FAActivationCode == null) {
         throw new NullPointerException("airlock2FAActivationCode is marked non-null but is null");
      } else if (airlock2FAActivationQrCode == null) {
         throw new NullPointerException("airlock2FAActivationQrCode is marked non-null but is null");
      } else if (activationCodeShort == null) {
         throw new NullPointerException("activationCodeShort is marked non-null but is null");
      } else {
         return new Airlock2FAConfidentialActivation(airlock2FAActivationCode, airlock2FAActivationQrCode, activationCodeShort);
      }
   }

   @NonNull
   @SuppressFBWarnings(justification = "generated code")
   public Airlock2FAActivationCode getActivationCode() {
      return this.activationCode;
   }

   @NonNull
   @SuppressFBWarnings(justification = "generated code")
   public Airlock2FAQrCodeImage getActivationQrCode() {
      return this.activationQrCode;
   }

   @NonNull
   @SuppressFBWarnings(justification = "generated code")
   public Optional<Airlock2FAActivationCodeShort> getActivationCodeShort() {
      return this.activationCodeShort;
   }

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

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

   @SuppressFBWarnings(justification = "generated code")
   @Override
   public String toString() {
      return "Airlock2FAConfidentialActivation(activationCode="
         + this.getActivationCode()
         + ", activationQrCode="
         + this.getActivationQrCode()
         + ", activationCodeShort="
         + this.getActivationCodeShort()
         + ")";
   }

   @SuppressFBWarnings(justification = "generated code")
   private Airlock2FAConfidentialActivation(
      @NonNull Airlock2FAActivationCode activationCode,
      @NonNull Airlock2FAQrCodeImage activationQrCode,
      @NonNull Optional<Airlock2FAActivationCodeShort> activationCodeShort
   ) {
      if (activationCode == null) {
         throw new NullPointerException("activationCode is marked non-null but is null");
      }

      if (activationQrCode == null) {
         throw new NullPointerException("activationQrCode is marked non-null but is null");
      }

      if (activationCodeShort == null) {
         throw new NullPointerException("activationCodeShort is marked non-null but is null");
      }

      this.activationCode = activationCode;
      this.activationQrCode = activationQrCode;
      this.activationCodeShort = activationCodeShort;
   }
}
