package com.kospo.talk.model;

import jakarta.persistence.Column;
import jakarta.persistence.Embeddable;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import lombok.*;

import java.io.Serializable;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.Date;
import java.util.Objects;

@Getter
@Setter
@Builder
@AllArgsConstructor
@NoArgsConstructor
@Embeddable
public class TalkReadId implements Serializable {
    private static final long serialVersionUID = -4604723107983277747L;
    @Size(max = 10)
    @NotNull
    @Column(name = "sabun", nullable = false, length = 10)
    private String sabun;

    @Size(max = 100)
    @NotNull
    @Column(name = "talk_id", nullable = false, length = 100)
    private String talkId;

    @NotNull
    @Column(name = "ins_date", nullable = false)
    private LocalDateTime insDate;

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof TalkReadId that)) return false;
        return Objects.equals(sabun, that.sabun) && Objects.equals(talkId, that.talkId) && Objects.equals(insDate, that.insDate);
    }

    @Override
    public int hashCode() {
        return Objects.hash(sabun, talkId, insDate);
    }

    @Override
    public String toString() {
        return "ChatReadId{" +
                "sabun='" + sabun + '\'' +
                ", talkId='" + talkId + '\'' +
                ", insDate=" + insDate +
                '}';
    }
}