import { BasicColumn } from '@/components/Table';
import { FormSchema } from '@/components/Form';
import { getDictOptions } from '@/utils/dict';
import { infoList } from '@/api/basicInfo/elevator';
import { useRender } from '@/hooks/component/useRender';
const { renderTag, renderDict } = useRender();
export const formSchemas: FormSchema[] = [
  // {
  //   label: '项目id',
  //   field: 'projectId',
  //   component: 'Input',
  // },
  {
    label: '设备编号',
    field: 'deviceCode',
    component: 'Input',
  },
  {
    label: '设备名称',
    field: 'deviceName',
    component: 'Input',
  },
  {
    label: '设备序列号',
    field: 'deviceSerial',
    component: 'Input',
  },
  {
    label: '注册代码',
    field: 'registerCode',
    component: 'Input',
  },

  {
    label: '是否在线',
    field: 'isLine',
    component: 'Select',
    componentProps: {
      options: getDictOptions('common_yes_no'),
    },
  },
  {
    label: '平台类型',
    field: 'platformType',
    component: 'Select',
    componentProps: {
      options: getDictOptions('platform_type'),
    },
  },
  {
    label: '设备类型',
    field: 'videoType',
    component: 'Select',
    componentProps: {
      options: getDictOptions('device_type'),
    },
  },
  // {
  //   label: '是否关联电梯',
  //   field: 'videoType',
  //   component: 'Select',
  //   componentProps: {
  //     options: getDictOptions('common_yes_no'),
  //   },
  // },
];

export const columns: BasicColumn[] = [
  {
    title: '主键id',
    dataIndex: 'id',
    ifShow: false,
  },
  // {
  //   title: '项目',
  //   dataIndex: 'projectId',
  // },
  // {
  //   title: '设备编号',
  //   dataIndex: 'deviceCode',
  // },
  {
    title: '设备名称',
    dataIndex: 'deviceName',
  },
  {
    title: '设备序列号',
    dataIndex: 'deviceSerial',
  },
  {
    title: '注册代码',
    dataIndex: 'registerCode',
  },
  // {
  //   title: '通道编号',
  //   dataIndex: 'channelCode',
  // },
  {
    title: '通道号',
    dataIndex: 'channelNum',
  },

  {
    title: '离线时长',
    dataIndex: 'offlineTime',
  },
  // {
  //   title: '控门状态',
  //   dataIndex: 'armingState',
  // },
  // {
  //   title: '通道名称',
  //   dataIndex: 'channelName',
  // },
  {
    title: '是否在线',
    dataIndex: 'isLine',
    customRender: ({ value }) => renderDict(value, 'common_yes_no'),
  },
  // {
  //   title: '布撤防状态',
  //   dataIndex: 'armingState',
  //   customRender: ({ value }) => renderDict(value, 'defeat_status'),
  // },
  // {
  //   title: '分享状态',
  //   dataIndex: 'shareState',
  //   customRender: ({ value }) => renderDict(value, 'share_status'),
  // },
  // {
  //   title: '封面地址',
  //   dataIndex: 'coverAddress',
  // },
  // {
  //   title: '是否加密',
  //   dataIndex: 'isEncrypt',
  //   customRender: ({ value }) => renderDict(value, 'common_yes_no'),
  // },
  {
    title: '关联电梯',
    dataIndex: 'relevancyElevator',
  },
  {
    title: '直播地址',
    dataIndex: 'liveAddress',
  },
  {
    title: '安全码',
    dataIndex: 'securityCode',
  },
  // {
  //   title: 'ip白名单',
  //   dataIndex: 'whiteList',
  // },
  // {
  //   title: '人体检查类型',
  //   dataIndex: 'detectionType',
  //   customRender: ({ value }) => renderDict(value, 'body_check_type'),
  // },
  // {
  //   title: '开门语音播报',
  //   dataIndex: 'voiceBroadcast',
  //   customRender: ({ value }) => renderDict(value, 'common_yes_no'),
  // },
  {
    title: '平台类型',
    dataIndex: 'platformType',
  },
  {
    title: '更新时间',
    dataIndex: 'finallyTime',
  },
  // {
  //   title: '类型',
  //   dataIndex: 'videoType',
  //   customRender: ({ value }) => renderDict(value, 'device_type'),
  // },
];

