package com.kospo.talk.model;

import jakarta.persistence.*;
import jakarta.validation.constraints.Size;
import lombok.*;
import org.hibernate.annotations.ColumnDefault;
import org.hibernate.annotations.Fetch;

import java.time.LocalDateTime;
import java.util.Date;
import java.util.List;

@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
@Builder
@Entity
@Table(name = "talk")
public class Talk {
    @Id
    @Size(max = 10)
    @Column(name = "talk_id", nullable = false, length = 100)
    private String talkId;

    @Size(max = 10)
    @Column(name = "ins_sabun", length = 10)
    private String insSabun;

    @Size(max = 20)
    @Column(name = "work_id", length = 20)
    private String workId;

    @ColumnDefault("CURRENT_TIMESTAMP")
    @Column(name = "ins_date")
    private LocalDateTime insDate;

    @Size(max = 20)
    @Column(name = "ins_name", length = 20)
    private String insName;

    @Size(max = 10)
    @Column(name = "upd_sabun", length = 10)
    private String updSabun;


    @Column(name = "close_yn")
    private Boolean closeYn;

    @Column(name = "start_yn")
    private Boolean startYn;

    @Column(name = "rating_yn")
    private Boolean ratingYn;

    @Column(name = "comp_yn")
    private Boolean compYn;

    @Column(name = "last_message")
    private String lastMessage;

    @Column(name = "last_message_date")
    private LocalDateTime lastMessageDate;

    @Column(name = "req_id")
    private String reqId;

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name="work_id", nullable = false, insertable = false, updatable = false)
    private Work work;

}