package com.mosty.base.enums;

import lombok.Getter;
import org.apache.commons.lang3.StringUtils;

/**
 * 号牌种类枚举
 */
@Getter
public enum PlateClassEnum {
    DC("大型汽车号牌","01","yellow","truck"),
    XC("小型汽车号牌","02","blue","vehicle"),
    SGQC("使馆汽车号牌","03","black","vehicle"),
    LSGQC("领馆汽车号牌","04","black","vehicle"),
    JWQC("境外汽车号牌","05","black","vehicle"),
    WJQC("外籍汽车号牌","06","black","vehicle"),
    PTMT("普通摩托车号牌","07","blue",""),
    QBMT("轻便摩托车号牌","08","blue",""),
    SGMT("使馆摩托车号牌","09","black",""),
    LSGMT("领馆摩托车号牌","10","black",""),
    JWMT("境外摩托车号牌","11","black",""),
    WJMT("外籍摩托车号牌","12","black",""),
    JYQC("警用汽车","23","white","vehicle"),
    CDDQC("纯电动新能源小车","102","green","vehicle"),
    HHXNYQC("混合新能源小车","103","green","vehicle"),
    CDDXNYDC("纯电动新能源大车","104","green","truck"),
    HHXNYDC("混合新能源大车","105","green","truck"),
    ;
    private  String  name;
    private  String  value;
    private  String  color;
    private  String  vehicleType;
    private PlateClassEnum(String name, String value, String color, String vehicleType){
        this.name = name;
        this.value = value;
        this.color = color;
        this.vehicleType = vehicleType;
    }

    /**
     * 根据值转换成枚举类型
     * @param value
     * @return
     */
    public  static PlateClassEnum toValue(String value){
        for (PlateClassEnum _tp : PlateClassEnum.values()){
            if((_tp.getValue().equals(value))){
                return  _tp;
            }
        }
        return  null;
    }

    /**
     * 根据值取枚举类型，后返回枚举类型的名字
     * @param value
     * @return
     */
    public  static  String   getNameByValue(String value){
        PlateClassEnum _tpEnum = toValue(value);
        if(null == _tpEnum){
            return StringUtils.EMPTY;
        }
        return  _tpEnum.getName();
    }
}
