/**
 * Copyright 2019 DH
 * All right reserved.
 * 项目名称: 大恒泰山系统
 * 创建日期:2023/10/31
 */
package org.ts.ddcs.metadata.sw;

/*** 
 * Date:2023/10/31
 * Title:水文流量元数据定义
 * Description：对本文件的详细描述，原则上不能少于30字
 * @author dylan
 * @version 1.0
 * Remark：认为有必要的其他信息
 */
public enum SwFlowRateMetadataEnum {
    /**
     * 接收时间
     */
    METADATA_FROM_TIME(0, "from_time"),

    /**
     * 采集时间
     */
    METADATA_COLLECT_TIME(1, "tm"),

    /**
     * 上报时间
     */
    METADATA_UP_TIME(2, "up_time"),
    /**
     * 测站编码
     */
    METADATA_RTU_CODE(3, "rtu_code"),
    /**
     * 站类型
     */
    METADATA_ST(4,"st"),
    /**
     * 累计流量
     */
    METADATA_ACCF(5, "accf"),

    /**
     * 蓄电池电压报警
     */
    METADATA_BT_V_WARN(5, "bt_warn"),
    /**
     * 水位超限报警
     */
    METADATA_WATER_LEVEL_OUT_WARN(6, "water_level_out_warn"),
    /**
     * 流量超限报警
     */
    METADATA_FLOW_OUT_WARN(7, "flow_rate_out_warn"),
    /**
     * 水质超限报警
     */
    METADATA_WATER_QUALITY_WARN(8, "water_quality_warn"),
    /**
     * 流量仪表故障报警
     */
    METADATA_FLOW_SENSOR_WARN(9, "flow_device_sensor_warn"),
    /**
     * 水泵开停状态
     */
    METADATA_WATER_PUMP_STATUS(10, "water_pump_status"),
    /**
     * 水位仪表故障报警
     */
    METADATA_WATER_LEVEL_SENSOR_WARN(11, "water_level_sensor_warn"),
    /**
     * 水压超限报警
     */
    METADATA_WATER_PRESURE(12, "water_presure"),
    /**
     * 备用
     */
    METADATA_RESERVE(13, "reserve"),
    /**
     * 终端IC卡功能报警
     */
    METADATA_IC_WARN(14, "ic_warn"),
    /**
     * 定值控制报警
     */
    METADATA_CONTROL_WARN(15, "control"),
    /**
     * 剩余水量的下限报警
     */
    METADATA_SURPLUS_WATER(16, "surplus_water"),
    /**
     * 终端箱门状态报警
     */
    METADATA_DOOR_WARN(17, "door_warn");

    private int code;

    private String name;

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

    public int getCode() {
        return code;
    }

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

    public String getName() {
        return name;
    }

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

    /**
     * 根据CODE查名称
     *
     * @param code
     * @return
     */
    public static String getName(int code) {
        for (SwFlowRateMetadataEnum point : SwFlowRateMetadataEnum.values()) {
            if (point.code == code) {
                return point.name;
            }
        }
        return "";
    }

    /**
     * 根据名称查代码
     *
     * @param name
     * @return
     */
    public static int getCode(String name) {
        for (SwFlowRateMetadataEnum point : SwFlowRateMetadataEnum.values()) {
            if (point.name.equals(name)) {
                return point.code;
            }
        }
        return -1;
    }
}
