package com.yupi.project.model.enums;

import lombok.Getter;

/**
 * 车位状态枚举
 */
@Getter
public enum ParkingSpotStatusEnum {

    AVAILABLE("AVAILABLE", "可用"),
    OCCUPIED_BY_CAR("OCCUPIED_BY_CAR", "有车占用"),
    RESERVED("RESERVED", "已预订"),
    CHARGING("CHARGING", "充电中"), // 指此车位正在进行充电服务
    MAINTENANCE("MAINTENANCE", "维护中"),
    UNAVAILABLE("UNAVAILABLE", "不可用");

    private final String value;
    private final String description;

    ParkingSpotStatusEnum(String value, String description) {
        this.value = value;
        this.description = description;
    }

    /**
     * 根据 value 获取枚举
     *
     * @param value
     * @return
     */
    public static ParkingSpotStatusEnum getEnumByValue(String value) {
        if (value == null) {
            return null;
        }
        for (ParkingSpotStatusEnum anEnum : ParkingSpotStatusEnum.values()) {
            if (anEnum.value.equals(value)) {
                return anEnum;
            }
        }
        return null;
    }
} 