import type { VbenFormProps } from '#/adapter/form';

import { STATUS_OPTIONS } from './constants';

/** VIP 功能字典表单 */
export const modalFormProps: VbenFormProps = {
  wrapperClass: 'grid-cols-12',
  commonConfig: {
    formItemClass: 'col-span-12',
    componentProps: { class: 'w-full' },
  },
  layout: 'horizontal',
  schema: [
    {
      component: 'VbenInput',
      fieldName: 'id',
      label: 'ID',
      dependencies: { show: false, triggerFields: ['id'] },
    },
    {
      component: 'VbenInput',
      fieldName: 'code',
      label: '功能编码',
      rules: 'required',
      componentProps: { placeholder: 'snake_case，如 medical_record' },
    },
    {
      component: 'VbenInput',
      fieldName: 'name',
      label: '功能名称',
      rules: 'required',
      componentProps: { placeholder: '如：病历' },
    },
    {
      component: 'VbenInput',
      fieldName: 'description',
      label: '说明',
      componentProps: { type: 'textarea', rows: 2 },
      defaultValue: '',
    },
    {
      component: 'InputNumber',
      fieldName: 'sort',
      label: '排序',
      formItemClass: 'col-span-6',
      componentProps: { min: 0 },
      defaultValue: 0,
    },
    {
      component: 'VbenSelect',
      fieldName: 'status',
      label: '状态',
      formItemClass: 'col-span-6',
      componentProps: { options: STATUS_OPTIONS },
      defaultValue: 1,
    },
  ],
  showDefaultActions: false,
};
