package com.cmvr.aima.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 爱玛任务状态枚举
 * 
 * @author cmvr-iot
 * @since 2026-06-22
 */
@Getter
@AllArgsConstructor
public enum AimaTaskStatusEnum {
    // 未执行
    NOT_STARTED(5, "未执行"),
    SUCCESS(0, "已完成"),
    RUNNING(1, "执行中"),
    FAILED(2, "失败"),
    PAUSED(3, "已暂停"),
    STOPPED(4, "已终止");

    private final int code;
    private final String desc;

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