package com.kospo.talk.model;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import jakarta.persistence.*;
import jakarta.validation.constraints.Size;
import lombok.*;

import java.util.Date;
import java.util.List;

@Getter
@Setter
@Entity
@Builder
@JsonIgnoreProperties(ignoreUnknown = true)
@NoArgsConstructor
@AllArgsConstructor
@Table(name = "work")
public class Work {
    @Id
    @Size(max = 20)
    @Column(name = "work_id", nullable = false, length = 20)
    private String workId;

    @Size(max = 50)
    @Column(name = "work_nm", length = 50)
    private String workNm;


    @Size(max = 20)
    @Column(name = "p_work_id", length = 20)
    private String pWorkId;

    @Column(name = "use_yn")
    private boolean useYn;

    @Column(name = "gubun", length = 1)
    private char gubun;

    @JsonIgnoreProperties
    @OneToMany(fetch = FetchType.LAZY)
    @JoinColumn(name="work_id", nullable = false, insertable = false, updatable = false)
    private List<SmUser> smUsers;

    @JsonIgnoreProperties
    @OneToMany(fetch = FetchType.LAZY)
    @JoinColumn(name="work_id", nullable = false, insertable = false, updatable = false)
    private List<PiUser> piUsers;

    @OneToOne(fetch = FetchType.LAZY)
    @JoinColumn(name="work_id", nullable = false, insertable = false, updatable = false)
    private WorkLogo workLogo;

    @OneToOne(fetch = FetchType.LAZY)
    @JoinColumn(name="work_id", nullable = false, insertable = false, updatable = false)
    private WorkS workS;

}