package com.tourism.webadmin.back.model;

import com.baomidou.mybatisplus.annotation.*;
import com.tourism.webadmin.back.model.constant.VisaConsoluerLevel;
import com.tourism.webadmin.back.model.constant.VisaIndexFlag;
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.Data;
import lombok.EqualsAndHashCode;

import java.util.Map;

/**
 * 签证顾问信息实体对象。
 *
 * @author 吃饭睡觉
 * @date 2024-09-06
 */
@Data
@EqualsAndHashCode(callSuper = true)
@TableName(value = "tour_visa_counselor")
public class TourVisaCounselor extends BaseModel {

    /**
     * 顾问id。
     */
    @TableId(value = "id")
    private Long id;

    /**
     * 顾问头像。
     */
    @UploadFlagColumn(storeType = UploadStoreTypeEnum.HUAWEI_OBS_SYSTEM)
    @TableField(value = "counselor_avatar")
    private String counselorAvatar;

    /**
     * 顾问电话。
     */
    @TableField(value = "counselor_phone")
    private String counselorPhone;

    /**
     * 顾问微信。
     */
    @UploadFlagColumn(storeType = UploadStoreTypeEnum.HUAWEI_OBS_SYSTEM)
    @TableField(value = "counselor_wechat")
    private String counselorWechat;

    /**
     * 顾问姓名。
     */
    @TableField(value = "counselor_name")
    private String counselorName;

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

    /**
     * 级别。
     */
    @TableField(value = "level")
    private Integer level;

    /**
     * 上班时间。
     */
    @TableField(value = "start")
    private Integer start;

    /**
     * 下班时间。
     */
    @TableField(value = "end")
    private Integer end;

    /**
     * 首页显示顾问。
     */
    @TableField(value = "index_flag")
    private Integer indexFlag;

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

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

    @RelationConstDict(
            masterIdField = "level",
            constantDictClass = VisaConsoluerLevel.class)
    @TableField(exist = false)
    private Map<String, Object> levelDictMap;

    @RelationConstDict(
            masterIdField = "indexFlag",
            constantDictClass = VisaIndexFlag.class)
    @TableField(exist = false)
    private Map<String, Object> indexFlagDictMap;
}
