import { SECURITY_TYPE_MAP, STATUS_MAP } from '@/api/ops/security'

export const columns = [
  {
    dataIndex: 'id',
    title: 'ID',
    width: 80,
  },
  {
    dataIndex: 'name',
    title: '服务名称',
    width: 150,
    ellipsis: true,
    tooltip: true,
  },
  {
    dataIndex: 'service_identity',
    title: '服务标识',
    width: 150,
    ellipsis: true,
    tooltip: true,
  },
  {
    dataIndex: 'type',
    title: '设备类型',
    width: 100,
    render: ({ record }: any) => {
      return SECURITY_TYPE_MAP[record.type] || record.type
    },
  },
  {
    dataIndex: 'server_identity',
    title: '服务器标识',
    width: 150,
    ellipsis: true,
    tooltip: true,
  },
  {
    dataIndex: 'enabled',
    title: '启用状态',
    width: 100,
    slotName: 'enabled',
  },
  {
    dataIndex: 'collect_on',
    title: '采集状态',
    width: 100,
    slotName: 'collectOn',
  },
  {
    dataIndex: 'collect_interval',
    title: '采集间隔(秒)',
    width: 120,
  },
  {
    dataIndex: 'status',
    title: '运行状态',
    width: 100,
    slotName: 'status',
  },
  {
    dataIndex: 'response_time',
    title: '响应时间',
    width: 120,
    slotName: 'responseTime',
  },
  {
    dataIndex: 'last_check_time',
    title: '最近检查',
    width: 180,
    slotName: 'lastCheckTime',
  },
  {
    dataIndex: 'continuous_errors',
    title: '连续错误',
    width: 100,
    align: 'center' as const,
  },
  {
    dataIndex: 'actions',
    title: '操作',
    width: 180,
    fixed: 'right' as const,
    slotName: 'actions',
  },
]
