package com.gonghang.h5clientapp.common.enumData;

/**
 * 任务状态
 * Created by shiwn on 2021/6/10 14:19
 */
public enum TaskStatusEnum {
    WAITING(0, "等待"),
    WORKING(1, "正在执行"),
    BREAKED(2, "终止"),
    FINISHED(3, "执行完毕"),
    TIMEOUT(4, "超时"),
    SUSPEND(5, "暂停");

    private int code;
    private String msg;

    TaskStatusEnum(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public int getCode() {
        return code;
    }

    public String getMsg() {
        return msg;
    }

    /**
     * @Description: 根据code取msg
     * @Date: 2021/6/24 15:18
     * @Author: shiwn
     * @Param: [code]
     * @Return:
     */
    public static String getMsg(int code) {
        for (TaskStatusEnum c : TaskStatusEnum.values()) {
            if (c.getCode() == code) {
                return c.msg;
            }
        }
        return null;
    }
}
