package cn.cecep.talroad.enums;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 污染物类型
 */
public enum PollutantTypeEnum {

    GAS("1", "废气"),
    WASTEWATER("2", "废水"),
    ORGANIZATION("3", "无组织"),
    ONLINE_MONITORING("4", "在线监测"),
    ;

    private String code;

    private String name;

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

    public String getCode() {
        return code;
    }

    public String getName() {
        return name;
    }

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

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

    public static String getName(int code) {
        for (PollutantTypeEnum delFlagEnum : PollutantTypeEnum.values()) {
            if (delFlagEnum.code.equals(code)) {
                return delFlagEnum.name;
            }
        }
        return "--";
    }

    public static Map<String, Object> map = new HashMap();
    public static final List<Map<String, Object>> list = new ArrayList<>();

    static {
        for (PollutantTypeEnum tEnum : PollutantTypeEnum.values()) {
            map = new HashMap();
            map.put("id", tEnum.getCode());
            map.put("label", tEnum.getName());
            list.add(map);
        }
    }
}
