# Generated by the protocol buffer compiler.  DO NOT EDIT!
# sources: onos/o1t/o1t.proto
# plugin: python-betterproto
from dataclasses import dataclass
from typing import AsyncIterator, Dict

import betterproto
import grpclib


@dataclass(eq=False, repr=False)
class GetRequest(betterproto.Message):
    pass

    def __post_init__(self) -> None:
        super().__post_init__()


@dataclass(eq=False, repr=False)
class GetResponse(betterproto.Message):
    sessions: Dict[str, "Session"] = betterproto.map_field(
        1, betterproto.TYPE_STRING, betterproto.TYPE_MESSAGE
    )

    def __post_init__(self) -> None:
        super().__post_init__()


@dataclass(eq=False, repr=False)
class Session(betterproto.Message):
    session_id: str = betterproto.string_field(1)
    alive: bool = betterproto.bool_field(2)
    operations: Dict[str, "Operation"] = betterproto.map_field(
        3, betterproto.TYPE_STRING, betterproto.TYPE_MESSAGE
    )

    def __post_init__(self) -> None:
        super().__post_init__()


@dataclass(eq=False, repr=False)
class Operation(betterproto.Message):
    name: str = betterproto.string_field(1)
    timestamp: int = betterproto.uint64_field(2)
    namespace: str = betterproto.string_field(3)
    status: bool = betterproto.bool_field(4)

    def __post_init__(self) -> None:
        super().__post_init__()


class NetconfSessionsStub(betterproto.ServiceStub):
    async def list(self) -> "GetResponse":

        request = GetRequest()

        return await self._unary_unary(
            "/onos.o1t.NetconfSessions/List", request, GetResponse
        )

    async def watch(self) -> AsyncIterator["GetResponse"]:

        request = GetRequest()

        async for response in self._unary_stream(
            "/onos.o1t.NetconfSessions/Watch",
            request,
            GetResponse,
        ):
            yield response
