import type { VxeGridProps } from '#/adapter/vxe-table';

import { normalizeLogTimeFilters } from '../../shared/normalizeLogFilters';
import { getIdcardVerifyLogList } from '../api';

export const gridOptions: VxeGridProps<any> = {
  columns: [
    { field: 'id', title: 'ID', width: 80 },
    { field: 'name', title: '姓名摘要', minWidth: 280 },
    { field: 'is_match_txt', title: '结论', width: 90, slots: { default: 'is_match' } },
    { field: 'scene_txt', title: '场景', width: 90 },
    { field: 'source_txt', title: '来源', width: 90 },
    { field: 'code', title: '接口码', width: 80 },
    { field: 'message', title: '消息', minWidth: 160 },
    { field: 'created_at', title: '时间', width: 170 },
    { title: '操作', width: 90, fixed: 'right', slots: { default: 'action' } },
  ],
  keepSource: true,
  pagerConfig: {},
  proxyConfig: {
    ajax: {
      query: async ({ page }, formValues) =>
        getIdcardVerifyLogList({
          page: page.currentPage,
          pageSize: page.pageSize,
          ...normalizeLogTimeFilters(formValues || {}),
        }),
    },
  },
  height: 'auto',
  toolbarConfig: { search: true, refresh: true, zoom: true },
};
