// cli/src/codes.ts
export const PROVINCES = {
    "11": { name: "北京", pinyin: "beijing" },
    "12": { name: "天津", pinyin: "tianjin" },
    "13": { name: "河北", pinyin: "hebei" },
    "14": { name: "山西", pinyin: "shanxi" },
    "15": { name: "内蒙古", pinyin: "neimenggu" },
    "21": { name: "辽宁", pinyin: "liaoning" },
    "22": { name: "吉林", pinyin: "jilin" },
    "23": { name: "黑龙江", pinyin: "heilongjiang" },
    "31": { name: "上海", pinyin: "shanghai" },
    "32": { name: "江苏", pinyin: "jiangsu" },
    "33": { name: "浙江", pinyin: "zhejiang" },
    "34": { name: "安徽", pinyin: "anhui" },
    "35": { name: "福建", pinyin: "fujian" },
    "36": { name: "江西", pinyin: "jiangxi" },
    "37": { name: "山东", pinyin: "shandong" },
    "41": { name: "河南", pinyin: "henan" },
    "42": { name: "湖北", pinyin: "hubei" },
    "43": { name: "湖南", pinyin: "hunan" },
    "44": { name: "广东", pinyin: "guangdong" },
    "45": { name: "广西", pinyin: "guangxi" },
    "46": { name: "海南", pinyin: "hainan" },
    "50": { name: "重庆", pinyin: "chongqing" },
    "51": { name: "四川", pinyin: "sichuan" },
    "52": { name: "贵州", pinyin: "guizhou" },
    "53": { name: "云南", pinyin: "yunnan" },
    "54": { name: "西藏", pinyin: "xizang" },
    "61": { name: "陕西", pinyin: "shaanxi" },
    "62": { name: "甘肃", pinyin: "gansu" },
    "63": { name: "青海", pinyin: "qinghai" },
    "64": { name: "宁夏", pinyin: "ningxia" },
    "65": { name: "新疆", pinyin: "xinjiang" },
};
export function resolveProvince(input) {
    if (PROVINCES[input])
        return input;
    const lower = input.toLowerCase();
    for (const [id, p] of Object.entries(PROVINCES)) {
        if (p.name === input || p.pinyin === lower)
            return id;
    }
    return null;
}
export const EXAM_TYPES = {
    guokao: "国家公务员考试",
    beijing: "北京市公务员考试",
    shengkao: "省级公务员考试（各省省考）",
    xiaofang: "国家综合性消防救援队伍消防员招录（退役士兵专项）",
    shiye: "事业单位招聘（退役专项/定向）",
};
export const EDUCATION_LEVELS = [
    "本科", "硕士研究生", "博士研究生",
    "大专", "本科及以上", "硕士研究生及以上", "博士研究生及以上",
    "仅限本科", "仅限硕士研究生", "仅限博士研究生",
];
export const POLITICAL_STATUS = [
    "中共党员", "中共党员或共青团员", "不限",
];
export const INST_TYPES = [
    "中央党群机关", "中央国家行政机关本级",
    "中央国家行政机关省级以下直属机构",
    "中央国家行政机关参照公务员法管理事业单位",
];
const VETERAN_RE = /退役(大学生)?士兵/;
const GRASSROOTS_RE = /村官|三支一扶|特岗教师|特设岗位|西部计划|服务基层项目|基层服务项目|[一二三四五六七两](类服务人员|类基层项目人员|项目人员|类服务|类基层服务)|四项目人员/;
/**
 * 从岗位文本（建议拼接 remarks + 职位名称 + 职位简介等字段）识别专项定向标签。
 *   - "退役士兵": 出现"退役士兵/退役大学生士兵"——覆盖纯退役专项岗 + 退役士兵也能报的合并定向岗。
 *   - "基层项目": 面向大学生村官/三支一扶/特岗教师/西部计划等服务基层项目人员的定向岗。
 * 国考中退役士兵专项常与服务基层项目人员合并在同一定向计划招录，故两个标签会大量重叠。
 */
export function classifyPrograms(text) {
    const tags = [];
    if (VETERAN_RE.test(text))
        tags.push("退役士兵");
    if (GRASSROOTS_RE.test(text))
        tags.push("基层项目");
    return tags;
}
