package com.sckw.core.model.enums;

import lombok.Getter;

/**
 * @author czh
 * @desc 计费方式枚举
 * @date 2023/7/14
 */
@Getter
public enum ChargingTypeEnum {

    //装货量
    ON(1, "装货量"),
    //卸货量
    OFF(2, "卸货量"),
    //车次
    CAR(3, "车次");

    private final int code;

    private final String name;

    ChargingTypeEnum(int code, String name){
        this.code = code;
        this.name = name;
    }

    public static ChargingTypeEnum getName(int code){
        for (ChargingTypeEnum chargingTypeEnum : values()) {
            if (chargingTypeEnum.getCode() == code) {
                return chargingTypeEnum;
            }
        }
        return null;
    }
}
