package com.yonge.cooleshow.task.core;

public enum TaskStatus {

	FAILED(-1, "执行失败"), PAUSED(0, "暂停"), READY(1, "准备就绪"), EXECUTING(2, "执行中"), EXECUTED(3, "执行完成");

	private int code;

	private String description;

	private TaskStatus(int code, String description) {
		this.code = code;
		this.description = description;
	}

	public static TaskStatus getTaskStatus(int code) {
		for (TaskStatus status : values()) {
			if (status.getCode() == code) {
				return status;
			}
		}
		return null;
	}

	public int getCode() {
		return code;
	}

	public String getDescription() {
		return description;
	}

}
