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


export const querySchema: FormSchemaGetter = () => [
  {
    component: 'Textarea',
    fieldName: 'content',
    label: '敏感词内容',
  },
  {
    component: 'Select',
    componentProps: {
    },
    fieldName: 'enabled',
    label: '是否启用 0:未启用 1:启用',
  },
  {
    component: 'Input',
    fieldName: 'creator',
    label: '创建者',
  },
];

// 需要使用i18n注意这里要改成getter形式 否则切换语言不会刷新
// export const columns: () => VxeGridProps['columns'] = () => [
export const columns: VxeGridProps['columns'] = [
  { type: 'checkbox', width: 60 },
  {
    title: 'id',
    field: 'id',
  },
  {
    title: '敏感词内容',
    field: 'content',
  },
  {
    title: '是否启用 0:未启用 1:启用',
    field: 'enabled',
  },
  {
    title: '创建者',
    field: 'creator',
  },
  {
    field: 'action',
    fixed: 'right',
    slots: { default: 'action' },
    title: '操作',
    width: 180,
  },
];

export const modalSchema: FormSchemaGetter = () => [
  {
    label: 'id',
    fieldName: 'id',
    component: 'Input',
    dependencies: {
      show: () => false,
      triggerFields: [''],
    },
  },
  {
    label: '敏感词内容',
    fieldName: 'content',
    component: 'Textarea',
    rules: 'required',
  },
  {
    label: '是否启用 0:未启用 1:启用',
    fieldName: 'enabled',
    component: 'Select',
    componentProps: {
    },
    rules: 'selectRequired',
  },
  {
    label: '创建者',
    fieldName: 'creator',
    component: 'Input',
    rules: 'required',
  },
];
