package com.spring.domain.email.entity;

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

import javax.persistence.Column;
import javax.persistence.Embeddable;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.Table;

import lombok.Builder;
import lombok.EqualsAndHashCode;
import lombok.Getter;

@Getter
@Entity
@Table(name = "COM_MAILRST_LOG")
public class ComMailrstLog {

    @EmbeddedId
    private ComMailrstLogId id;

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

    @Column(name = "RNAME", length = 50)
    private String rname;

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

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

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

    @Column(name = "RCODE", nullable = false, length = 2)
    private Character rcode;

    @Column(name = "RMSG", length = 100)
    private String rmsg;

    @Column(name = "STIME", nullable = false)
    private LocalDate stime;

    @Column(name = "LASTFLG", length = 2)
    private Character lastflg;

    @Column(name = "RSTIME")
    private LocalDate rstime;

    @Column(name = "RSCODE", length = 2)
    private Character rscode;

    @Column(name = "RSMSG", length = 100)
    private String rsmsg;

    @Column(name = "RSDETMSG", length = 2000)
    private String rsdetmsg;
    
    @Embeddable
    @EqualsAndHashCode
    @Getter
    @Builder
    public static class ComMailrstLogId implements Serializable {
        @Column(name = "MID", nullable = false)
        private Long mid;

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

        @Column(name = "RMAIL", nullable = false, length = 100)
        private String rmail;
    }

}
