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

export const ACADEMY_FILE_FORM_CONFIG: FormConfig[] = [
  {
    prop: 'materialName',
    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',
  },
];

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

export const ACADEMY_FILE_FORM_RULES = {
  materialName: [{ required: true, message: '请输入宣传资料名称', trigger: 'blur' }],
  categoryName: [{ required: true, message: '请选择分类名称', trigger: 'change' }],
  description: [{ required: true, message: '请输入资料描述', trigger: 'blur' }],
  attachmentUrl: [{ required: true, message: '请上传文档', trigger: 'change' }],
};
