package com.yuchen.saas.parking.api.enums;

import lombok.AllArgsConstructor;

/**
 * 规则类型(1:停车收费，2:停车免费，3:充电期间免费，4:限时充电免费，5:充电时长限免)
 */
@AllArgsConstructor
public enum ParkingStationRuleEnum {

    PARKING_CHARGE(1, "停车收费"),
    FREE_PARKING(2, "停车免费"),
    FREE_OF_CHARGE(3, "充电期间免费"),
    LIMITED_TIME_CHARGING_FREE(4, "限时充电免费"),
    CHARGING_TIME_IS_LIMITED(5, "充电时长限免"),
    ;

    private Integer code;

    public Integer getCode() {
        return code;
    }

    public String getDescription() {
        return description;
    }

    private String description;

    public static String getDescByCode(Integer code) {
        ParkingStationRuleEnum[] enumArray = ParkingStationRuleEnum.values();
        for (ParkingStationRuleEnum e : enumArray) {
            if (e.getCode().equals(code)) {
                return e.getDescription();
            }
        }
        return "";
    }
}
