import { CommonInfoModel } from "@/api/inhert/VillageInfoApi";
import type { SingleForm } from "../forms";
import { villageCommonContent } from "./common";
import type { FieldProps } from "@/components/form/Field.vue";

export const villageInfoStoryFormItems: SingleForm = [CommonInfoModel, (r) => ({
  formItems: [
    {
      label: '标题',
      name: 'title',
      type: 'text',
      defaultValue: '',
      additionalProps: {
        placeholder: '请输入标题',
      },
      rules: [{
        required: true,
        message: '请输入标题',
      }]
    },
    {
      label: '简介',
      name: 'intro',
      type: 'richtext',
      defaultValue: '',
      additionalProps: {
        placeholder: '请输入内容',
      },
      rules: [{
        required: true,
        message: '请输入内容',
      }]
    },
    ...villageCommonContent(r, {
      title: '掌故轶事',
      showTitle: false,
    }).formItems
  ]
}), { title: '掌故轶事', typeName: '', }]

export const villageInfoFigureFormItems: SingleForm = [CommonInfoModel, (r) => ({
  formItems: [
    {
      label: '历史人物名称',
      name: 'name',
      type: 'text',
      defaultValue: '',
      additionalProps: {
        placeholder: '请输入标题',
      },
      rules: [{
        required: true,
        message: '请输入标题',
      }]
    },
    {
      label: '历史人物简介',
      name: 'brief',
      type: 'richtext',
      defaultValue: '',
      additionalProps: {
        placeholder: '请输入简介',
        maxLength: 500,
        showWordLimit: true,
      } as FieldProps,
      rules: [{
        required: true,
        message: '请输入简介',
      }]
    },
    ...villageCommonContent(r, {
      title: '历史人物',
      showTitle: false,
    }).formItems
  ]
}), { title: '历史人物', typeName: '', }]
