package com.zd.common.core.enums;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.zd.common.core.domain.hazard.HardwareType;

import java.util.Arrays;

/**
 * 硬件类型枚举
 *
 * @Author: zhoupan
 * @Date: 2021/09/13/15:47
 * @Description:
 */
@JsonFormat(shape = JsonFormat.Shape.OBJECT)
public enum RiskHardwareTypeEnum implements BaseEnum<Integer>, HardwareType {

    SWITCH(0, "电源控制", ""),
    AI_VENTILATION(3, "智能通风", ""),
    AI_PHONE(4, "语音电话", ""),
    AI_ANNOUNCEMENTS(5, "语音播报", "");

    private Integer code;
    private String name;
    private String img;

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

    public static RiskHardwareTypeEnum getByCode(Integer code) {
        return Arrays.stream(RiskHardwareTypeEnum.values()).filter(a -> a.code.equals(code)).findFirst().orElse(null);
    }

    public Integer getCode() {
        return code;
    }

    public String getName() {
        return name;
    }

    public String getImg() {
        return img;
    }

    @Override
    public Integer getDictKey() {
        return code;
    }

    @Override
    public Integer getHardwareTypeCode() {
        return code;
    }

    @Override
    public String getHardwareTypeName() {
        return name;
    }

    public String getEnumName() {
        return super.toString();
    }
}