export const modalSchemas: FormSchema[] = [
  {
    label: '主键id',
    field: 'id',
    required: false,
    component: 'Input',
    show: false,
  },
  {
    label: '项目',
    field: 'deptId',
    required: true,
    component: 'TreeSelect',
    helpMessage: ['注意绑定的角色要带相应的部门权限, 否则无法正常登录'],
  },
  {
    label: '第三方电梯id',
    field: 'eleId',
    required: false,
    component: 'Input',
  },

  {
    label: '设备编号',
    field: 'deviceCode',
    required: true,
    component: 'Input',
  },
  {
    label: '设备名称',
    field: 'deviceName',
    required: true,
    component: 'Input',
  },
  {
    label: '设备序列号',
    field: 'deviceSerial',
    required: true,
    component: 'Input',
  },
  {
    label: '注册代码',
    field: 'registerCode',
    required: true,
    component: 'Input',
  },
  {
    label: '通道编号',
    field: 'channelCode',
    required: true,
    component: 'Input',
  },
  {
    label: '通道号',
    field: 'channelNum',
    required: true,
    component: 'Input',
  },
  {
    label: '通道名称',
    field: 'channelName',
    required: true,
    component: 'Input',
  },
  {
    label: '是否在线',
    field: 'isLine',
    required: true,
    component: 'Select',
    componentProps: {
      options: getDictOptions('common_yes_no'),
    },
  },
  {
    label: '布撤防状态',
    field: 'armingState',
    required: true,
    component: 'Select',
    componentProps: {
      options: getDictOptions('defeat_status'),
    },
  },
  {
    label: '分享状态',
    field: 'shareState',
    required: true,
    component: 'Select',
    componentProps: {
      options: getDictOptions('share_status'),
    },
  },
  {
    label: '封面地址',
    field: 'coverAddress',
    required: true,
    component: 'Input',
  },
  {
    label: '是否加密',
    field: 'isEncrypt',
    required: true,
    component: 'Select',
    componentProps: {
      options: getDictOptions('common_yes_no'),
    },
  },
  {
    label: '关联电梯',
    field: 'relevancyElevator',
    required: true,
    component: 'ApiSelect',
    componentProps: {
      api: infoList,
      labelField: 'elevatorName',
      valueField: 'id',
      placeholder: '请选择电梯',
      afterFetch: (res) => {
        return res.rows;
      },
    },
  },
  {
    label: '直播地址',
    field: 'liveAddress',
    required: true,
    component: 'Input',
  },
  {
    label: '安全码',
    field: 'securityCode',
    required: true,
    component: 'Input',
  },
  {
    label: 'ip白名单',
    field: 'whiteList',
    required: true,
    component: 'Input',
  },
  {
    label: '人体检查类型',
    field: 'detectionType',
    required: true,
    component: 'Select',
    componentProps: {
      options: getDictOptions('body_check_type'),
    },
  },
  {
    label: '人体类型',
    field: 'detectionType',
    required: false,
    component: 'Select',
    componentProps: {
      options: getDictOptions('body_type'),
    },
  },
  {
    label: '开门语音播报',
    field: 'voiceBroadcast',
    required: true,
    component: 'Select',
    componentProps: {
      options: getDictOptions('common_yes_no'),
    },
  },
  {
    label: '平台类型',
    field: 'platformType',
    required: true,
    component: 'Select',
    componentProps: {
      options: getDictOptions('platform_type'),
    },
  },
  {
    label: '设备类型',
    field: 'videoType',
    required: true,
    component: 'Select',
    componentProps: {
      options: getDictOptions('device_type'),
    },
  },
];
export const bodyModalSchemas: FormSchema[] = [
  {
    label: 'AI参数',
    field: 'AI',
    required: false,
    component: 'Input',
  },
  {
    label: '关键点分数',
    field: 'AI',
    required: false,
    component: 'Input',
  },
  {
    label: '关键点个数',
    field: 'AI',
    required: false,
    component: 'InputNumber',
  },
  {
    label: '人体关键点类型',
    field: 'AI',
    required: false,
    component: 'Select',
    componentProps: {
      options: getDictOptions('body_access_type'),
    },
  },
  {
    label: '人体框最小宽度',
    field: 'AI',
    required: false,
    component: 'InputNumber',
  },
  {
    label: '人体框最小高度',
    field: 'AI',
    required: false,
    component: 'InputNumber',
  },
];
