package com.fs.newAdv.enums;

import lombok.Getter;

/**
 * 任务状态枚举
 *
 * @author zhangqin
 * @date 2025-11-03
 */
@Getter
public enum TaskStatusEnum {

    PENDING(0, "待执行"),
    RUNNING(1, "执行中"),
    SUCCESS(2, "执行成功"),
    FAILED(3, "执行失败");

    private final Integer code;
    private final String name;

    TaskStatusEnum(Integer code, String name) {
        this.code = code;
        this.name = name;
    }

    public static TaskStatusEnum getByCode(Integer code) {
        for (TaskStatusEnum statusEnum : values()) {
            if (statusEnum.getCode().equals(code)) {
                return statusEnum;
            }
        }
        return null;
    }
}

