package com.kamco.cd.kamcoback.postgres.entity;

import jakarta.persistence.Column;
import jakarta.persistence.Embeddable;
import jakarta.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.Objects;
import java.util.UUID;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.Hibernate;

@Getter
@Setter
@Embeddable
public class MemberArchivedEntityId implements Serializable {

  private static final long serialVersionUID = -7102800377481389036L;

  @NotNull
  @Column(name = "user_id", nullable = false)
  private Long userId;

  @NotNull
  @Column(name = "uuid", nullable = false)
  private UUID uuid;

  @Override
  public boolean equals(Object o) {
    if (this == o) {
      return true;
    }
    if (o == null || Hibernate.getClass(this) != Hibernate.getClass(o)) {
      return false;
    }
    MemberArchivedEntityId entity = (MemberArchivedEntityId) o;
    return Objects.equals(this.userId, entity.userId) && Objects.equals(this.uuid, entity.uuid);
  }

  @Override
  public int hashCode() {
    return Objects.hash(userId, uuid);
  }
}
