package com.cmvr.test.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

@Getter
@AllArgsConstructor
public enum TaskStatusEnum {

    SUCCESS(0, "已完成"),
    RUNNING(1, "执行中"),
    FAILED(2, "失败"),
    PAUSED(3, "已暂停"),
    STOPPED(4, "已终止");

    private final int code;
    private final String desc;

    public static TaskStatusEnum fromCode(int code) {
        for (TaskStatusEnum status : values()) {
            if (status.code == code) {
                return status;
            }
        }
        return null;
    }
}
