package cn.cecep.talroad.enums;

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

/**
 * 排口类型
 */
public enum OutletTypesEnum {

    MAIN_OUTLETS("1", "主要排口"),
    GENERAL_OUTLETS("2", "一般排口"),
    ;

    private String code;

    private String name;

    OutletTypesEnum(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(String code) {
        for (OutletTypesEnum delFlagEnum : OutletTypesEnum.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 (OutletTypesEnum tEnum : OutletTypesEnum.values()) {
            map = new HashMap();
            map.put("id", tEnum.getCode());
            map.put("label", tEnum.getName());
            list.add(map);
        }
    }
}
