package cokr.xit.ens.modules.ktsigntalk.direct.domain;

import cokr.xit.ens.modules.common.ctgy.intgrnbill.support.entity.Bill;
import cokr.xit.ens.modules.common.domain.SendMast;
import cokr.xit.ens.modules.common.domain.support.FieldError;
import cokr.xit.ens.modules.ktsigntalk.direct.code.KtSigntalkStatusCd;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;

import javax.persistence.*;

@Entity
@Getter
@ToString
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Table(name = "ens_snd_dtl_kt_st", schema = "", catalog = "", indexes = {
        @Index(name = "idx_ktst_api_doc_uk_id", columnList = "src_key"),
})
@Schema(name = "SendDetailKtSigntalk")
public class SendDetailKtSigntalk {

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

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

    @Schema(required = true, title = "고지서 고유식별자(외부)", example = " ")
    @Column(name = "client_src_key", nullable = false, length = 50)
    @Setter
    private String clientSrcKey;

//    @Schema(required = false, title = "제목", example = " ")
//    @Column(name = "title", nullable = true, length = 40)
//    @Setter
//    private String title;

    @Schema(required = false, title = "문서 원문 hash값", example = " ")
    @Column(name = "hash", nullable = true, length = 64)
    @Setter
    private String hash;

    @Schema(required = false, title = "관리키(고지서 고유식별자) 순번", example = " ")
    @Column(name = "src_seq", nullable = true, length = 8)
    private String srcSeq;

    @Schema(required = false, title = "생년월일", example = "861128")
    @Column(name = "d_birth", nullable = true, length = 6)
    private String dBirth;

    @Schema(required = false, title = "성별구분", example = "1")
    @Column(name = "jumin_first_no", nullable = true, length = 1)
    private String juminFirstNo;

    @Schema(required = false, title = "성명", example = " ")
    @Column(name = "cn_person", nullable = true, length = 50)
    private String cnPerson;

    @Schema(required = false, title = "우편번호", example = " ")
    @Column(name = "c_zip", nullable = true, length = 6)
    private String cZip;

    @Schema(required = false, title = "주소", example = " ")
    @Column(name = "addr", nullable = true, length = 200)
    private String addr;

    @Schema(required = false, title = "고객휴대폰번호(수신전화번호)", example = " ")
    @Column(name = "rcv_tel_no", nullable = true, length = 20)
    private String rcvTelNo;

    @Schema(required = false, title = "발신번호(서비스기관)(발송전화번호)", example = " ")
    @Column(name = "snd_tel_no", nullable = true, length = 20)
    @Setter
    private String sndTelNo;

    @Schema(required = false, title = "MMS수신비밀번호 사용여부", example = "N")
    @Column(name = "rcv_pwd_use_yn", nullable = true, length = 1)
    private String rcvPwdUseYn;

    @Schema(required = false, title = "아이핀CI값", example = " ")
    @Column(name = "ci", nullable = true, length = 128)
    @Setter
    private String ci;

    @Schema(required = false, title = "MMS상세내용", example = " ")
    @Column(name = "mms_dtl_cnts", nullable = true, length = 4000)
    @Setter
    private String mmsDtlCnts;

    @Schema(required = false, title = "MMS제목", example = " ")
    @Column(name = "mms_title", nullable = true, length = 100)
    @Setter
    private String mmsTitle;

    @Schema(required = false, title = "기관발송번호", example = " ")
    @Column(name = "send_tel", nullable = true, length = 20)
    @Setter
    private String sendTel;

    @Schema(required = false, title = "연결URL", example = " ")
    @Column(name = "url", nullable = true, length = 50)
    private String url;

    @Schema(required = false, title = "처리마감시간", example = " ")
    @Column(name = "ex_time", nullable = true, length = 14)
    private String exTime;


//    @Column(name = "doc_hash", nullable = true, length = 64)
//    private String docHash;

    @Schema(required = false, title = "문서종류(sms, lms, mms)", example = "mms")
    @Column(name = "m_type", nullable = true, length = 3)
    private String mType;

    @Schema(required = false, title = "수신자유형구분", example = " ")
    @Column(name = "rcv_type", nullable = true, length = 1)
    private String rcvType;

    @Embedded
    @Setter
    private FieldError error;


    @Schema(required = false, title = "고지서 고유식별자(내부)", example = " ")
    @Column(name = "src_key", nullable = true, length = 50)
    @Setter
    private String srcKey;

    @Schema(required = false, title = "청구서사용여부", example = " ")
    @Column(name = "mk_bill_use_yn", nullable = true, length = 1)
    private String mkBillUseYn;

//    @JoinColumn(name = "bill_mast_id")
//    @OneToOne(fetch = FetchType.LAZY)
//    private KkoBillMast kkoBillMast;
    @Schema(required = false, title = "청구서정보", example = " ")
    @JoinColumn(name = "bill_uid", referencedColumnName = "bill_uid")
    @OneToOne(fetch = FetchType.LAZY)
    private Bill bill;
    @Schema(required = false, title = "주민번호", example = " ")
    @Column(name = "mk_jid", nullable = true, length = 24)
    private String mkJid;
    @Schema(required = false, title = "템플릿 메시지 데이터", example = " ")
    @Column(name = "mk_tmplt_msg_json_data", nullable = true, length = 4000)
    private String mkTmpltMsgJsonData;


    @Enumerated(EnumType.STRING)
    @Schema(required = true, title = "진행 상태", example = " ")
    @Column(name = "doc_stat", nullable = false, length = 30)
    @Setter
    private KtSigntalkStatusCd docStat;
    @Schema(required = false, title = "송신 시간(yyyyMMddHHmmss)", example = " ")
    @Column(name = "doc_sent_dt", nullable = true, length = 14)
    @Setter
    private String docSentDt;
    @Schema(required = false, title = "수신 시간(yyyyMMddHHmmss)", example = " ")
    @Column(name = "doc_received_dt", nullable = true, length = 14)
    @Setter
    private String docReceivedDt;
    @Schema(required = false, title = "열람 인증을 성공한 최초 시간(yyyyMMddHHmmss)", example = " ")
    @Column(name = "doc_auth_frst_dt", nullable = true, length = 14)
    @Setter
    private String docAuthFrstDt;
    @Schema(required = false, title = "OTT 검증을 성공한 최초 시간(yyyyMMddHHmmss)", example = " ")
    @Column(name = "doc_token_vrfy_frst_dt", nullable = true, length = 14)
    @Setter
    private String docTokenVrfyFrstDt;
    @Schema(required = false, title = "최초 열람 시간(yyyyMMddHHmmss)", example = " ")
    @Column(name = "doc_read_frst_dt", nullable = true, length = 14)
    @Setter
    private String docReadFrstDt;
//    @Schema(required = false, title = "알림톡 수신 시간(yyyyMMddHHmmss)", example = " ")
//    @Column(name = "doc_user_notied_dt", nullable = true, length = 14)
//    @Setter
//    private String ktDocUserNotiedDt;

}
