package com.cool.store.enums;

/**
 * @Author suzhuhong
 * @Date 2025/6/23 15:49
 * @Version 1.0
 */
public enum PreFryStageEnum {
    PRE_FRY_COMPLETED(1, "预炸完成"),
    STORED_IN_DISPLAY_CABINET(2, "存入展示柜"),
    STORED_IN_FRIDGE(3, "放入冰箱"),
    TAKEN_OUT_NEXT_DAY(4, "次日拿出"),
    DISCARDED(5, "报废"),
    SALES_COMPLETED(6, "销售完成");

    private final int code;
    private final String description;

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

    public int getCode() {
        return code;
    }

    public String getDescription() {
        return description;
    }

    /**
     * 根据code获取枚举
     */
    public static PreFryStageEnum getByCode(int code) {
        for (PreFryStageEnum stage : values()) {
            if (stage.code == code) {
                return stage;
            }
        }
        return null;
    }

    /**
     * 根据code获取描述
     */
    public static String getDescriptionByCode(int code) {
        PreFryStageEnum stage = getByCode(code);
        return stage != null ? stage.description : "";
    }
}
