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: 'order_id',
      label: '订单ID',
      dependencies: {
        show: false,
        triggerFields: ['order_id'],
      },
    },
    {
      component: 'VbenInput',
      componentProps: {
        placeholder: '请输入快递单号',
      },
      fieldName: 'express_no',
      label: '快递单号',
      rules: 'required',
    },
    {
      component: 'ExpressCompanySelect',
      componentProps: {
        placeholder: '请选择快递公司',
      },
      fieldName: 'express_company_code',
      formItemClass: 'col-span-6',
      label: '快递公司',
      rules: 'required',
      // 单号变化时传入 trackingNo，组件按前缀自动匹配快递公司
      dependencies: {
        triggerFields: ['express_no'],
        componentProps(values) {
          return {
            placeholder: '请选择快递公司',
            trackingNo: values.express_no,
          };
        },
      },
    },
    {
      component: 'Textarea',
      componentProps: {
        placeholder: '请输入发货备注',
      },
      fieldName: 'introduce',
      label: '发货备注',
    },
  ],
  showDefaultActions: false,
};
