package com.erp.purchase.enums;

/**
 * 供应商状态
 */
public enum SupplierStatus {
    ACTIVE("active", "正常"),
    SUSPENDED("suspended", "暂停"),
    BLACKLISTED("blacklisted", "黑名单");

    private final String code;
    private final String desc;

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

    public String getCode() { return code; }
    public String getDesc() { return desc; }

    public static SupplierStatus fromCode(String code) {
        for (SupplierStatus s : values()) {
            if (s.code.equals(code)) return s;
        }
        throw new IllegalArgumentException("未知状态: " + code);
    }
}
