package com.ruoyi.info.collection.enums;

import com.ruoyi.common.utils.StringUtils;

/**
 * 招聘类型枚举
 *
 * @author ruoyi
 */
public enum RecruitType {

    /** 社招 */
    SOCIAL("SOCIAL", "社招"),

    /** 校招 */
    CAMPUS("CAMPUS", "校招");

    private final String code;
    private final String desc;

    RecruitType(String code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public String getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }

    public static String getDescByCode(String code) {
        for (RecruitType type : values()) {
            if (type.code.equals(code)) {
                return type.desc;
            }
        }
        return null;
    }

    public static String inferCode(String recruitName) {
        if (StringUtils.isNotEmpty(recruitName) && recruitName.contains("校园")) {
            return CAMPUS.code;
        }
        return SOCIAL.code;
    }
}
