package com.njcn.device.pq.enums;

import lombok.Getter;

import java.util.Arrays;

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

    /**
     * 系统拓扑各层级描述
     */
    GRID_SIDE(0, "电网侧"),
    NO_GRID_SIDE(1, "非电网侧"),
    SEND_NETWORK(2, "上送国网"),
    NOT_NETWORK(3, "非上送国网"),
    unknown(4, "未知"),
    ;

    private final Integer code;
    private final String message;

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

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

}
