package com.airlock.iam.transactionapproval.infrastructure.transfer.response;

import com.fasterxml.jackson.annotation.JsonTypeName;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.NonNull;

@JsonTypeName("transaction-approval.cronto.push-device")
public final class TransactionApprovalCrontoPushDeviceData {
   public static final String TRANSACTION_APPROVAL_CRONTO_PUSH_DEVICE_TYPE = "transaction-approval.cronto.push-device";
   @Schema(description = "The device ID.")
   @NonNull
   private final String id;
   @Schema(description = "Label of the push device.")
   @NonNull
   private final String label;
   @Schema(description = "Indicates, whether this is the default device.")
   private final boolean defaultDevice;

   @SuppressFBWarnings(justification = "generated code")
   public TransactionApprovalCrontoPushDeviceData(@NonNull String id, @NonNull String label, boolean defaultDevice) {
      if (id == null) {
         throw new NullPointerException("id is marked non-null but is null");
      }

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

      this.id = id;
      this.label = label;
      this.defaultDevice = defaultDevice;
   }

   @NonNull
   @SuppressFBWarnings(justification = "generated code")
   public String getId() {
      return this.id;
   }

   @NonNull
   @SuppressFBWarnings(justification = "generated code")
   public String getLabel() {
      return this.label;
   }

   @SuppressFBWarnings(justification = "generated code")
   public boolean isDefaultDevice() {
      return this.defaultDevice;
   }

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

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

   @SuppressFBWarnings(justification = "generated code")
   @Override
   public String toString() {
      return "TransactionApprovalCrontoPushDeviceData(id=" + this.getId() + ", label=" + this.getLabel() + ", defaultDevice=" + this.isDefaultDevice() + ")";
   }
}
