package com.lingyue.parse.enums;

import lombok.Getter;

/**
 * 解析状态枚举
 * 
 * @author lingyue
 * @since 2026-01-14
 */
@Getter
public enum ParseStatus {
    
    PENDING("pending", "等待解析"),
    PARSING("parsing", "解析中"),
    SUCCESS("success", "解析成功"),
    FAILED("failed", "解析失败"),
    CANCELLED("cancelled", "已取消");
    
    private final String code;
    private final String description;
    
    ParseStatus(String code, String description) {
        this.code = code;
        this.description = description;
    }
    
    public static ParseStatus fromCode(String code) {
        for (ParseStatus status : values()) {
            if (status.code.equals(code)) {
                return status;
            }
        }
        return PENDING;
    }
}
