package com.engine.recruit.enums;

import com.engine.recruit.exception.CustomizeRunTimeException;
import com.weaver.rpa.sdk.clients.application.resume.common.ResumePlatform;

/**
 * 发布渠道枚举类
 *
 * @author:dxfeng
 * @createTime: 2023/10/08
 * @version: 1.0
 */
public enum PositionThirdChannelEnum {
    /**
     * 发布渠道
     */
    BOSSZHIPIN("0", "BOSS直聘", ResumePlatform.BOSSZHIPIN),
    ZHILIANZHAOPIN("1", "智联招聘", ResumePlatform.ZHILIANZHAOPIN),
    QIANCHENGWUYOU("2", "前程无忧", ResumePlatform.QIANCHENGWUYOU),
    LAGO("3", "拉勾", ResumePlatform.LAGO),
    LIEPIN("4", "猎聘", ResumePlatform.LIEPIN);

    PositionThirdChannelEnum(String value, String desc, int resumePlatformId) {
        this.value = value;
        this.desc = desc;
        this.resumePlatformId = resumePlatformId;
    }

    private String value;
    private String desc;
    private int resumePlatformId;

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    public int getResumePlatformId() {
        return resumePlatformId;
    }

    public void setResumePlatformId(int resumePlatformId) {
        resumePlatformId = resumePlatformId;
    }

    public static PositionThirdChannelEnum getEnumByValue(String value) {
        for (PositionThirdChannelEnum item : PositionThirdChannelEnum.values()) {
            if (item.value.equalsIgnoreCase(value)) {
                return item;
            }
        }
        throw new CustomizeRunTimeException("不支持的发布渠道");
    }

    public static PositionThirdChannelEnum getEnumByPlatformId(int resumePlatformId) {
        for (PositionThirdChannelEnum item : PositionThirdChannelEnum.values()) {
            if (item.resumePlatformId == resumePlatformId) {
                return item;
            }
        }
        throw new CustomizeRunTimeException("不支持的发布渠道");
    }
}
