package cokr.xit.ens.modules.common.domain;

import cokr.xit.ens.modules.common.code.StatCd;
import cokr.xit.ens.modules.common.code.VenderCd;
import cokr.xit.ens.modules.common.domain.support.FieldError;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.experimental.SuperBuilder;
import org.hibernate.annotations.ColumnDefault;
import org.hibernate.annotations.CreationTimestamp;

import javax.persistence.*;
import java.time.LocalDateTime;

@Getter
@Setter
@MappedSuperclass
@SuperBuilder
@NoArgsConstructor
public abstract class SendMastBaseEntity extends BaseEntity {

    
    @Column(nullable = false, length = 30)
    @Enumerated(EnumType.STRING)
    private VenderCd vender;

    
    @Column(name = "org_cd", nullable = true, length = 20)
    private String orgCd;

    
    @Column(nullable = true)
    private String tmpltCd;

    
    @Column(nullable = true)
    private String postBundleTitle;

    
    @CreationTimestamp
    private LocalDateTime acceptDt;

    
    @Enumerated(EnumType.STRING)
    @Setter
    private StatCd statCd;

    
    @Column(name = "send_dt", nullable = false)
    private LocalDateTime sendDt;

    
    @Column(name = "send_cnt", columnDefinition = "integer")
    @ColumnDefault("0")
    private Integer sendCnt;

    
    @Column(name = "read_cnt", columnDefinition = "integer")
    @ColumnDefault("0")
    @Setter
    private Integer readCnt;

    
    @Column(name = "close_dt", nullable = false)
    private LocalDateTime closeDt;

    @Embedded
    @Setter
    private FieldError error;
}
