import type { VbenFormSchema } from '@vben/common-ui';
import type { VxeColumnPropTypes } from '#/adapter/vxe-table';

/**
 * 搜索表单配置
 */
export function queryFormSchema(): VbenFormSchema[] {
  return [
    { 
      component: 'Input',
      fieldName: 'examName',
      label: '考试名称',
      componentProps: {
        placeholder: '请输入考试名称',
      },
    },
    { 
      component: 'Input',
      fieldName: 'userName',
      label: '考试姓名',
      componentProps: {
        placeholder: '请输入考试姓名',
      },
    },
    { 
      component: 'DatePicker',
      fieldName: 'examTime',
      label: '考试时间',
      componentProps: {
        placeholder: '请选择时间范围',
        type: 'daterange',
        rangeSeparator: '至',
        startPlaceholder: '开始时间',
        endPlaceholder: '结束时间',
        valueFormat: 'YYYY-MM-DD HH:mm:ss'
      },
    },
    { 
      component: 'Select',
      fieldName: 'department',
      label: '部门',
      componentProps: {
        placeholder: '请选择部门',
        allowClear: true,
        options: [
          { label: '技术部', value: 'tech' },
          { label: '财务部', value: 'finance' },
          { label: '人力资源部', value: 'hr' },
          { label: '市场部', value: 'marketing' },
          { label: '销售部', value: 'sales' },
        ]
      },
    },
  ];
}

/**
 * 表格列配置
 */
export const tableColumns: VxeColumnPropTypes[] = [
  {
    title: '姓名',
    field: 'userName',
    showOverflow: true,
  },
  {
    title: '部门',
    field: 'department',
    showOverflow: true,
  },
  {
    title: '考试名称',
    field: 'examName',
    showOverflow: true,
  },
  {
    title: '考试总分',
    field: 'totalScore',
    align: 'center',
  },
  {
    title: '考生得分',
    field: 'userScore',
    align: 'center',
  },
  {
    title: '是否及格',
    field: 'isPass',
    align: 'center',
  },
  {
    title: '答题开始时间',
    field: 'answerStartTime',
    showOverflow: true,
  },
  {
    title: '答题结束时间',
    field: 'answerEndTime',
    showOverflow: true,
  },
  {
    title: '答题时长',
    field: 'answerDuration',
    align: 'center',

  },
  {
    title: '考试开始时间',
    field: 'examStartTime',
    showOverflow: true,
  },
  {
    title: '操作',
    field: 'action',
    align: 'center',
    slots: { default: 'action' },
  },
];
