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

import { getStoreClassificationOptionApi } from '#/views/my-gen/mall-classification/api';

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',
      fieldName: 'id',
      label: 'ID',
      formItemClass: 'col-span-6',
      dependencies: {
        show: false,
        triggerFields: ['id'],
      },
    },
    // 生成的表单字段
    {
      fieldName: 'name',
      label: '店铺名称',
      component: 'VbenInput',
      formItemClass: 'col-span-6',
      rules: 'required',
    },
    {
      fieldName: 'level',
      label: '店铺等级',
      component: 'InputNumber',
      formItemClass: 'col-span-6',
      rules: 'required',
    },
    {
      fieldName: 'introduction',
      label: '店铺简介',
      component: 'Textarea',
      rules: 'required',
    },
    {
      fieldName: 'description',
      label: '详细介绍',
      component: 'Textarea',
      rules: 'required',
    },
    {
      fieldName: 'phone',
      label: '商家电话号码',
      component: 'VbenInput',
      formItemClass: 'col-span-6',
      rules: 'required',
    },
    {
      fieldName: 'person',
      label: '联系人名称',
      component: 'VbenInput',
      formItemClass: 'col-span-6',
      rules: 'required',
    },
    {
      fieldName: 'id_card',
      label: '身份证号码',
      component: 'VbenInput',
      formItemClass: 'col-span-6',
      rules: 'required',
    },
    {
      fieldName: 'classification_id',
      label: '行业',
      component: 'ApiTreeSelect',
      componentProps: {
        childrenField: 'children',
        labelField: 'name',
        valueField: 'id',
        api: getStoreClassificationOptionApi,
      },
      formItemClass: 'col-span-6',
      defaultValue: 0,
      rules: 'required',
    },
    {
      fieldName: 'is_featured',
      label: '推荐店铺',
      component: 'RadioGroup',
      componentProps: {
        options: [
          {
            label: '是',
            value: 1,
          },
          {
            label: '否',
            value: 0,
          },
        ],
      },
      formItemClass: 'col-span-6',
      defaultValue: 0,
      rules: 'required',
    },
    {
      fieldName: 'chain',
      label: '连锁',
      component: 'RadioGroup',
      componentProps: {
        options: [
          {
            label: '是',
            value: 1,
          },
          {
            label: '否',
            value: 0,
          },
        ],
      },
      formItemClass: 'col-span-6',
      defaultValue: 0,
      rules: 'required',
    },
    {
      fieldName: 'business_suspended',
      label: '暂停营业',
      component: 'RadioGroup',
      componentProps: {
        options: [
          {
            label: '是',
            value: 1,
          },
          {
            label: '否',
            value: 0,
          },
        ],
      },
      formItemClass: 'col-span-6',
      defaultValue: 0,
      rules: 'required',
    },
    {
      fieldName: 'avatar',
      label: '店铺头像',
      component: 'Avatar',
      formItemClass: 'col-span-6',
      rules: 'required',
    },
    {
      fieldName: 'business_license',
      label: '营业执照',
      component: 'Avatar',
      formItemClass: 'col-span-6',
      rules: 'required',
    },
    {
      fieldName: 'id_card_portrait_side',
      label: '身份证人面',
      component: 'Avatar',
      formItemClass: 'col-span-6',
      rules: 'required',
    },
    {
      fieldName: 'id_card_national_emblem_side',
      label: '身份证国徽面',
      component: 'Avatar',
      formItemClass: 'col-span-6',
      rules: 'required',
    },
  ],
  showDefaultActions: false,
};
