package com.fs.audit.enums;

import lombok.Getter;

/**
 * 审核状态枚举
 */
@Getter
public enum CreditStatus {

    PENDING(0, "待审核"),
    APPROVED(1, "已通过"),
    REJECTED(2, "已驳回");

    private final Integer code;
    private final String desc;

    CreditStatus(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public static CreditStatus fromCode(Integer code) {
        for (CreditStatus status : values()) {
            if (status.getCode().equals(code)) {
                return status;
            }
        }
        throw new IllegalArgumentException("未知的审核状态: " + code);
    }
}

