# Generated by the protocol buffer compiler.  DO NOT EDIT!
# sources: blickfeld/system/data/firmware.proto, blickfeld/system/data/network_status.proto
# plugin: python-betterproto
from dataclasses import dataclass

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__
from .. import config as _config__


@dataclass(eq=False, repr=False)
class Firmware(betterproto.Message):
    """
    The Firmware data message contains all relevant information about the
    current firmware, uploaded firmware and the status of an firmware
    installation.
    """

    pass


@dataclass(eq=False, repr=False)
class FirmwareInfo(betterproto.Message):
    """
    contains information about rauc bundle parsed from the associated manifest
    file
    """

    label: str = betterproto.string_field(1)
    """Human-readable label / version of the firmware"""

    version: "__base_data__.Version" = betterproto.message_field(2)
    """Version"""

    allowed_downgrade_version: "__base_data__.Version" = betterproto.message_field(3)
    """
    Lowest allowed version which can be downgraded to if this firmware is
    installed
    """


@dataclass(eq=False, repr=False)
class FirmwareStatus(betterproto.Message):
    """contains information about rauc bridge status"""

    idle: "FirmwareStatusIdle" = betterproto.message_field(1, group="status")
    """no bundle is available and no installation is happenning"""

    ready_to_install: "FirmwareStatusReadyToInstall" = betterproto.message_field(
        2, group="status"
    )
    """bundle is verified and available for installation"""

    installation: "FirmwareStatusInstallation" = betterproto.message_field(
        3, group="status"
    )
    """the installation process is ongoing"""

    failure: "FirmwareStatusFailure" = betterproto.message_field(4, group="status")
    """installation failed"""

    reboot: "FirmwareStatusReboot" = betterproto.message_field(5, group="status")
    """reboot has been triggered after successfull installation"""

    installed_firmware_info: "FirmwareInfo" = betterproto.message_field(6)
    """Currently installed firmware"""


@dataclass(eq=False, repr=False)
class FirmwareStatusIdle(betterproto.Message):
    """
    initial state when no bundle is available and no installation is happenning
    """

    pass


@dataclass(eq=False, repr=False)
class FirmwareStatusReadyToInstall(betterproto.Message):
    """state when bundle is verified and available for installation"""

    uploaded_firmware_info: "FirmwareInfo" = betterproto.message_field(1)
    """Firmware info of bundle which has been uploaded"""


@dataclass(eq=False, repr=False)
class FirmwareStatusInstallation(betterproto.Message):
    """state when the installation process is ongoing"""

    progress: "FirmwareStatusInstallationProgress" = betterproto.message_field(1)
    """Current installation progress"""


@dataclass(eq=False, repr=False)
class FirmwareStatusInstallationProgress(betterproto.Message):
    """
    Contains information about current state of installation procedure inside
    the tree of progress
    """

    percent: int = betterproto.uint32_field(1)
    """progress of installation in percents (0%-100%)"""

    message: str = betterproto.string_field(2)
    """log message describing the current installation step"""


@dataclass(eq=False, repr=False)
class FirmwareStatusFailure(betterproto.Message):
    """state when installation failed"""

    reason: str = betterproto.string_field(1)
    """Human-readable reason for installation failure"""


@dataclass(eq=False, repr=False)
class FirmwareStatusReboot(betterproto.Message):
    """
    state when reboot of the device has been triggered after successfull
    installation
    """

    pass


@dataclass(eq=False, repr=False)
class NetworkStatus(betterproto.Message):
    """
    Carries information about active connection: current statistics and network
    configuration
    """

    active_config: "_config__.Network" = betterproto.message_field(1)
    """Brings configuration information about currently active connection"""

    statistics: "NetworkStatusStatistics" = betterproto.message_field(2)
    """Brings statistical information about currently active connection"""


@dataclass(eq=False, repr=False)
class NetworkStatusStatistics(betterproto.Message):
    """
    (WIP) Carries statistical information about currently active connection
    """

    speed: str = betterproto.string_field(1)
    """Link speed"""
