package com.haha.common.enums;

public enum BusinessStatus {

    NORMAL("NORMAL", "正常营业"),
    SUSPENDED("SUSPENDED", "暂停营业"),
    WITHDRAWN("WITHDRAWN", "已撤场");

    private final String code;
    private final String description;

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

    public String getCode() {
        return code;
    }

    public String getDescription() {
        return description;
    }

    public static BusinessStatus fromCode(String code) {
        if (code == null) {
            return null;
        }
        for (BusinessStatus businessStatus : values()) {
            if (businessStatus.code.equals(code)) {
                return businessStatus;
            }
        }
        return null;
    }

    public static String getDescription(String code) {
        BusinessStatus businessStatus = fromCode(code);
        return businessStatus != null ? businessStatus.description : "未知";
    }
}
