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

/**
 * 审批状态枚举
 * @author gao
 * @date 2025/11/4 16:29
 */
public enum CardApproveStatusEnum {
    PENDING(1, "待审核"),
    APPROVED(2, "审核通过"),
    REJECTED(3, "审核拒绝");

    private final int code;
    private final String description;

    CardApproveStatusEnum(int code, String description) {
        this.code = code;
        this.description = description;
    }

    public int getCode() {
        return code;
    }

    public String getDescription() {
        return description;
    }
    public static CardApproveStatusEnum fromCode(Integer code) {
        if (code == null) {
            return null;
        }
        for (CardApproveStatusEnum approveStatus : values()) {
            if (approveStatus.getCode() == code) {
                return approveStatus;
            }
        }
        return null;
    }

    public static String matchCode(Integer code) {
        CardApproveStatusEnum approveStatus = fromCode(code);
        return approveStatus != null ? approveStatus.getDescription() : "待处理";
    }

}
