package cokr.xit.ens.modules.kkomydoc.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.kkomydoc.code.KkoMydocStatusCd;
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_kko_md", schema = "", catalog = "", indexes = {
        @Index(name = "idx_kkomd_api_doc_uk_id", columnList = "document_binder_uuid"),
        @Index(name = "idx_kkomd_api_doc_uk", columnList = "document_binder_uuid, prop_external_document_uuid"),
//        @Index(name = "idx_kkomd_bill_uid", columnList = "mk_bill_uid"),
})
public class SendDetailKkoMydoc extends BaseEntity {

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

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


//	@Column(name = "msg_idx", nullable = false)
//	private String msgIdx;

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

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

    
    @Column(name = "common_categories", nullable = true)
    private String commonCategories;

    
    @Column(name = "read_expiread_at", nullable = true)
    private Long readExpireadAt;

    
    @Column(name = "read_expired_sec", nullable = true)
    private Integer readExpiredSec;

//	private String receiver;

    
    @Column(name = "recv_ci", nullable = true, length = 88)
    @Setter
    private String recvCi;

    
    @Column(name = "recv_phone_number", nullable = true)
    private String recvPhoneNumber;

    
    @Column(name = "recv_name", nullable = true)
    private String recvName;

    
    @Column(name = "recv_birthday", nullable = true)
    private String recvBirthday;

    
    @Column(name = "recv_is_require_vfy_name", nullable = true)
    private Boolean recvIsRequireVfyName;

//	private String property;

    
    @Column(name = "prop_link", nullable = true)
    private String propLink;

    
    @Column(name = "prop_payload", nullable = true)
    private String propPayload;

    
    @Column(name = "prop_message", nullable = true, length = 4000)
    @Setter
    private String propMessage;

    
    @Column(name = "prop_cs_number", nullable = true)
    @Setter
    private String propCsNumber;

    
    @Column(name = "prop_cs_name", nullable = true)
    @Setter
    private String propCsName;

    
    @Column(name = "prop_external_document_uuid", nullable = true)
    @Setter
    private String propExternalDocumentUuid;

//	private String bridge;

    
    @Column(name = "bridge_content", nullable = true, length = 500)
    private String bridge;

    @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 = "document_binder_uuid", nullable = true)
    @Setter
    private String documentBinderUuid;

    @Enumerated(EnumType.STRING)
    
    @Column(name = "kko_doc_stat", nullable = false, length = 30)
    @Setter
    private KkoMydocStatusCd kkoDocStat;
    
    @Column(name = "kko_doc_sent_dt", nullable = true, length = 14)
    @Setter
    private String kkoDocSentDt;
    
    @Column(name = "kko_doc_received_dt", nullable = true, length = 14)
    @Setter
    private String kkoDocReceivedDt;
    
    @Column(name = "kko_doc_auth_frst_dt", nullable = true, length = 14)
    @Setter
    private String kkoDocAuthFrstDt;
    
    @Column(name = "kko_doc_token_vrfy_frst_dt", nullable = true, length = 14)
    @Setter
    private String kkoDocTokenVrfyFrstDt;
    
    @Column(name = "kko_doc_read_frst_dt", nullable = true, length = 14)
    @Setter
    private String kkoDocReadFrstDt;
    
    @Column(name = "kko_doc_user_notied_dt", nullable = true, length = 14)
    @Setter
    private String kkoDocUserNotiedDt;

}
