import { CommonInfoModel } from '@/api/inhert/VillageInfoApi';
import type { CheckBoxListProps } from '@/components/dynamic/wrappers/CheckBoxList.vue';
import type { PickerIdFieldProps } from '@/components/dynamic/wrappers/PickerIdField';
import type { FieldProps } from '@/components/form/Field.vue';
import type { SingleForm } from '../forms';
import { villageCommonContent } from './common';

export const villageInfoGloryFormItems: SingleForm = [
  CommonInfoModel,
  (r) => ({
    formItems: [
      {
        label: '标题',
        name: 'name',
        type: 'text',
        defaultValue: '',
        additionalProps: {
          placeholder: '请输入标题',
        },
        rules: [{
          required: true,
          message: '请输入标题',
        }],
      },
      {
        label: '描述',
        name: 'desc',
        type: 'textarea',
        defaultValue: '',
        additionalProps: {
          placeholder: '请输入描述',
        },
      },
      {
        label: '类型',
        name: 'entityType',
        type: 'check-box-list',
        defaultValue: [],
        additionalProps: {
          multiple: true,
          loadData: async () => [
            { text: '个人', value: '1' },
            { text: '团队', value: '2' },
            { text: '企业', value: '3' },
            { text: '匿名', value: '4' },
          ],
        } as CheckBoxListProps,
        formProps: {
          extraMessage: '可多选',
        },
      },
      {
        label: '荣誉类型',
        name: 'honorType',
        type: 'select-id',
        defaultValue: undefined,
        additionalProps: {
          loadData: async () => [
            { text: '捐赠', value: 1 },
            { text: '志愿服务', value: 2 },
            { text: '公益帮扶', value: 3 },
            { text: '其他', value: 4 },
          ],
        } as PickerIdFieldProps,
        formProps: { showRightArrow: true } as FieldProps,
      },
      {
        label: '表彰对象',
        name: 'customName',
        type: 'text',
        defaultValue: '',
        additionalProps: {
          placeholder: '请输入表彰对象',
        },
      },
      {
        label: '发生时间',
        name: 'occurrenceDate',
        type: 'datetime',
        defaultValue: '',
        additionalProps: {
          type: 'date',
        },
        formProps: { showRightArrow: true } as FieldProps,
      },
      {
        label: '发生地址',
        name: 'address',
        type: 'text',
        defaultValue: '',
        additionalProps: {
          placeholder: '请输入发生地址',
        },
      },
      ...villageCommonContent(r, {
        title: '记录',
        showTitle: false,
      }).formItems,
    ],
  }),
  { title: '乡源荣光', typeName: '' },
];
