package jnpf.model.cultivate.v2.enums;

import lombok.Getter;

/**
 * 业务来源枚举
 */
@Getter
public enum PositionBusinessSourceEnum {

    /**
     * 岗位学习
     */
    POST_LEARNING(0, "岗位学习"),

    /**
     * 通用课程
     */
    GENERAL_COURSE(1, "通用课程"),

    /**
     * 任务学习
     */
    TASK_LEARNING(2, "任务学习"),

    /**
     * 线下课
     */
    OFFLINE_CLASS(3, "线下课");

    private final Integer code;
    private final String description;

    PositionBusinessSourceEnum(Integer code, String description) {
        this.code = code;
        this.description = description;
    }

    public static PositionBusinessSourceEnum getByCode(Integer code) {
        for (PositionBusinessSourceEnum businessSource : values()) {
            if (businessSource.getCode().equals(code)) {
                return businessSource;
            }
        }
        throw new IllegalArgumentException("Invalid business source code: " + code);
    }
}