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 com.tourism.webadmin.upms.model.SysDept;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

/**
 * 餐馆信息实体对象。
 *
 * @author 吃饭睡觉
 * @date 2024-09-06
 */
@Data
@EqualsAndHashCode(callSuper = true)
@TableName(value = "tour_restaurant_info")
public class RestaurantInfo extends BaseModel {

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

    /**
     * 店铺名称。
     */
    @TableField(value = "name")
    private String name;

    /**
     * 店铺标签。
     */
    @TableField(value = "tag")
    private String tag;

    /**
     * 店铺类型。
     */
    @TableField(value = "type_id")
    private String typeId;

    /**
     * 店铺公告。
     */
    @TableField(value = "announcement")
    private String announcement;

    /**
     * 工作时间段(例:8:00-19:00)。
     */
    @TableField(value = "work_time")
    private String workTime;

    /**
     * 店铺地址。
     */
    @TableField(value = "address")
    private String address;

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

    /**
     * 店铺图片。
     */
    @UploadFlagColumn(storeType = UploadStoreTypeEnum.HUAWEI_OBS_SYSTEM)
    @TableField(value = "url")
    private String url;

    /**
     * 店铺环境图片。
     */
    @UploadFlagColumn(storeType = UploadStoreTypeEnum.HUAWEI_OBS_SYSTEM)
    @TableField(value = "environment_image")
    private String environmentImage;

    /**
     * 联系方式。
     */
    @TableField(value = "contact_information")
    private String contactInformation;

    /**
     * 经度。
     */
    @TableField(value = "longitude")
    private BigDecimal longitude;

    /**
     * 纬度。
     */
    @TableField(value = "latitude")
    private BigDecimal latitude;

    /**
     * 销量。
     */
    @TableField(value = "total_sales")
    private Long totalSales;

    /**
     * 所处国家。
     */
    @TableField(value = "contry")
    private String contry;

    /**
     * 所处城市。
     */
    @TableField(value = "city")
    private String city;

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

    /**
     * 用户所在部门Id。
     */
    @TableField(value = "dept_id")
    @DeptFilterColumn
    private Long deptId;

    /**
     * 精选好店 标记 1是 2 不是。
     */
    @TableField(value = "is_select_shop")
    private Integer isSelectShop;

    /**
     * 推荐店铺 标记 1是 2 不是。
     */
    @TableField(value = "is_recommended_shop")
    private Integer isRecommendedShop;

    /**
     * 美味店铺标记  1是 2不是。
     */
    @TableField(value = "is_delicious_shop")
    private Integer isDeliciousShop;

    /**
     * 优选新店 标记 1是 2 不是。
     */
    @TableField(value = "is_best_new_shop")
    private Integer isBestNewShop;


    /**
     * banner图。
     */
    @UploadFlagColumn(storeType = UploadStoreTypeEnum.HUAWEI_OBS_SYSTEM)
    @TableField(value = "restaurant_banner")
    private String restaurantBanner;

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


    /**
     * 送餐时间/min。
     */
    @TableField(value = "delivery_time")
    private Integer deliveryTime;



    /**
     * name LIKE搜索字符串。
     */
    @TableField(exist = false)
    private String searchString;

    /**
     * 配送费。
     */
    @TableField(value = "delivery_charge")
    private String deliveryCharge;

    /**
     * 最低消费。
     */
    @TableField(value = "min_charge")
    private BigDecimal minCharge;

    /**
     * 餐馆idList。
     */
    @TableField(exist = false)
    private List<Long> restaurantIdList;

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

    @RelationDict(
            masterIdField = "typeId",
            slaveModelClass = RestaurantType.class,
            slaveIdField = "id",
            slaveNameField = "name")
    @TableField(exist = false)
    private List<Map<String, Object>> typeIdDictMapList;


    @RelationDict(
            masterIdField = "deptId",
            slaveModelClass = SysDept.class,
            slaveIdField = "deptId",
            slaveNameField = "deptName")
    @TableField(exist = false)
    private Map<String, Object> deptIdDictMap;


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

    @RelationConstDict(
            masterIdField = "isSelectShop",
            constantDictClass = IsSelectShop.class)
    @TableField(exist = false)
    private Map<String, Object> isSelectShopDictMap;

    @RelationConstDict(
            masterIdField = "isRecommendedShop",
            constantDictClass = IsRecommendedShop.class)
    @TableField(exist = false)
    private Map<String, Object> isRecommendedShopDictMap;

    @RelationConstDict(
            masterIdField = "isDeliciousShop",
            constantDictClass = IsDeliciousShop.class)
    @TableField(exist = false)
    private Map<String, Object> isDeliciousShopDictMap;

    @RelationConstDict(
            masterIdField = "isBestNewShop",
            constantDictClass = IsBestNewShop.class)
    @TableField(exist = false)
    private Map<String, Object> isBestNewShopDictMap;
    @TableField(exist = false)
    private String foodName;
}
