package com.yunfeiyun.agmp.common.enums;

/**
 * 任务状态
 * @author liuyaowen
 * */
public enum TaskStatus {
    EXECUTING("1", "执行中"),
    UNAUDITED("2", "待审核"),
    COMPLETED("3", "已完成"),
    STOP("4","已终止")
    ;
    private final String code;
    private final String message;

    TaskStatus(String code, String message)
    {
        this.code = code;
        this.message = message;
    }

    public String getCode()
    {
        return code;
    }

    public String getMessage()
    {
        return message;
    }

    public static String valueOfCode(String code){
        for(TaskStatus taskStatus: TaskStatus.values()) {
            if(taskStatus.equal(code)){
                return taskStatus.getMessage();
            }
        }
        return "";
    }

    public boolean equal(String code){
        return this.code.equals(code);
    }
}
