/**
 * 表格列配置 - 网络拓扑分组
 */
import dayjs from 'dayjs'
import type { TableColumnData } from '@arco-design/web-vue/es/table/interface'

export const getColumns = (): TableColumnData[] => [
  {
    title: '',
    dataIndex: 'tree',
    width: 20,
    align: 'center',
  },
  {
    title: '序号',
    dataIndex: 'index',
    width: 60,
    align: 'center',
    slotName: 'index',
  },
  {
    title: '分组名称',
    dataIndex: 'name',
    width: 150,
    align: 'left',
  },
  {
    title: '层级',
    dataIndex: 'parent_id',
    width: 100,
    align: 'center',
    slotName: 'level',
  },
  {
    title: '分组路径',
    dataIndex: 'path',
    width: 150,
    align: 'left',
  },
  {
    title: '拓扑数量',
    dataIndex: 'topology_count',
    width: 120,
    align: 'center',
    slotName: 'topology_count',
  },
  {
    title: '总链路数',
    dataIndex: 'total_link_count',
    width: 120,
    align: 'center',
    slotName: 'total_link_count',
  },
  {
    title: '排序',
    dataIndex: 'sort',
    width: 80,
    align: 'center',
  },
  {
    title: '启用',
    dataIndex: 'enable',
    width: 80,
    align: 'center',
    slotName: 'enable',
  },
  {
    title: '创建时间',
    dataIndex: 'created_at',
    width: 160,
    align: 'center',
    render: ({ record }: any) => {
      return record.created_at ? dayjs(record.created_at).format('YYYY-MM-DD HH:mm') : '-'
    },
  },
  {
    title: '描述',
    dataIndex: 'description',
    width: 180,
    align: 'left',
  },
  {
    title: '操作',
    dataIndex: 'operation',
    width: 300,
    align: 'center',
    fixed: 'right',
    slotName: 'operation',
  },
]
