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

export const ACADEMY_FILE_FORM_CONFIG: FormConfig[] = [
  {
    prop: 'fileName',
    label: '文件名称：',
    component: 'ElInput',
    componentProps: {
      placeholder: '请输入文件名称',
    },
  },
  {
    prop: 'categoryName',
    label: '分类名称：',
    component: 'ElSelect',
    componentProps: {
      placeholder: '请选择分类名称',
    },
    selectOptions: [
      { label: '外部院级文件', value: '外部院级文件' },
      { label: '内部院级文件', value: '内部院级文件' },
    ],
  },
  {
    prop: 'fileCode',
    label: '文件编号：',
    component: 'ElInput',
    componentProps: {
      placeholder: '请输入文件编号',
    },
  },
  {
    prop: 'fileVersion',
    label: '文件版本号：',
    component: 'ElInput',
    componentProps: {
      placeholder: '请输入文件版本号，如：V1.0',
    },
  },
  {
    prop: 'fileFormat',
    label: '文件格式：',
    slot: 'fileFormat',
  },
  {
    prop: 'publishDate',
    label: '发布日期：',
    component: 'ElDatePicker',
    componentProps: {
      type: 'date',
      placeholder: '请选择发布日期',
      valueFormat: 'YYYY-MM-DD',
    },
  },
  {
    prop: 'content',
    label: '文档内容：',
    slot: 'content',
  },
  {
    prop: 'fileUrl',
    label: '文档上传：',
    slot: 'fileUrl',
  },
  {
    prop: 'status',
    label: '状态：',
    slot: 'status',
  },
  {
    prop: 'imageUrls',
    label: '图片上传：',
    slot: 'imageFileUrl',
  },
];

export const ACADEMY_FILE_FORM_DATA = {
  fileName: '',
  classifyName: '',
  fileCode: '',
  fileVersion: '',
  fileFormat: '',
  publishDate: '',
  fileUrl: '',
  attachmentUrl: '' as any, // 文件列表（FileItem数组）
  content: '',
  status: 1, // 默认启用
  imageUrls:  '' as any,
  categoryName: '',
  imageFileUrl: '',
};

export const ACADEMY_FILE_FORM_RULES = {
  fileName: [{ required: true, message: '请输入文件名称', trigger: 'blur' }],
  categoryName: [{ required: true, message: '请选择分类名称', trigger: 'change' }],
  fileCode: [{ required: true, message: '请输入文件编号', trigger: 'blur' }],
  fileVersion: [{ required: true, message: '请输入文件版本号', trigger: 'blur' }],
  fileFormat: [{ required: true, message: '请选择文件格式', trigger: 'change' }],
  publishDate: [{ required: true, message: '请选择发布日期', trigger: 'change' }],
  status: [{ required: true, message: '请选择状态', trigger: 'change' }],
  fileUrl: [{ required: true, message: '请选择文档上传', trigger: 'change' }],
  content: [{ required: true, message: '请输入文档内容', trigger: 'blur' }],
  imageUrls: [{ required: true, message: '请选择图片上传', trigger: 'change' }],
};
