/**
 * @description  业务配置
 * @author       朱琦
 * @date         2022/3/1
 */
import businessApi from 'microvideo-map/api/business-api';

const CAR_WIDTH = '3.5vw',
    CAR_HEIGHT = '1.8vw'

/**
 * 业务图例公用配置
 *  type [String] 图例类型
 *  name [String] 图例名称
 *  model [String] 图例图层类型
 *  iconFilter [Array] 图例图层打点 图标配置
 *  queryData [Promise] 图例点击获取数据回调方法
 */
const businessPublicConfig = [{
    name: '路况',
    type: 'lk',
    model: 'lk'
}, {
    name: '摄像头',
    type: 'sxt',
    model: 'point',
    iconFilter: ['type', ([type]) => type === 1 ? 'icon-gl-sxt' : 'icon-gs-sxt'],
    queryData: businessApi.getSXTMapLayerList
}, {
    name: '情报板',
    type: 'qbb',
    model: 'point',
    iconFilter: ['type', ([type]) => type === 1 ? 'icon-gl-qbb' : 'icon-gs-qbb'],
    queryData: businessApi.getQBBMapLayerList
}, {
    name: '交调点',
    type: 'jdd',
    model: 'point',
    iconFilter: ['type', ([type]) => type === 1 ? 'icon-gl-jdd' : 'icon-gs-jdd'],
    queryData: businessApi.getJDDMapLayerList
}, {
    name: '道路事件',
    type: 'dlsj',
    model: 'point',
    iconFilter: ['type', 'eventType', ([type, eventType]) => {
        const prefix = type === 1 ? 'icon-gl-event-' : 'icon-gs-event-'
        let name = ''
        switch (eventType) {
            case 0:
                // 事故
                name = prefix + 'sg'
                break;
            case 1:
                // 救援
                name = prefix + 'jy'
                break;
            case 2:
                // 道口
                name = prefix + 'dk'
                break;
            case 3:
                // 养护
                name = prefix + 'yh'
                break;
            default:
                // 其他
                name = prefix + 'qt'
                break;
        }
        return name
    }],
    queryData: businessApi.getDLSJMapLayerList
}, {
    name: '清障点',
    type: 'qzd',
    model: 'point',
    iconFilter: ['type', ([type]) => type === 1 ? 'icon-gl-jdd' : 'icon-gs-jdd'],
    queryData: businessApi.getQZDMapLayerList
}, {
    name: '救援车辆',
    type: 'jycl',
    model: 'point',
    width: CAR_WIDTH,
    height: CAR_HEIGHT,
    timer: true,
    iconFilter: ['type', ([type]) => type === 1 ? 'icon-gl-jycl-car' : 'icon-gs-jycl-car'],
    queryData: businessApi.getJYCLMapLayerList
}, {
    name: '警车',
    type: 'jc',
    model: 'point',
    width: CAR_WIDTH,
    height: CAR_HEIGHT,
    timer: true,
    iconFilter: ['type', ([type]) => type === 1 ? 'icon-gl-jc-car' : 'icon-gs-jc-car'],
    queryData: businessApi.getJCMapLayerList
}, {
    name: '执法车',
    type: 'zfc',
    model: 'point',
    width: CAR_WIDTH,
    height: CAR_HEIGHT,
    timer: true,
    iconFilter: ['type', ([type]) => type === 1 ? 'icon-gl-zfc-car' : 'icon-gs-zfc-car'],
    queryData: businessApi.getZFCMapLayerList
}, {
    name: '雷雨云层',
    type: 'lyyc',
    model: 'img',
    zIndex: 6,
    loop: true,
    cache:false,
    queryData: businessApi.getLYYCMapLayerList
}, {
    name: '气象点',
    type: 'qxd',
    model: 'point',
    iconFilter: ['type', ([type]) => type === 1 ? 'icon-gl-qxd' : 'icon-gs-qxd'],
    queryData: businessApi.getQXDMapLayerList
}, {
    name: '工区',
    type: 'gq',
    model: 'point',
    iconFilter: ['type', ([type]) => type === 1 ? 'icon-gl-gq' : 'icon-gs-gq'],
    queryData: businessApi.getGQMapLayerList
}, {
    name: '服务区',
    type: 'fwq',
    model: 'point',
    iconFilter: ['type', ([type]) => type === 1 ? 'icon-gl-fwq' : 'icon-gs-fwq'],
    queryData: businessApi.getFWQMapLayerList
}, {
    name: '收费站',
    type: 'sfz',
    model: 'point',
    iconFilter: ['type', ([type]) => type === 1 ? 'icon-gl-sfz' : 'icon-gs-sfz'],
    queryData: businessApi.getSFZMapLayerList
}, {
    name: '汽渡',
    type: 'qd',
    model: 'point',
    iconFilter: ['type', ([type]) => type === 1 ? 'icon-gl-qd' : 'icon-gs-qd'],
    queryData: businessApi.getQDMapLayerList
}, {
    name: 'ETC',
    type: 'etc',
    model: 'point',
    iconFilter: ['type', ([type]) => type === 1 ? 'icon-gl-etc' : 'icon-gs-etc'],
    queryData: businessApi.getETCMapLayerList
}, {
    name: '停车区',
    type: 'tcq',
    model: 'point',
    iconFilter: ['type', ([type]) => type === 1 ? 'icon-gl-tcq' : 'icon-gs-tcq'],
    queryData: businessApi.getTCQMapLayerList
}, {
    name: '枢纽',
    type: 'sn',
    model: 'point',
    iconFilter: ['type', ([type]) => type === 1 ? 'icon-gl-sn' : 'icon-gs-sn'],
    queryData: businessApi.getSNMapLayerList
}, {
    name: '桥梁',
    type: 'ql',
    model: 'point',
    iconFilter: ['type', ([type]) => type === 1 ? 'icon-gl-ql' : 'icon-gs-ql'],
    queryData: businessApi.getQLMapLayerList
}, {
    name: '隧道',
    type: 'sd',
    model: 'point',
    iconFilter: ['type', ([type]) => type === 1 ? 'icon-gl-sd' : 'icon-gs-sd'],
    queryData: businessApi.getSDMapLayerList
}, {
    name: '路线',
    type: 'lx',
    model: 'line',
    queryData: businessApi.getLXMapLayerList
}, {
    name: '桩号',
    type: 'zh',
    model: 'point',
    iconFilter: ['type', ([type]) => type === 1 ? 'icon-gl-zh' : 'icon-gs-zh'],
    queryData: businessApi.getZHMapLayerList
}, {
    name: '重点车辆',
    type: 'zdcl',
}]

/**
 * 默认菜单配置
 */
const defaultMenuConfig = {
    topConfig: ['lk', 'sxt', 'qbb', 'jdd', 'dlsj','lyyc', 'qxd', 'jycl', 'jc', 'zfc'],
    leftConfig: ['gq', 'fwq', 'sfz', 'qd', 'etc', 'tcq'],
    bottomConfig: ['sn', 'ql', 'sd', 'lx', 'zh', ],
    menuWidth: '2.5vw', // 菜单按钮宽
    menuHeight: '2.5vw', // 菜单按钮高
    className: 'mv-menu-box' // 图标菜单组件class
}

/**
 * 默认详情配置
 */
const defaultDetailConfig = ['sxt']


export {
    businessPublicConfig,
    defaultMenuConfig,
    defaultDetailConfig
}