package com.tourism.webadmin.back.model;

import com.baomidou.mybatisplus.annotation.*;
import com.tourism.webadmin.back.model.constant.*;
import com.tourism.common.core.util.MyCommonUtil;
import com.tourism.common.core.upload.UploadStoreTypeEnum;
import com.tourism.common.core.annotation.*;
import com.tourism.common.core.base.model.BaseModel;
import lombok.*;

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

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

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

    /**
     * 项目标题。
     */
    @TableField(value = "project_title")
    private String projectTitle;

    /**
     * 出发时间。
     */
    @TableField(value = "departure_time")
    private Date departureTime;

    /**
     * 总天数。
     */
    @TableField(value = "count_times")
    private String countTimes;

    /**
     * 人物关系。
     */
    @TableField(value = "role")
    private String role;

    /**
     * 推荐指数。
     */
    @TableField(value = "recommendation_rate")
    private Integer recommendationRate;

    /**
     * 人均费用。
     */
    @TableField(value = "average_cost")
    private String averageCost;

    /**
     * 审核状态(0,未审核;1,审核通过;2、审核不通过)。
     */
    @TableField(value = "state")
    private Integer state;

    /**
     * 审核不通过的原因。
     */
    @TableField(value = "reason")
    private String reason;

    /**
     * 发布游记的banner图。
     */
    @UploadFlagColumn(storeType = UploadStoreTypeEnum.HUAWEI_OBS_SYSTEM)
    @TableField(value = "travel_notes_banner")
    private String travelNotesBanner;

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

    /**
     * 游记内容中的图片。
     */
    @UploadFlagColumn(storeType = UploadStoreTypeEnum.HUAWEI_OBS_SYSTEM)
    @TableField(value = "tourism_tavel_notes_url")
    private String tourismTavelNotesUrl;

    /**
     * 上下架状态(0,下架;1,上架)。
     */
    @TableField(value = "unmount_state")
    private Integer unmountState;

    /**
     * 项目展示图片。
     */
    @UploadFlagColumn(storeType = UploadStoreTypeEnum.HUAWEI_OBS_SYSTEM)
    @TableField(value = "tourism_url")
    private String tourismUrl;

    /**
     * 项目简述。
     */
    @TableField(value = "remarks")
    private String remarks;

    /**
     * 是否热点，0非热点，1热点。
     */
    @TableField(value = "is_hotspot")
    private Integer isHotspot;

    /**
     * 标签。
     */
    @TableField(value = "note_label")
    private String noteLabel;

    /**
     * 点赞数。
     */
    @TableField(value = "like_count")
    private Integer likeCount;

    /**
     * 浏览量。
     */
    @TableField(value = "page_view_count")
    private Integer pageViewCount;

    /**
     * 热度值。
     */
    @TableField(value = "hot_value")
    private Integer hotValue;

    /**
     * 是否原创(0:非原创;1:原创)。
     */
    @TableField(value = "is_original")
    private Integer isOriginal;

    /**
     * 目的地。
     */
    @TableField(value = "end_place")
    private Long endPlace;

    /**
     * 自动审核结果1：通过，2未通过。
     */
    @TableField(value = "auto_audit_status")
    private Integer autoAuditStatus;

    /**
     * 自动审核未通过原因。
     */
    @TableField(value = "auto_reject_reason")
    private String autoRejectReason;

    /**
     * 出行方式。
     */
    @TableField(value = "travel_mode")
    private Integer travelMode;

    /**
     * departureTime 范围过滤起始值(>=)。
     */
    @TableField(exist = false)
    private String departureTimeStart;

    /**
     * departureTime 范围过滤结束值(<=)。
     */
    @TableField(exist = false)
    private String departureTimeEnd;

    /**
     * createTime 范围过滤起始值(>=)。
     */
    @TableField(exist = false)
    private String createTimeStart;

    /**
     * createTime 范围过滤结束值(<=)。
     */
    @TableField(exist = false)
    private String createTimeEnd;

    /**
     * project_title / count_times / role / average_cost / reason LIKE搜索字符串。
     */
    @TableField(exist = false)
    private String searchString;

    public void setSearchString(String searchString) {
        this.searchString = MyCommonUtil.replaceSqlWildcard(searchString);
    }

    @RelationDict(
            masterIdField = "endPlace",
            slaveModelClass = DirectoryInfo.class,
            slaveIdField = "id",
            slaveNameField = "menuName")
    @TableField(exist = false)
    private Map<String, Object> endPlaceDictMap;

    @RelationConstDict(
            masterIdField = "state",
            constantDictClass = AuditState.class)
    @TableField(exist = false)
    private Map<String, Object> stateDictMap;

    @RelationOneToMany(
            masterIdField = "id",
            slaveModelClass = TourismTravelNotesContentWrite.class,
            slaveIdField = "associationId")
    @TableField(exist = false)
    private List<TourismTravelNotesContentWrite> travelNotesContent;

    @RelationConstDict(
            masterIdField = "unmountState",
            constantDictClass = UnmountState.class)
    @TableField(exist = false)
    private Map<String, Object> unmountStateDictMap;

    @RelationConstDict(
            masterIdField = "isHotspot",
            constantDictClass = Hotspot.class)
    @TableField(exist = false)
    private Map<String, Object> isHotspotDictMap;

    @RelationConstDict(
            masterIdField = "isOriginal",
            constantDictClass = IsOriginal.class)
    @TableField(exist = false)
    private Map<String, Object> isOriginalDictMap;

    @TableField(exist = false)
    private List<Long> directoryInfoIds;

    @RelationConstDict(
            masterIdField = "autoAuditStatus",
            constantDictClass = AudioState.class)
    @TableField(exist = false)
    private Map<String, Object> autoAuditStatusDictMap;

    @RelationGlobalDict(
            masterIdField = "travelMode",
            dictCode = "TourTravelMode")
    @TableField(exist = false)
    private Map<String, Object> travelModeDictMap;

    /**
     * 游玩人数。
     */
    @TableField(value = "travel_number")
    private String travelNumber;
}
