import { FileItem } from '@/components/UploadFiles/types';
import { FormConfig } from '@/types/basic-form';

export const ACADEMY_FILE_FORM_CONFIG: FormConfig[] = [
  {
    prop: 'caseName',
    label: '事故案例名称：',
    component: 'ElInput',
    componentProps: {
      placeholder: '请输入文件名称',
    },
  },
  {
    prop: 'categoryName',
    label: '分类名称：',
    component: 'ElSelect',
    componentProps: {
      placeholder: '请选择分类名称',
    },
    selectOptions: [
      { label: '外部院级文件', value: '外部院级文件' },
      { label: '内部院级文件', value: '内部院级文件' },
    ],
  },
  {
    prop: 'description',
    label: '案例描述：',
    slot: 'content',
  },
  {
    prop: 'attachmentUrl',
    label: '文档上传：',
    slot: 'fileUrl',
  },
  {
    prop: 'status',
    label: '状态：',
    slot: 'status',
  },
  {
    prop: 'imageUrl',
    label: '图片上传：',
    slot: 'imageFileUrl',
  },
];

export const ACADEMY_FILE_FORM_DATA = {
  caseName: '',
  categoryName: '',
  attachmentUrl: [] as FileItem[],
  description: '',
  status: 1,
  imageUrl: [] as FileItem[],
};

export const ACADEMY_FILE_FORM_RULES = {
  caseName: [{ required: true, message: '请输入事故案例名称', trigger: 'blur' }],
  categoryName: [{ required: true, message: '请选择分类名称', trigger: 'change' }],
  // attachmentUrl: [{ required: true, message: '请选择文档上传', trigger: 'change' }],
  description: [{ required: true, message: '请输入案例描述', trigger: 'blur' }],
  status: [{ required: true, message: '请选择状态', trigger: 'change' }],
  imageUrl: [{ required: true, message: '请选择图片上传', trigger: 'change' }],
};
