package com.haha.common.enums;

public enum VenueType {

    CHARGING_STATION("CHARGING_STATION", "充电站"),
    OFFICE_BUILDING("OFFICE_BUILDING", "写字楼");

    private final String code;
    private final String description;

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

    public String getCode() {
        return code;
    }

    public String getDescription() {
        return description;
    }

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

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