package cokr.xit.ens.modules.kkoalimtalk.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.kkoalimtalk.code.AlimTalkSendTypeCd;
import cokr.xit.ens.modules.kkoalimtalk.code.AlimtalkResultCd;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import lombok.experimental.SuperBuilder;
import org.hibernate.annotations.ColumnDefault;

import javax.persistence.*;

@Entity
@Getter
@ToString
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
@Table(name = "ens_snd_dtl_kko_at", schema = "", catalog = "", indexes = {
        @Index(name = "idx_kkoat_api_doc_uk", columnList = "msg_idx"),
//        @Index(name = "idx_kkoat_bill_uid", columnList = "mk_bill_uid"),
})
public class SendDetailKkoAlimtalk extends BaseEntity {
    @Id
//	@GeneratedValue(strategy=GenerationType.AUTO)
    @GeneratedValue(strategy = GenerationType.TABLE, generator = "SendDetailKkoAlimtalk_Generator")
    @TableGenerator(table = "ens_seq_generator", name = "SendDetailKkoAlimtalk_Generator"
            , pkColumnName = "seq_name", pkColumnValue = "SendDetailKkoAlimtalk_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 = true)
    private String msgIdx;

    
    @Column(name = "country_code", nullable = false)
    @ColumnDefault("'82'")
    private String countryCode;

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

    
    @Column(name = "sender_key", nullable = true)
    private String senderKey;

    
    @Column(name = "app_user_id", nullable = true)
    private String appUserId;

    
    @Column(name = "org_code", nullable = true)
    private String orgCode;

    
    @Column(name = "message", nullable = true)
    @ColumnDefault("'Waiting for Make Stage'")
    @Lob
    @Setter
    private String message;

    
    @Column(name = "tmplt_code", nullable = false)
    private String tmpltCode;

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

    
    @Column(name = "res_method", nullable = false)
    @ColumnDefault("'PUSH'")
    private String resMethod;


//    @Column(name = "price", nullable = true)
//    private int price;
//

//    @Column(name = "currency_type", nullable = true, length = 3)
//    private String currencyType;

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

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

    
    @Column(name = "message_type", nullable = true)
    private String messageType;

    
    @Column(name = "use_failback", nullable = true)
    private String useFailback;

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


    
    @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 = "req_msg_idx", nullable = true)
    @Setter
    private String reqMsgIdx;
    
    @Column(name = "mk_tmplt_msg_json_data", nullable = true, length = 3000)
    private String mkTmpltMsgJsonData;
    
    @Column(name = "mk_name", nullable = true)
    private String mkName;
    
    @Column(name = "mk_birthday", nullable = true)
    private String mkBirthday;
    
    @Column(name = "mk_sid", nullable = true)
    private String mkSid;
    
    @Column(name = "mk_gender", nullable = true)
    private String mkGender;
    
    @Column(name = "mk_mbl_json_data", nullable = true)
    @Lob
    private String mkMblJsonData;
    
    @Column(name = "mk_pay_bill_json_data", nullable = true)
    @Lob
    private String mkPayBillJsonData;


    
    @Column(name = "kko_doc_sent_dt", nullable = true, length = 14)
    @Setter
    private String kkoDocSentDt;
    
    @Column(name = "kko_send_type", nullable = true)
    @Setter
    @Enumerated(EnumType.STRING)
    private AlimTalkSendTypeCd kkoSendType;
    
    @Column(name = "kko_result_cd", nullable = false)
    @Setter
    @Enumerated(EnumType.STRING)
    private AlimtalkResultCd kkoResultCd;
    
    @Column(name = "kko_request_dt", nullable = true)
    @Setter
    private String kkoRequestDt;
    
    @Column(name = "kko_received_dt", nullable = true)
    @Setter
    private String kkoReceivedDt;


    @Embedded
    @Setter
    private FieldError error;
}
