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

/**
 * 速汇手续费状态
 *
 * @author gao
 * @date 2025/11/3 15:23
 */
public enum GlobalOrderDeductionStatusEnum {

    DEDUCTION_PROCESSING("1", "扣款处理中"),
    DEDUCTION_SUCCESS("2", "扣款成功"),

    DEDUCTION_FAIL("3", "扣款失败"),
    REFUND_PROCESSING("4", "退款处理中"),

    REFUND_SUCCESS("5", "退款成功"),

    REFUND_FAIL("6", "退款失败");

    private final String status;
    private final String description;

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

    public String getStatus() {
        return status;
    }

    public String getDescription() {
        return description;
    }

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

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

}
