package com.tourism.webadmin.back.model;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import com.tourism.common.core.annotation.RelationDict;
import com.tourism.common.core.annotation.RelationOneToMany;
import com.tourism.common.core.base.model.BaseModel;
import lombok.Data;
import lombok.EqualsAndHashCode;

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

/**
 * 游记评论实体对象。
 *
 * @author 吃饭睡觉
 * @date 2024-09-06
 */
@Data
@EqualsAndHashCode(callSuper = true)
@TableName(value = "tour_travel_notes_comment")
public class TourTravelNotesComment extends BaseModel {

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

    /**
     * 评论内容。
     */
    @TableField(value = "comment_content")
    private String commentContent;

    /**
     * 上级评论ID，一级为空。
     */
    @TableField(value = "parent_id")
    private String parentId;

    /**
     * 游记ID。
     */
    @TableField(value = "travel_note_id")
    private Long travelNoteId;

    /**
     * 回复的评论ID。
     */
    @TableField(value = "reply_comment_id")
    private String replyCommentId;

    /**
     * 评论的用户ID
     */
    @TableField(value = "comment_user_id")
    private Long commentUserId;

    /**
     * 回复的评论用户ID。
     */
    @TableField(value = "reply_user_id")
    private Long replyUserId;

    /**
     * 点赞量。
     */
    @TableField(value = "like_num")
    private Integer likeNum;

    /**
     * 头像
     */
//    @TableField(value = "head_image_url")
//    private String headImageUrl;

    /**
     * 评论楼层。
     */
    @TableField(value = "floor")
    private String floor;

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

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

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

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

//    @RelationOneToMany(
//            masterIdField = "id",
//            slaveModelClass = TourismProjectTravelNotesWrite.class,
//            slaveIdField = "travelNoteId")
//    @TableField(exist = false)
//    private List<TourismTravelNotesContentWrite> travelNoteDictMap;

    @RelationDict(
            masterIdField = "travelNoteId",
            slaveModelClass = TourismProjectTravelNotesWrite.class,
            slaveIdField = "id",
            slaveNameField = "tourismUrl")
    @TableField(exist = false)
    private Map<String, Object> travelNoteDictMap;

    /**
     * 游记图片。
     */
    @TableField(exist = false)
    private String travelNoteUrl;
}
