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

export const queryFormSchema: FormSchemaGetter = () => [
  {
    component: 'Input',
    fieldName: 'labelName',
    label: '标签名称',
    componentProps: {
      placeholder: '请输入标签名称',
    },
  },
];

export const tableColumns: VxeGridProps['columns'] = [
  {
    type: 'checkbox',
    width: 80,
  },
  {
    field: 'labelName',
    title: '标签名称',
    minWidth: 120,
  },
  {
    field: 'createBy',
    title: '操作人',
    minWidth: 120,
  },
  {
    field: 'createTime',
    title: '操作时间',
    minWidth: 180,
  },
  {
    field: 'action',
    fixed: 'right',
    slots: { default: 'action' },
    title: '操作',
    width: 150,
  },
];

export const drawerFormSchema: FormSchemaGetter = () => [
  {
    component: 'Input',
    dependencies: {
      show: () => false,
      triggerFields: [''],
    },
    fieldName: 'id',
  },
  {
    component: 'Input',
    fieldName: 'labelName',
    label: '标签名称',
    componentProps: {
      placeholder: '请输入标签名称',
      maxlength: 100,
    },
    rules: 'required',
  },
  {
    component: 'Select',
    fieldName: 'renewalFrequency',
    label: '换证频率',
    componentProps: {
      placeholder: '请选择换证频率',
      options: [
        { label: '每年', value: '每年' },
        { label: '每两年', value: '每两年' },
        { label: '每三年', value: '每三年' },
        { label: '每五年', value: '每五年' },
      ],
    },
  },
  {
    component: 'RadioGroup',
    fieldName: 'annualInspection',
    label: '年审',
    componentProps: {
      options: [
        { label: '转任务', value: '转任务' },
        { label: '转任务计算', value: '转任务计算' },
        { label: '无', value: '无' },
      ],
    },
    rules: 'required',
  },
  {
    component: 'DatePicker',
    fieldName: 'taskStartTime',
    label: '任务开始时间',
    componentProps: {
      placeholder: '请选择任务开始时间',
      type: 'date',
      format: 'YYYY-MM-DD',
      valueFormat: 'YYYY-MM-DD',
    },
  },
  {
    component: 'Input',
    fieldName: 'replacementRequirements',
    label: '更换要求',
    componentProps: {
      placeholder: '请输入更换要求',
      maxlength: 200,
      type: 'textarea',
      rows: 3,
    },
  },
];
