# Generated by the protocol buffer compiler.  DO NOT EDIT!
# sources: blickfeld/push/data/health.proto, blickfeld/push/data/status.proto
# plugin: python-betterproto
from dataclasses import dataclass
from datetime import datetime
from typing import Dict

import blickfeld_qb2.betterproto as betterproto
import blickfeld_qb2.betterproto.lib.google.protobuf as betterproto_lib_google_protobuf

from ...base import data as __base_data__


class StatusConnection(betterproto.Enum):
    """Connection status of the push"""

    CONNECTION_UNSPECIFIED = 0
    """unspecified"""

    CONNECTION_DISABLED = 1
    """push configuration is disabled"""

    CONNECTION_DISCONNECTED = 2
    """disconnected from destination"""

    CONNECTION_CONNECTING = 3
    """connecting to destination"""

    CONNECTION_CONNECTED = 4
    """connected to destination"""

    CONNECTION_PUSHING = 5
    """connected to input and destination"""


@dataclass(eq=False, repr=False)
class Status(betterproto.Message):
    """state of a push"""

    sent_messages: int = betterproto.uint32_field(1)
    """message statistics [default = 0]"""

    connection: "StatusConnection" = betterproto.enum_field(2)
    """flag to indicate if it is working or not"""

    data_rate: float = betterproto.float_field(3)
    """
    Average data rate The resulting value is averaged over the last 5 messages
    sent, peak or current values might be different.
    """

    last_message: datetime = betterproto.message_field(4)
    """Timestamp when last message was sent"""

    state: "__base_data__.HealthState" = betterproto.enum_field(5)
    """State of push connection."""

    state_reason: str = betterproto.string_field(6)
    """
    Reason for the given state. Needs to be set if state is not STATE_OK.
    """


@dataclass(eq=False, repr=False)
class Health(betterproto.Message):
    """A health message that contains information about the push status"""

    state: "__base_data__.HealthState" = betterproto.enum_field(1)
    """High-level state of module."""

    state_reason: str = betterproto.string_field(2)
    """
    Reason for the given state. Needs to be set if state is not STATE_OK.
    """

    status: Dict[str, "Status"] = betterproto.map_field(
        3, betterproto.TYPE_STRING, betterproto.TYPE_MESSAGE
    )
    """map of push status"""
