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 PowerFlagEnum {

    /**
     * 系统拓扑各层级描述
     */
    GRID_SIDE(0, "电网侧"),
    NO_GRID_SIDE(1, "非电网侧"),
    NEW_ENERGY(2, "电网侧(新能源)"),
    NO_NEW_ENERGY(3, "非电网侧(新能源)"),
    SEND_NETWORK(4, "上送国网"),
    PCC(5, "PCC"),


    VIRTUAL_DEVICE(0,"虚拟终端"),
    REAL_DEVICE(1,"实际终端"),
    OFFLINE_DEICE(2,"离线终端")





            ;

    private final Integer code;
    private final String message;

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

    public static PowerFlagEnum getPowerFlagEnumByCode(Integer code) {
        return Arrays.stream(PowerFlagEnum.values())
                .filter(x -> x.getCode().equals(code))
                .findAny()
                .orElse(GRID_SIDE);
    }

}
