package com.airlock.iam.factor.domain.model.airlock2fa;

import com.airlock.iam.airlock2fa.api.domain.model.Airlock2FAAccountId;
import com.airlock.iam.base.api.domain.model.user.UserId;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import lombok.NonNull;

public final class Airlock2FAUser {
   @NonNull
   private final UserId iamUserId;
   @NonNull
   private final Airlock2FAAccountId accountId;

   public static Airlock2FAUser airlock2FAUser(UserId iamUserId, Airlock2FAAccountId accountId) {
      return new Airlock2FAUser(iamUserId, accountId);
   }

   @NonNull
   @SuppressFBWarnings(justification = "generated code")
   public UserId getIamUserId() {
      return this.iamUserId;
   }

   @NonNull
   @SuppressFBWarnings(justification = "generated code")
   public Airlock2FAAccountId getAccountId() {
      return this.accountId;
   }

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

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

   @SuppressFBWarnings(justification = "generated code")
   @Override
   public String toString() {
      return "Airlock2FAUser(iamUserId=" + this.getIamUserId() + ", accountId=" + this.getAccountId() + ")";
   }

   @SuppressFBWarnings(justification = "generated code")
   private Airlock2FAUser(@NonNull UserId iamUserId, @NonNull Airlock2FAAccountId accountId) {
      if (iamUserId == null) {
         throw new NullPointerException("iamUserId is marked non-null but is null");
      }

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

      this.iamUserId = iamUserId;
      this.accountId = accountId;
   }
}
