package org.ta.pddserver.model.enums;

public enum MailNoStatusEnum {
    START(0, "下发"),
    SIGNED(1, "签收"),
    INBOUND(9, "入库"),
    POSITION(10, "分配库位"),
    ONBOARD(19, "上架"),
    PICKING(21, "拣货中"),
    PICKED(28, "已拣货"),
    PROBLEM(29, "问题件"),
    PACKAGING(31, "打包中"),
    PACKAGED(39, "打包完成"),
    OUTING(51, "出库中"),
    OUTBOUND(61, "正向出库"),
    REJECTED(62, "拒收出库"),
    DESTROYING(67, "库内销毁中"),
    DESTROYED(68, "库内已销毁"),
    UNKNOWN(-1, "未知");

    private final int code;
    private final String desc;

    // 枚举构造方法默认私有，无需 Spring 注入
    MailNoStatusEnum(int code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    // 仅保留 Getter，无 Setter
    public int getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }

    // 根据状态码查询枚举（核心业务方法）
    public static MailNoStatusEnum getByCode(int code) {
        for (MailNoStatusEnum status : MailNoStatusEnum.values()) {
            if (status.getCode() == code) {
                return status;
            }
        }
        return UNKNOWN;
    }
}