package com.mvc.constant;

public enum DeviceType {
    WATER_METER("水表", "1", "0"),
    PRESSURE_GAGE("压力表", "2", "1"),
    GAS_METER("燃气表", "3", "1"),
    LED_METER("液晶表", "4", "1"),
    SERVER_SIDE("服务侧", "9", "1");

    private String name;
    private String code;
    private String reviewTimeType;//默认的审核时间类型(0:16点;1:8点前)

    DeviceType(String name, String code, String reviewTimeType) {
        this.name = name;
        this.code = code;
        this.reviewTimeType = reviewTimeType;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getReviewTimeType() {
        return reviewTimeType;
    }

    public void setReviewTimeType(String reviewTimeType) {
        this.reviewTimeType = reviewTimeType;
    }

    public static DeviceType findDeviceTypeByCode(String code) {
        if (code == null) {
            return null;
        }
        for (DeviceType deviceType : DeviceType.values()) {
            if (deviceType.code.equals(code)) {
                return deviceType;
            }
        }
        return null;
    }
}
