package com.rongwei.bsentity.enums;

import java.util.Arrays;
import java.util.Objects;

/**
 * @author shangmi
 * @title EquipmentTypeEnum
 * @date 2023/11/29 18:56
 * @description 设备分类
 */

public enum EquipmentTypeEnum {
    PLATFORMTRUCK("地坪车",29),
    PREHEATING("预热炉",28),
    ROLLINGMILL("轧机",270),
    PREHEATER("预热机",260),
    PAVEMENTMILLER("铣面机",250),
    ANNEALINGFURNACE("退火炉",240),
    CASTLINE("熔铸线",230),
    COMBUSTIONSYSTEM("燃烧系统",220),
    GRINDINGMACHINE("磨床",210),
    SAWINGMACHINE("锯切机",200),
    STRAIGHTENINGMACHINE("矫正机",190),
    SHEARINGMACHINE("剪切机",180),
    HEATINGFURNACE("加热炉",170),
    SEAMING("焊合",160),
    ASURNAME("公辅",150),
    PACKAGINGLINE("包装线",140),
    PRESSUREVESSEL("压力容器",130),
    SLAGPRESS("压渣机",120),
    IMPORTEDTHINSHEARINGMACHINE("进口薄剪机",110),
    GUILLOTINESHEARS("剪板机",100),
    THICKSHEARS("厚剪机",90),
    CROSSCUTSHEARS("横剪机",80),
    WELDINGLINEMACHINE("焊合线机",70),
    DOMESTICTHINSHEARINGMACHINE("国产薄剪机",60),
    HIGHPRECISIONSHEARS("高精剪机",60),
    FILMREWINDER("倒卷机",40),
    WRAPPINGMACHINE("打包机",30),
    FORKLIFT("叉车",20),
    TRAVELLINGCRANE("行车",10)
;
    
    private final String type;
    private final Integer message;

    EquipmentTypeEnum(String type, Integer message) {
        this.type = type;
        this.message = message;
    }

    public static String typeOf(Integer message){
        return getMessageByEquipmentTypeEnum(message,null).type;
    }

    public static Integer messageOf(String type){
        return getTypeByEquipmentTypeEnum(type,null).message;
    }

    public static EquipmentTypeEnum getMessageByEquipmentTypeEnum(Integer message,EquipmentTypeEnum equipmentTypeEnum){
          return Arrays.stream(values()).filter(info -> Objects.equals(message, info.message)).findFirst().orElse(equipmentTypeEnum);
    }


    public static EquipmentTypeEnum getTypeByEquipmentTypeEnum(String type,EquipmentTypeEnum equipmentTypeEnum){
        return Arrays.stream(values()).filter(info -> Objects.equals(type, info.type)).findFirst().orElse(equipmentTypeEnum);
    }
}
