import type { BasicColumn, FormSchema } from '@/components/Table'
import { useRender } from '@/components/Table'
import { DICT_TYPE, getDictOptions } from '@/utils/dict'

export const columns: BasicColumn[] = [
  // {
  //   title: '编号',
  //   dataIndex: 'id',
  //   width: 160,
  // },
  {
    title: '姓名',
    dataIndex: 'name',
    width: 160,
  },
  {
    title: '性别',
    dataIndex: 'sex',
    width: 160,
    customRender: ({ text }) => {
      return useRender.renderDict(text, DICT_TYPE.SYSTEM_USER_SEX)
    }
  },
  {
    title: '移动电话',
    dataIndex: 'phone',
    width: 160,
  },
  {
    title: '电子邮箱',
    dataIndex: 'email',
    width: 160,
  },
  {
    title: '最高学历',
    dataIndex: 'educationLevel',
    width: 160,
  },
  {
    title: '是否接受岗位调剂',
    dataIndex: 'jobAdjustment',
    width: 160,
    customRender: ({ text }) => {
      return useRender.renderDict(text, DICT_TYPE.INFRA_BOOLEAN_STRING)
    }
  },
  {
    title: '简历附件URL',
    dataIndex: 'resumeUrl',
    width: 160,
  },
  {
    title: '投递时间',
    dataIndex: 'createTime',
    width: 180,
    customRender: ({ text }) => {
      return useRender.renderDate(text)
    },
  },
]

export const searchFormSchema: FormSchema[] = [
  {
    label: '姓名',
    field: 'name',
    component: 'Input',
    colProps: { span: 4 },
  },
  {
    label: '性别',
    field: 'sex',
    component: 'Select',
    componentProps: {
      options: getDictOptions(DICT_TYPE.SYSTEM_USER_SEX)
    },
    colProps: { span: 4 },
  },
  {
    label: '移动电话',
    field: 'phone',
    component: 'Input',
    colProps: { span: 4 },
  },
  {
    label: '电子邮箱',
    field: 'email',
    component: 'Input',
    colProps: { span: 4 },
  },
  {
    label: '最高学历',
    field: 'educationLevel',
    component: 'Input',
    colProps: { span: 4 },
  },
  {
    label: '是否接受岗位调剂',
    field: 'jobAdjustment',
    component: 'Select',
    componentProps: {
      options: getDictOptions(DICT_TYPE.INFRA_BOOLEAN_STRING)
    },
    colProps: { span: 4 },
  },
  {
    label: '投递时间',
    field: 'createTime',
    component: 'RangePicker',
    colProps: { span: 8 },
  },
]

export const createFormSchema: FormSchema[] = [
  {
    label: '编号',
    field: 'id',
    show: false,
    component: 'Input',
  },
]

export const updateFormSchema: FormSchema[] = [
  {
    label: '编号',
    field: 'id',
    show: false,
    component: 'Input',
  },
]
