

# Generated by the protocol buffer compiler.  DO NOT EDIT!
# sources: blickfeld/onvif/data/health.proto
# plugin: python-betterproto
from dataclasses import dataclass
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__


@dataclass(eq=False, repr=False)
class Health(betterproto.Message):
    """Describes the health of the ONVIF module"""

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

    state_reason: str = betterproto.string_field(2)
    """Reason for a given state. Only set if state is not STATE_OK"""

    clients: Dict[str, "HealthClient"] = betterproto.map_field(
        3, betterproto.TYPE_STRING, betterproto.TYPE_MESSAGE
    )
    """Served clients (key is unique subscription uuid)"""


@dataclass(eq=False, repr=False)
class HealthTopic(betterproto.Message):
    """Notification subscription topic"""

    number_of_raised_events: int = betterproto.uint32_field(1)
    """
    number of raised events corresponding to the topic name (counted on the
    raising edge)
    """


@dataclass(eq=False, repr=False)
class HealthClient(betterproto.Message):
    """Describes the connected VMS client"""

    ip: str = betterproto.string_field(1)
    """IP address of the client"""

    uptime: int = betterproto.uint32_field(2)
    """
    Time since the client has been actively pulling the ONVIF notifications
    """

    subscribed_topics: Dict[str, "HealthTopic"] = betterproto.map_field(
        3, betterproto.TYPE_STRING, betterproto.TYPE_MESSAGE
    )
    """Active subscription topics (key: topic name)"""
