package com.tourism.webadmin.back.model;

import com.baomidou.mybatisplus.annotation.*;
import com.tourism.webadmin.back.model.constant.Enable;
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.back.model.constant.IsHotFood;
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_food_info")
public class RestaurantFoodInfo extends BaseModel {

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

    /**
     * 饭馆美食种类id。
     */
    @TableField(value = "food_type_id")
    private String foodTypeId;

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

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

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

    /**
     * 菜品销量。
     */
    @TableField(value = "sales")
    private Integer sales;

    /**
     * 菜品价格。
     */
    @TableField(value = "price")
    private BigDecimal price;

    /**
     * 价格单位。
     */
    @TableField(value = "price_unit")
    private String priceUnit;

    /**
     * 用户所在部门Id。
     */
    @TableField(value = "restaurant_id")
    private String restaurantId;

    /**
     * 打包费。
     */
    @TableField(value = "baling_charge")
    private BigDecimal balingCharge;

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

    /**
     * 超火美食标记 1是 2不是。
     */
    @TableField(value = "is_hot_food")
    private Integer isHotFood;

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

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

    @RelationDict(
            masterIdField = "foodTypeId",
            slaveModelClass = RestaurantFoodType.class,
            slaveIdField = "id",
            slaveNameField = "name")
    @TableField(exist = false)
    private Map<String, Object> foodTypeIdDictMap;

    @RelationDict(
            masterIdField = "restaurantId",
            slaveModelClass = RestaurantInfo.class,
            slaveIdField = "id",
            slaveNameField = "name")
    @TableField(exist = false)
    private Map<String, Object> restaurantIdDictMap;

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

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


    @RelationConstDict(
            masterIdField = "isHotFood",
            constantDictClass = IsHotFood.class)
    @TableField(exist = false)
    private Map<String, Object> isHotFoodDictMap;
}
