package com.njcn.product.terminal.mysqlTerminal.pojo.enums;

import lombok.Getter;

import java.util.Arrays;

/**
 * pqs
 *
 * @author cdf
 * @date 2022/1/4
 */
@Getter
public enum LineBaseEnum {

    /**
     * 系统拓扑各层级描述
     */
    PROJECT_LEVEL(0, "项目"),
    PROVINCE_LEVEL(1, "省份"),
    GD_LEVEL(2, "供电公司"),
    SUB_LEVEL(3, "变电站"),
    DEVICE_LEVEL(4, "终端"),
    SUB_V_LEVEL(5, "母线"),
    LINE_LEVEL(6, "监测点"),
    USER_LEVEL(7,"用户"),
    INVALID_LEVEL(-1, "非法拓扑等级"),



    /**
     * 分布式光伏树层级
     */
    PV_UNIT_LEVEL(0,"单位"),
    PV_SUB_LEVEL(1,"变电站"),
    PV_SUB_AREA_LEVEL(2,"台区"),

    /**
     * 电网标志
     */
    POWER_FLAG(0,"电网侧"),
    POWER_FLAG_NOT(1,"非电网侧"),



    ;

    private final Integer code;
    private final String message;

    LineBaseEnum(Integer code, String message) {
        this.code = code;
        this.message = message;
    }

    public static LineBaseEnum getLineBaseEnumByCode(Integer code) {
        return Arrays.stream(LineBaseEnum.values())
                .filter(lineBaseEnum -> lineBaseEnum.getCode().equals(code))
                .findAny()
                .orElse(INVALID_LEVEL);
    }

}
