import { BasicColumn } from '/@/components/Table';
import { FormSchema } from '/@/components/Table';
import { render } from '/@/utils/common/renderUtils';

export const columns: BasicColumn[] = [
  {
    title: '学校编码',
    align: 'center',
    dataIndex: 'mainCode',
  },
  {
    title: '学校名称',
    align: 'center',
    dataIndex: 'mainName',
  },
  {
    title: '学校简称',
    align: 'center',
    dataIndex: 'shortName',
  },
  {
    title: '学校图标',
    align: 'center',
    dataIndex: 'schoolIcon',
    customRender: render.renderImage,
  },
  {
    title: '创建时间',
    align: 'center',
    dataIndex: 'createTime',
  },
  {
    title: '更新时间',
    align: 'center',
    dataIndex: 'updateTime',
  },
];

export const searchFormSchema: FormSchema[] = [
  {
    label: '关键字',
    field: 'keyword',
    component: 'Input',
    colProps: { span: 6 },
    helpMessage: '走 /school/school/search：支持 编码/名称/简称/别名',
  },
  {
    label: '学校编码',
    field: 'mainCode',
    component: 'Input',
    colProps: { span: 6 },
  },
  {
    label: '学校名称',
    field: 'mainName',
    component: 'Input',
    colProps: { span: 6 },
  },
  {
    label: '学校简称',
    field: 'shortName',
    component: 'Input',
    colProps: { span: 6 },
  },
];

export const formSchema: FormSchema[] = [
  {
    label: '学校编码',
    field: 'mainCode',
    component: 'Input',
    required: true,
  },
  {
    label: '学校名称',
    field: 'mainName',
    component: 'Input',
    required: true,
  },
  {
    label: '学校简称',
    field: 'shortName',
    component: 'Input',
  },
  {
    label: '学校图标',
    field: 'schoolIcon',
    component: 'Input',
    helpMessage: '填写图片URL（或后端文件路径）',
  },
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false,
  },
];

export function getBpmFormSchema(_formData): FormSchema[] {
  return formSchema;
}
