import { VillageBulidingInfo } from "@/api/inhert/VillageInfoApi";
import type { SingleForm } from "../forms";
import { villageCommonContent } from "./common";

export function villageInfoFoodProductsForm(title: string) : SingleForm {
  return [VillageBulidingInfo, (r) => ({
    formItems: [
      {
        label: `${title}名称`,
        name: 'name',
        type: 'text',
        defaultValue: '',
        additionalProps: {
          placeholder: '请输入名称',
        },
        rules:  [{
          required: true,
          message: '请输入名称',
        }]
      }, 
      {
        label: `${title}详情`,
        name: 'details',
        type: 'richtext',
        defaultValue: '',
        additionalProps: {
          placeholder: '请输入详情',
          maxLength: 200,
          showWordLimit: true, 
        },
        rules:  [{
          required: true,
          message: '请输入详情',
        }]
      },
      ...(villageCommonContent(r, { 
        title: title,
        showContent: false,
        showTitle: false,
      })).formItems
    ]
  }), { title: title, typeName: 'productType', }];
}