package com.crm.rely.backend.core.enums;

/**
 * 速汇订单状态
 * @author gao
 * @date 2025/11/12 17:13
 */
public enum GlobalOrderStatusEnum {
    WAIT_PROCESS("wait_process", "待处理"),
    SUCCESS("success", "成功"),
    FAIL("fail", "失败"),
    PROCESSING("processing", "处理中"),
    PARTNER_PROCESSING("partner_processing", "合作伙伴处理中"),
    CANCEL("cancel", "订单取消");

    private final String status;
    private final String description;

    GlobalOrderStatusEnum(String status, String description) {
        this.status = status;
        this.description = description;
    }

    public String getStatus() {
        return status;
    }

    public String getDescription() {
        return description;
    }

    public static GlobalOrderStatusEnum fromStatus(String status) {
        if (status == null) {
            return null;
        }
        for (GlobalOrderStatusEnum statusEnum : values()) {
            if (statusEnum.getStatus().equals(status)) {
                return statusEnum;
            }
        }
        return null;
    }

    public static String matchStatus(String status) {
        GlobalOrderStatusEnum statusEnum = fromStatus(status);
        return statusEnum != null ? statusEnum.getDescription() : "";
    }

}
