package com.lesingle.creation.common.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * AI3D 任务状态枚举
 */
@Getter
@AllArgsConstructor
public enum AI3DTaskStatusEnum {

    PENDING("pending", "待处理"),
    PROCESSING("processing", "处理中"),
    COMPLETED("completed", "已完成"),
    FAILED("failed", "失败"),
    TIMEOUT("timeout", "超时");

    private final String code;
    private final String desc;

    public static AI3DTaskStatusEnum getByCode(String code) {
        if (code == null) {
            return PENDING;
        }
        for (AI3DTaskStatusEnum status : values()) {
            if (status.getCode().equals(code)) {
                return status;
            }
        }
        return PENDING;
    }
}
