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

export const modalFormProps: VbenFormProps = {
  wrapperClass: 'grid-cols-12', // 24栅格,
  commonConfig: {
    formItemClass: 'col-span-12',
    // 所有表单项
    componentProps: {
      class: 'w-full',
    },
  },
  // handleSubmit: onSubmit,
  layout: 'horizontal',
  schema: [
    {
      component: 'VbenInput',
      componentProps: {
        placeholder: '请输入提现金额',
      },
      fieldName: 'amount',
      label: '提现金额',
      rules: 'required',
    },
  ],
  showDefaultActions: false,
};

/**
 * 银行卡编辑
 */
export const modalCardFormProps: VbenFormProps = {
  wrapperClass: 'grid-cols-12', // 24栅格,
  commonConfig: {
    formItemClass: 'col-span-12',
    // 所有表单项
    componentProps: {
      class: 'w-full',
    },
  },
  // handleSubmit: onSubmit,
  layout: 'horizontal',
  schema: [
    {
      component: 'VbenInput',
      fieldName: 'id',
      label: 'ID',
      formItemClass: 'col-span-6',
      dependencies: {
        show: false,
        triggerFields: ['id'],
      },
    },
    {
      component: 'VbenInput',
      componentProps: {
        placeholder: '请输入用户',
        disabled: true,
      },
      fieldName: 'user_name',
      label: '账户名称',
      rules: 'required',
      dependencies: {
        show: (values) => {
          return values.id != null;
        },
        triggerFields: ['id'],
      },
    },
    {
      component: 'VbenSelect',
      componentProps: {
        placeholder: '请输入用户类型',
        options: [
          { label: '诊所', value: 1 },
          { label: '平台', value: 2 },
          { label: '供应商', value: 3 },
        ],
        disabled: true,
      },
      fieldName: 'type',
      label: '用户类型',
      rules: 'required',
      dependencies: {
        show: (values) => {
          return values.id != null;
        },
        triggerFields: ['id'],
      },
    },
    {
      component: 'VbenInput',
      componentProps: {
        placeholder: '请输入开户人姓名',
      },
      dependencies: {
        disabled: (values) => {
          return values.id != null;
        },
        triggerFields: ['id'],
      },
      fieldName: 'bank_user_name',
      label: '开户人姓名',
      rules: 'required',
    },
    {
      component: 'VbenInput',
      componentProps: {
        placeholder: '请输入银行卡号',
      },
      dependencies: {
        disabled: (values) => {
          return values.id != null;
        },
        triggerFields: ['id'],
      },
      fieldName: 'bank_card',
      label: '银行卡号',
      rules: 'required',
    },
    {
      component: 'VbenInput',
      componentProps: {
        placeholder: '请输入银行名称',
      },
      dependencies: {
        disabled: (values) => {
          return values.id != null;
        },
        triggerFields: ['id'],
      },
      fieldName: 'bank_name',
      label: '银行名称',
      rules: 'required',
    },
    {
      component: 'RadioGroup',
      componentProps: {
        options: [
          { label: '对公', value: 1 },
          { label: '对私', value: 2 },
          { label: '存折', value: 5 },
        ],
        placeholder: '请选择银行账户类型',
      },
      dependencies: {
        disabled: (values) => {
          return values.id != null;
        },
        triggerFields: ['id'],
      },
      fieldName: 'bank_account_type',
      label: '银行账户类型',
      rules: 'required',
    },
    {
      component: 'VbenInput',
      componentProps: {
        placeholder: '请输入银行联行号',
      },
      dependencies: {
        disabled: (values) => {
          return values.id != null;
        },
        triggerFields: ['id'],
      },
      fieldName: 'bank_no',
      label: '银行联行号',
      rules: 'required',
    },
  ],
  showDefaultActions: false,
};
