package com.tourism.webadmin.back.model;

import com.baomidou.mybatisplus.annotation.*;
import com.tourism.webadmin.back.model.constant.Enable;
import com.tourism.webadmin.back.model.constant.BannerType;
import com.tourism.common.core.upload.UploadStoreTypeEnum;
import com.tourism.common.core.annotation.*;
import com.tourism.common.core.base.model.BaseModel;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.util.Map;

/**
 * 拼团首页banner实体对象。
 *
 * @author 吃饭睡觉
 * @date 2024-09-06
 */
@Data
@EqualsAndHashCode(callSuper = true)
@TableName(value = "tour_project_group_purchase_banner")
public class TourProjectGroupPurchaseBanner extends BaseModel {

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

    /**
     * banner名称。
     */
    @TableField(value = "banner_name")
    private String bannerName;

    /**
     * 是否启用，0否，1是。
     */
    @TableField(value = "enable")
    private Integer enable;

    /**
     * 图片URL。
     */
    @UploadFlagColumn(storeType = UploadStoreTypeEnum.HUAWEI_OBS_SYSTEM)
    @TableField(value = "img_url")
    private String imgUrl;

    /**
     * 旅游项目id。
     */
    @TableField(value = "project_id")
    private Long projectId;

    /**
     * banner排序。
     */
    @TableField(value = "show_order")
    private Integer showOrder;

    /**
     * 类型(0.PC；1.H5)。
     */
    @TableField(value = "type")
    private Integer type;

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

    @RelationOneToOne(
            masterIdField = "projectId",
            slaveModelClass = TourismProject.class,
            slaveIdField = "id")
    @TableField(exist = false)
    private TourismProject tourismProject;

    @RelationConstDict(
            masterIdField = "enable",
            constantDictClass = Enable.class)
    @TableField(exist = false)
    private Map<String, Object> enableDictMap;

    @RelationConstDict(
            masterIdField = "type",
            constantDictClass = BannerType.class)
    @TableField(exist = false)
    private Map<String, Object> typeDictMap;
}
