# Generated by the protocol buffer compiler.  DO NOT EDIT!
# sources: github.com/openconfig/gnmi/proto/gnmi_ext/gnmi_ext.proto
# plugin: python-betterproto
from dataclasses import dataclass

import betterproto
from betterproto.grpc.grpclib_server import ServiceBase


class ExtensionId(betterproto.Enum):
    """
    RegisteredExtension is an enumeration acting as a registry for extensions
    defined by external sources.
    """

    EID_UNSET = 0
    # An experimental extension that may be used during prototyping of a new
    # extension.
    EID_EXPERIMENTAL = 999


@dataclass(eq=False, repr=False)
class Extension(betterproto.Message):
    """The Extension message contains a single gNMI extension."""

    registered_ext: "RegisteredExtension" = betterproto.message_field(1, group="ext")
    # Well known extensions.
    master_arbitration: "MasterArbitration" = betterproto.message_field(2, group="ext")
    history: "History" = betterproto.message_field(3, group="ext")


@dataclass(eq=False, repr=False)
class RegisteredExtension(betterproto.Message):
    """
    The RegisteredExtension message defines an extension which is defined
    outside of this file.
    """

    id: "ExtensionId" = betterproto.enum_field(1)
    msg: bytes = betterproto.bytes_field(2)


@dataclass(eq=False, repr=False)
class MasterArbitration(betterproto.Message):
    """
    MasterArbitration is used to select the master among multiple gNMI clients
    with the same Roles. The client with the largest election_id is honored as
    the master. The document about gNMI master arbitration can be found at
    https://github.com/openconfig/reference/blob/master/rpc/gnmi/gnmi-master-
    arbitration.md
    """

    role: "Role" = betterproto.message_field(1)
    election_id: "Uint128" = betterproto.message_field(2)


@dataclass(eq=False, repr=False)
class Uint128(betterproto.Message):
    """Representation of unsigned 128-bit integer."""

    high: int = betterproto.uint64_field(1)
    low: int = betterproto.uint64_field(2)


@dataclass(eq=False, repr=False)
class Role(betterproto.Message):
    """
    There can be one master for each role. The role is identified by its id.
    """

    id: str = betterproto.string_field(1)


@dataclass(eq=False, repr=False)
class History(betterproto.Message):
    """
    The History extension allows clients to request historical data. Its spec
    can be found at
    https://github.com/openconfig/reference/blob/master/rpc/gnmi/gnmi-
    history.md
    """

    snapshot_time: int = betterproto.int64_field(1, group="request")
    range: "TimeRange" = betterproto.message_field(2, group="request")


@dataclass(eq=False, repr=False)
class TimeRange(betterproto.Message):
    start: int = betterproto.int64_field(1)
    end: int = betterproto.int64_field(2)
