import { Form } from "antd";
import { city2province } from './locData';

export function mapPropsToFields(props) {
    return {
        name: Form.createFormField({
            value: props.name
        }),
        class: Form.createFormField({
            value: { father: props.job_classify_root, son: props.job_classify }
        }),
        num: Form.createFormField({
            value: props.num
        }),
        prop: Form.createFormField({
            value: props.job_category
        }),
        city: Form.createFormField({
            value: [city2province.get(props.city), props.city]
        }),
        address: Form.createFormField({
            value: props.address
        }),
        max: Form.createFormField({
            value: props.max_salary
        }),
        min: Form.createFormField({
            value: props.min_salary
        }),
        edu: Form.createFormField({
            value: props.education
        }),
        exp: Form.createFormField({
            value: props.work_year
        }),
        desc: Form.createFormField({
            value: props.description
        }),
        intro: Form.createFormField({
            value: props.introduce
        })
    };
}

export const mock = {
    id: 21,
    name: "招开发人员", //职位
    salary: "2-10k", //薪资范围
    min_salary: 2000, //最低薪资
    max_salary: 10000, // 最高薪资
    job_classify_root: "前端", // 职位类别一级
    job_classify: "react 开发", // 职位类别二级
    company: "长沙智擎",
    city: "长沙市", //工作地点
    work_year: "1-3年", // 年限
    job_category: "全职", //工作性质
    education: "本科", //学历要求
    num: 2, //招聘人数
    updated_at: "2020-04-02", //发布时间
    address: "长沙岳麓区", //公司地址
    description: "开发岗位", // 岗位描述
    introduce: "公司介绍", //公司简介
    is_applyed: false // 是否已投递过该职位
}