package com.aegis.notification.domain;

import java.util.Date;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.aegis.common.core.domain.BaseEntity;
import com.fasterxml.jackson.annotation.JsonFormat;

/**
 * 通知消息实体类 sys_notification
 * 
 * @author aegis
 */
public class Notification extends BaseEntity {
    
    private static final long serialVersionUID = 1L;

    /** 通知ID */
    private Long id;

    /** 通知标题 */
    private String title;

    /** 通知内容 */
    private String content;

    /** 模板ID（可选） */
    private Long templateId;

    /** 通知渠道：station-站内消息，sms-短信，email-邮件，push-推送 */
    private String channel;

    /** 接收者用户ID */
    private Long receiverId;

    /** 接收者姓名（冗余字段） */
    private String receiverName;

    /** 发送者用户ID（系统通知为NULL） */
    private Long senderId;

    /** 发送者姓名（冗余字段） */
    private String senderName;

    /** 业务类型：plan_publish-预案发布，plan_approve-预案审批，inventory_alert-库存报警等 */
    private String businessType;

    /** 业务ID（如预案ID、事件ID等） */
    private Long businessId;

    /** 通知状态：pending-待发送，sent-已发送，read-已读，failed-发送失败 */
    private String status;

    /** 已读时间 */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date readTime;

    /** 发送时间 */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date sendTime;

    /** 过期时间（可选） */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date expireTime;

    /** 优先级：low-低，normal-普通，high-高，urgent-紧急 */
    private String priority;

    /** 扩展数据（JSON格式） */
    private String extraData;

    /** 删除标志（0代表存在 2代表删除） */
    private String delFlag;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    @NotBlank(message = "通知标题不能为空")
    @Size(min = 0, max = 200, message = "通知标题长度不能超过200个字符")
    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public Long getTemplateId() {
        return templateId;
    }

    public void setTemplateId(Long templateId) {
        this.templateId = templateId;
    }

    public String getChannel() {
        return channel;
    }

    public void setChannel(String channel) {
        this.channel = channel;
    }

    @NotNull(message = "接收者用户ID不能为空")
    public Long getReceiverId() {
        return receiverId;
    }

    public void setReceiverId(Long receiverId) {
        this.receiverId = receiverId;
    }

    public String getReceiverName() {
        return receiverName;
    }

    public void setReceiverName(String receiverName) {
        this.receiverName = receiverName;
    }

    public Long getSenderId() {
        return senderId;
    }

    public void setSenderId(Long senderId) {
        this.senderId = senderId;
    }

    public String getSenderName() {
        return senderName;
    }

    public void setSenderName(String senderName) {
        this.senderName = senderName;
    }

    public String getBusinessType() {
        return businessType;
    }

    public void setBusinessType(String businessType) {
        this.businessType = businessType;
    }

    public Long getBusinessId() {
        return businessId;
    }

    public void setBusinessId(Long businessId) {
        this.businessId = businessId;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public Date getReadTime() {
        return readTime;
    }

    public void setReadTime(Date readTime) {
        this.readTime = readTime;
    }

    public Date getSendTime() {
        return sendTime;
    }

    public void setSendTime(Date sendTime) {
        this.sendTime = sendTime;
    }

    public Date getExpireTime() {
        return expireTime;
    }

    public void setExpireTime(Date expireTime) {
        this.expireTime = expireTime;
    }

    public String getPriority() {
        return priority;
    }

    public void setPriority(String priority) {
        this.priority = priority;
    }

    public String getExtraData() {
        return extraData;
    }

    public void setExtraData(String extraData) {
        this.extraData = extraData;
    }

    public String getDelFlag() {
        return delFlag;
    }

    public void setDelFlag(String delFlag) {
        this.delFlag = delFlag;
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
            .append("id", getId())
            .append("title", getTitle())
            .append("content", getContent())
            .append("templateId", getTemplateId())
            .append("channel", getChannel())
            .append("receiverId", getReceiverId())
            .append("receiverName", getReceiverName())
            .append("senderId", getSenderId())
            .append("senderName", getSenderName())
            .append("businessType", getBusinessType())
            .append("businessId", getBusinessId())
            .append("status", getStatus())
            .append("readTime", getReadTime())
            .append("sendTime", getSendTime())
            .append("expireTime", getExpireTime())
            .append("priority", getPriority())
            .append("extraData", getExtraData())
            .append("delFlag", getDelFlag())
            .append("createBy", getCreateBy())
            .append("createTime", getCreateTime())
            .append("updateBy", getUpdateBy())
            .append("updateTime", getUpdateTime())
            .append("remark", getRemark())
            .toString();
    }
}