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

/**
 * 速汇手续费类型
 *
 * @author gao
 * @date 2025/11/3 15:23
 */
public enum GlobalOrderDeductionTypeEnum {

    WAIT_PROCESS("wait_process", "1"),
    PROCESSING("processing", "1"),

    SUCCESS("success", "2"),

    FAIL("fail", "3");


    private final String status;
    private final String deductionAccountStatus;

    GlobalOrderDeductionTypeEnum(String status, String deductionAccountStatus) {
        this.status = status;
        this.deductionAccountStatus = deductionAccountStatus;
    }

    public String getStatus() {
        return status;
    }

    public String getDeductionAccountStatus() {
        return deductionAccountStatus;
    }

    public static GlobalOrderDeductionTypeEnum fromCode(String status) {
        if (status == null) {
            return null;
        }
        for (GlobalOrderDeductionTypeEnum typeEnum : values()) {
            if (typeEnum.getStatus().equals(status)) {
                return typeEnum;
            }
        }
        return null;
    }

    public static String matchCode(String status) {
        GlobalOrderDeductionTypeEnum typeEnum = fromCode(status);
        return typeEnum != null ? typeEnum.getDeductionAccountStatus() : "";
    }

}
