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

import betterproto
import grpclib


@dataclass(eq=False, repr=False)
class ConfigModel(betterproto.Message):
    name: str = betterproto.string_field(1)
    version: str = betterproto.string_field(2)
    modules: List["ConfigModule"] = betterproto.message_field(3)
    files: Dict[str, str] = betterproto.map_field(
        4, betterproto.TYPE_STRING, betterproto.TYPE_STRING
    )

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


@dataclass(eq=False, repr=False)
class ConfigModule(betterproto.Message):
    name: str = betterproto.string_field(1)
    file: str = betterproto.string_field(2)
    revision: str = betterproto.string_field(3)
    organization: str = betterproto.string_field(4)

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


@dataclass(eq=False, repr=False)
class GetModelRequest(betterproto.Message):
    name: str = betterproto.string_field(1)
    version: str = betterproto.string_field(2)

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


@dataclass(eq=False, repr=False)
class GetModelResponse(betterproto.Message):
    model: "ConfigModel" = betterproto.message_field(1)

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


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

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


@dataclass(eq=False, repr=False)
class ListModelsResponse(betterproto.Message):
    models: List["ConfigModel"] = betterproto.message_field(1)

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


@dataclass(eq=False, repr=False)
class PushModelRequest(betterproto.Message):
    model: "ConfigModel" = betterproto.message_field(1)

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


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

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


@dataclass(eq=False, repr=False)
class DeleteModelRequest(betterproto.Message):
    name: str = betterproto.string_field(1)
    version: str = betterproto.string_field(2)

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


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

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


class ConfigModelRegistryServiceStub(betterproto.ServiceStub):
    async def get_model(
        self, *, name: str = "", version: str = ""
    ) -> "GetModelResponse":

        request = GetModelRequest()
        request.name = name
        request.version = version

        return await self._unary_unary(
            "/onos.configmodel.ConfigModelRegistryService/GetModel",
            request,
            GetModelResponse,
        )

    async def list_models(self) -> "ListModelsResponse":

        request = ListModelsRequest()

        return await self._unary_unary(
            "/onos.configmodel.ConfigModelRegistryService/ListModels",
            request,
            ListModelsResponse,
        )

    async def push_model(self, *, model: "ConfigModel" = None) -> "PushModelResponse":

        request = PushModelRequest()
        if model is not None:
            request.model = model

        return await self._unary_unary(
            "/onos.configmodel.ConfigModelRegistryService/PushModel",
            request,
            PushModelResponse,
        )

    async def delete_model(
        self, *, name: str = "", version: str = ""
    ) -> "DeleteModelResponse":

        request = DeleteModelRequest()
        request.name = name
        request.version = version

        return await self._unary_unary(
            "/onos.configmodel.ConfigModelRegistryService/DeleteModel",
            request,
            DeleteModelResponse,
        )
