package com.zd.system.api.laboratory.domain;

import com.zd.common.core.enums.UserMessageType;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.zd.common.core.annotation.Excel;
import com.zd.common.core.web.domain.BaseEntity;

import java.beans.Transient;

/**
 * 用户消息对象 lab_message_user
 *
 * @author zhoupan
 * @date 2021-09-02
 */
public class LabMessageUser extends BaseEntity {
    private static final long serialVersionUID = 1L;

    /**
     * 自增主键
     */
    private Long id;

    /**
     * 用户id
     */
    @Excel(name = "用户id")
    private Long joinUserId;

    /**
     * 消息id
     */
    @Excel(name = "消息id")
    @Deprecated
    private Long messageId;
    @Excel(name = "消息内容")
    private String content;

    /**
     * 部门id
     */
    @Excel(name = "部门id")
    private Long deptId;

    /**
     * 是否已读（0 未读，1 已读）
     */
    @Excel(name = "是否已读", readConverterExp = "0=,未=读，1,已=读")
    private Boolean isRead;

    /**
     * 部门名称
     */
    @Excel(name = "部门名称")
    private String deptName;

    /**
     * 创建人（用于数据权限）
     */
    @Excel(name = "创建人", readConverterExp = "用=于数据权限")
    private Long userId;

    /**
     * 用户消息类型
     */
    private UserMessageType messageType;

    /**
     * 消息内容
     */
    private String meaasgeContext;

    public Boolean getRead() {
        return isRead;
    }

    public void setRead(Boolean read) {
        isRead = read;
    }

    public UserMessageType getMessageType() {
        return messageType;
    }

    public void setMessageType(UserMessageType messageType) {
        this.messageType = messageType;
    }

    public String getMeaasgeContext() {
        return meaasgeContext;
    }

    public void setMeaasgeContext(String meaasgeContext) {
        this.meaasgeContext = meaasgeContext;
    }

    public LabMessageUser() {

    }

//    /**
//     * 消息详细内容
//     */
//    private LabMessageContent messageContent;

    public LabMessageUser(LabMessageContent labMessageContent, Long id) {

        this.setMessageId(labMessageContent.getId());
        this.setJoinUserId(id);
        this.setIsRead(Boolean.FALSE);
        this.setMessageType(UserMessageType.ADMIN);
        this.setMeaasgeContext(labMessageContent.getContent());
        this.setUserId(labMessageContent.getUserId());
        this.setCreateBy(labMessageContent.getCreateBy());
        this.setCreateTime(labMessageContent.getCreateTime());
        this.setDeptId(labMessageContent.getDeptId());
        this.setDeptName(labMessageContent.getDeptName());
    }

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

    public Long getId() {
        return id;
    }

    public void setJoinUserId(Long joinUserId) {
        this.joinUserId = joinUserId;
    }

    public Long getJoinUserId() {
        return joinUserId;
    }

    public void setMessageId(Long messageId) {
        this.messageId = messageId;
    }

    public Long getMessageId() {
        return messageId;
    }

    public void setDeptId(Long deptId) {
        this.deptId = deptId;
    }

    public Long getDeptId() {
        return deptId;
    }

    public void setIsRead(Boolean isRead) {
        this.isRead = isRead;
    }

    public Boolean getIsRead() {
        return isRead;
    }

    public void setDeptName(String deptName) {
        this.deptName = deptName;
    }

    public String getDeptName() {
        return deptName;
    }

    public void setUserId(Long userId) {
        this.userId = userId;
    }

    public Long getUserId() {
        return userId;
    }

//    public LabMessageContent getMessageContent() {
//        return messageContent;
//    }
//
//    public void setMessageContent(LabMessageContent messageContent) {
//        this.messageContent = messageContent;
//    }

    @Override
    public String toString() {
        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
                .append("id", getId())
                .append("joinUserId", getJoinUserId())
                .append("messageId", getMessageId())
                .append("createTime", getCreateTime())
                .append("deptId", getDeptId())
                .append("isRead", getIsRead())
                .append("deptName", getDeptName())
                .append("userId", getUserId())
                .append("createBy", getCreateBy())
                .append("updateTime", getUpdateTime())
                .append("updateBy", getUpdateBy())
                .append("remark", getRemark())
                .toString();
    }
}
