package com.tourism.webadmin.back.model;

import com.baomidou.mybatisplus.annotation.*;
import com.tourism.common.core.annotation.*;
import com.tourism.common.core.base.model.BaseModel;
import com.tourism.webadmin.upms.model.SysUser;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * 消息通知表实体对象。
 *
 * @author 吃饭睡觉
 * @date 2024-09-06
 */
@Data
@EqualsAndHashCode(callSuper = true)
@TableName(value = "tour_notice")
public class TourNotice extends BaseModel {

    /**
     * 主键。
     */
    @TableId(value = "id")
    private Long id;

    /**
     * 实际业务关联对象。评论/收藏操作用户ID；游记ID等。
     */
    @TableField(value = "relation_id")
    private Long relationId;

    /**
     * 消息类型：1消息回复；2收藏提醒；3游记审核。
     */
    @TableField(value = "notice_type")
    private Integer noticeType;

    /**
     * 消息内容。
     */
    @TableField(value = "notice_content")
    private String noticeContent;

    /**
     * notice_type=1有值，评论ID。
     */
    @TableField(value = "comment_id")
    private Long commentId;

    /**
     * 通知用户。
     */
    @TableField(value = "user_id")
    private Long userId;

    /**
     * 通知时间。
     */
    @TableField(value = "send_time")
    private Date sendTime;

    /**
     * 是否已读：0未读；1已读。
     */
    @TableField(value = "been_read")
    private Integer beenRead;

    /**
     * 读取时间。
     */
    @TableField(value = "read_time")
    private Date readTime;

    /**
     * 逻辑删除标记字段(1: 正常 -1: 已删除)。
     */
    @TableLogic
    @TableField(value = "data_state")
    private Integer dataState;

    @RelationDict(
            masterIdField = "userId",
            slaveModelClass = TourUser.class,
            slaveIdField = "userId",
            slaveNameField = "showName")
    @TableField(exist = false)
    private Map<String, Object> userIdDictMap;

    @RelationDict(
            masterIdField = "createUserId",
            slaveModelClass = TourUser.class,
            slaveIdField = "userId",
            slaveNameField = "showName")
    @TableField(exist = false)
    private Map<String, Object> createUserIdDictMap;

    @RelationDict(
            masterIdField = "createUserId",
            slaveModelClass = TourUser.class,
            slaveIdField = "userId",
            slaveNameField = "headImageUrl")
    @TableField(exist = false)
    private Map<String, Object> createUserIdHeadImageUrlDictMap;

    @RelationDict(
            masterIdField = "updateUserId",
            slaveModelClass = TourUser.class,
            slaveIdField = "userId",
            slaveNameField = "showName")
    @TableField(exist = false)
    private Map<String, Object> updateUserIdDictMap;

    @RelationGlobalDict(
            masterIdField = "noticeType",
            dictCode = "NoticeType")
    @TableField(exist = false)
    private Map<String, Object> noticeTypeDictMap;

    @RelationGlobalDict(
            masterIdField = "beenRead",
            dictCode = "BeenReed")
    @TableField(exist = false)
    private Map<String, Object> beenReadDictMap;

    /**
     * 方便/noticeList接口进行查询。
     */
    @TableField(exist = false)
    private List<Integer> noticeTypeList;
}
