package com.erp.purchase.enums;

/**
 * 采购入库单状态
 */
public enum PurchaseInboundStatus {
    PENDING("pending", "待入库"),
    PARTIAL("partial", "部分入库"),
    COMPLETED("completed", "已完成"),
    CANCELLED("cancelled", "已取消");

    private final String code;
    private final String desc;

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

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

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