package com.spring.domain.email.entity;

import java.io.Serializable;
import java.time.LocalDate;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.IdClass;
import javax.persistence.Lob;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

import lombok.EqualsAndHashCode;
import lombok.Getter;

@Getter
@SequenceGenerator(
    name = "COM_MAILQUE_MST_SEQ",
    sequenceName = "COM_MAILQUE_MST_SEQ",
    initialValue = 1,
    allocationSize = 1
)
@Entity
@Table(name = "COM_MAILQUE_MST")
@IdClass(com.spring.domain.email.entity.ComMailqueMst.ComMailqueMstId.class)
public class ComMailqueMst {
    
    @Id
    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "COM_MAILQUE_MST_SEQ")
    @Column(name = "MID", nullable = false)
    private Long mid;

    @Id
    @Column(name = "SUBID", nullable = false)
    private Long subid;

    @Column(name = "TID", nullable = false, length = 10)
    private String tid;

    @Column(name = "MAILTYPENAME", length = 25)
    private String mailtypename;

    @Column(name = "SNAME", nullable = false, length = 50)
    private String sname;

    @Column(name = "SMAIL", nullable = false, length = 100)
    private String smail;

    @Column(name = "SID", length = 50)
    private String sid;

    @Column(name = "RPOS", nullable = false, length = 1)
    private Character rpos;

    @Column(name = "QUERY", length = 2000)
    private String query;

    @Column(name = "CTNOPS", length = 1)
    private String ctnops;

    @Column(name = "SUBJECT", length = 100)
    private String subject;

    @Lob
    @Column(name = "CONTENTS")
    private String contents;

    @Column(name = "CDATE")
    private LocalDate cdate;

    @Column(name = "SDATE")
    private LocalDate sdate;

    @Column(name = "STATUS", length = 1)
    private String status;

    @Column(name = "DBCODE", length = 10)
    private String dbcode;

    @Column(name = "CHARSET")
    private Integer charset;

    @Column(name = "ISSECURE", length = 1)
    private String issecure;

    @Column(name = "SECURETEMPLATE", length = 50)
    private String securetemplate;

    @Column(name = "ATTACHFILE01", length = 255)
    private String attachfile01;

    @Column(name = "ATTACHFILE02", length = 255)
    private String attachfile02;

    @Column(name = "ATTACHFILE03", length = 255)
    private String attachfile03;

    @Column(name = "ATTACHFILE04", length = 255)
    private String attachfile04;

    @Column(name = "ATTACHFILE05", length = 255)
    private String attachfile05;

    @Getter
    @EqualsAndHashCode
    public static class ComMailqueMstId implements Serializable {
        private Long mid;
        private Long subid;
    }

}
