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

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',
      formItemClass: 'col-span-6',
      defaultValue: '',
      dependencies: {
        show: false,
        triggerFields: ['id'],
      },
    },
    {
      component: 'VbenInput',
      componentProps: {
        placeholder: '请输入专区标题，如"OTC专区"',
      },
      fieldName: 'title',
      label: '标题',
      rules: 'required',
      defaultValue: '',
    },
    {
      component: 'VbenSelect',
      componentProps: {
        placeholder: '请选择专区类型',
        options: [
          { label: 'OTC专区', value: 'otc' },
          { label: '处方药专区', value: 'prescription' },
          { label: '保健食品专区', value: 'health_food' },
          { label: '产品服务包专区', value: 'service_package' },
          { label: '非药品专区', value: 'non_drug' },
          { label: '医疗器械专区', value: 'medical_device' },
        ],
      },
      fieldName: 'type',
      label: '类型',
      rules: 'required',
      defaultValue: undefined,
    },
    {
      component: 'VbenSelect',
      componentProps: {
        placeholder: '请选择映射的药品类型',
        options: [
          { label: '西药', value: 2 },
          { label: '保健食品', value: 3 },
          { label: '产品服务包', value: 5 },
          { label: '非药品', value: 6 },
          { label: '医疗器械', value: 7 },
        ],
        allowClear: true,
      },
      fieldName: 'drug_type',
      label: '药品类型',
      defaultValue: undefined,
    },
    {
      component: 'Avatar',
      fieldName: 'icon',
      label: '图标',
      defaultValue: '',
    },
    {
      component: 'VbenInput',
      componentProps: {
        placeholder: '请输入专区描述（可选）',
        type: 'textarea',
        rows: 3,
        showCount: true,
        maxlength: 200,
      },
      fieldName: 'description',
      label: '描述',
      defaultValue: '',
    },
    {
      component: 'InputNumber',
      componentProps: {
        placeholder: '请输入排序顺序',
        min: 0,
        max: 9999,
      },
      fieldName: 'sort_order',
      label: '排序',
      formItemClass: 'col-span-6',
      defaultValue: 0,
    },
    {
      component: 'VbenSelect',
      componentProps: {
        placeholder: '请选择状态',
        options: [
          { label: '启用', value: 1 },
          { label: '禁用', value: 0 },
        ],
      },
      fieldName: 'status',
      label: '状态',
      formItemClass: 'col-span-6',
      defaultValue: 1,
    },
    {
      component: 'VbenInputNumber',
      componentProps: {
        placeholder: '门店ID（留空表示平台通用）',
        min: 0,
      },
      fieldName: 'store_id',
      label: '门店ID',
      formItemClass: 'col-span-6',
      defaultValue: 0,
    },
  ],
  showDefaultActions: false,
};
