package com.bizzan.bitrade.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.hibernate.annotations.CreationTimestamp;

import javax.persistence.*;
import java.util.Date;

/**
 * 管理后台邮件发送记录
 */
@Entity
@Data
@Table(name = "email_send_record")
public class EmailSendRecord {

    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Id
    private Long id;

    /**
     * 接收用户ID
     */
    private Long memberId;

    /**
     * 接收邮箱
     */
    private String email;

    /**
     * 邮件主题
     */
    private String subject;

    /**
     * 邮件内容
     */
    @Column(columnDefinition = "text")
    private String content;

    /**
     * 发送状态：1=成功，0=失败
     */
    private Integer status = 1;

    /**
     * 失败原因
     */
    private String failReason;

    /**
     * 发送时间
     */
    @CreationTimestamp
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date sendTime;
}
