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

import cokr.xit.ens.modules.common.ctgy.intgrnbill.support.entity.Bill;
import cokr.xit.ens.modules.common.domain.BaseEntity;
import cokr.xit.ens.modules.common.domain.SendMast;
import cokr.xit.ens.modules.common.domain.support.FieldError;
import cokr.xit.ens.modules.nvsigntalk.code.NvSigntalkStatusCd;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import lombok.experimental.SuperBuilder;

import javax.persistence.*;

@Entity
@Getter
@ToString
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
@Table(name = "ens_snd_dtl_nv_st", schema = "", catalog = "", indexes = {
        @Index(name = "idx_nvst_api_doc_uk_id", columnList = "doc_id"),
        @Index(name = "idx_nvst_api_doc_uk", columnList = "doc_id, client_doc_id"),
//        @Index(name = "idx_nvst_bill_uid", columnList = "mk_bill_uid"),
})
public class SendDetailNvSigntalk extends BaseEntity {

    @Id
//	@GeneratedValue(strategy=GenerationType.AUTO)
    @GeneratedValue(strategy = GenerationType.TABLE, generator = "SendDetailNvSigntalk_Generator")
    @TableGenerator(table = "ens_seq_generator", name = "SendDetailNvSigntalk_Generator"
            , pkColumnName = "seq_name", pkColumnValue = "SendDetailNvSigntalk_id"
            , initialValue = 0, allocationSize = 200)
    private Long sendDetailId;              

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "send_mast_id")
    private SendMast sendMast;              


    
    @Column(name = "client_doc_id", nullable = false, length = 100)
    @Setter
    private String clientDocId;

    
    @Column(name = "ci", nullable = true, length = 100)
    @Setter
    private String ci;

    
    @Column(name = "title", nullable = true, length = 40)
    @Setter
    private String title;

    
    @Column(name = "message", nullable = true, length = 1000)
    @Setter
    private String message;

    
    @Column(name = "valid_duration", nullable = true, length = 8)
    private Long validDuration;

    
    @Column(name = "valid_duration_at", nullable = true)
    private Long validDurationAt;

    
    @Column(name = "redirect_url", nullable = true, length = 1000)
    private String redirectUrl;

    
    @Column(name = "publish_document_yn", nullable = true, length = 1)
    private String publishDocumentYn;

    
    @Column(name = "document_hash", nullable = true, length = 99)
    @Setter
    private String documentHash;

    
    @Column(name = "call_center_no", nullable = true, length = 20)
    @Setter
    private String callCenterNo;

    
    @Column(name = "org_id", nullable = true, length = 50)
    private String orgId;

    
    @Column(name = "auth_require_yn", nullable = true, length = 1)
    private String authRequireYn;

    
    @Column(name = "notification", nullable = true, length = 3000)
    private String notification;

    
    @Column(name = "calculation_key", nullable = true, length = 10)
    private String calculationKey;
    
    @Column(name = "category_key", nullable = true, length = 10)
    private String categoryKey;
    
    @Column(name = "document_key", nullable = true, length = 10)
    private String documentKey;

    @Embedded
    @Setter
    private FieldError error;


    
    @Column(name = "mk_bill_use_yn", nullable = true, length = 1)
    private String mkBillUseYn;
   
//    @Column(name = "mk_bill_uid", nullable = true, length = 45)
//    private String mkBillUid;
    
    @JoinColumn(name = "bill_uid", referencedColumnName = "bill_uid")
    @OneToOne(fetch = FetchType.LAZY)
    private Bill bill;
    
    @Column(name = "mk_jid", nullable = true, length = 24)
    private String mkJid;
    
    @Column(name = "mk_tmplt_msg_json_data", nullable = true, length = 4000)
    private String mkTmpltMsgJsonData;


    
    @Column(name = "doc_id", nullable = true)
    @Setter
    private String docId;

    @Enumerated(EnumType.STRING)
    
    @Column(name = "nv_doc_stat", nullable = false, length = 30)
    @Setter
    private NvSigntalkStatusCd nvDocStat;
    
    @Column(name = "nv_doc_sent_dt", nullable = true, length = 14)
    @Setter
    private String nvDocSentDt;
    
    @Column(name = "nv_doc_received_dt", nullable = true, length = 14)
    @Setter
    private String nvDocReceivedDt;
    
    @Column(name = "nv_doc_auth_frst_dt", nullable = true, length = 14)
    @Setter
    private String nvDocAuthFrstDt;
    
    @Column(name = "nv_doc_token_vrfy_frst_dt", nullable = true, length = 14)
    @Setter
    private String nvDocTokenVrfyFrstDt;
    
    @Column(name = "nv_doc_read_frst_dt", nullable = true, length = 14)
    @Setter
    private String nvDocReadFrstDt;

//	@Column(name = "nv_doc_user_notied_dt", nullable = true, length = 14)
//	@Setter
//	private String nvDocUserNotiedDt;

}
