# Code generated by protoc-gen-protorpc-py. DO NOT EDIT.
#
# plugin: https://github.com/chai2010/protorpc/protoc-gen-plugin
# plugin: https://github.com/chai2010/protorpc-py/protoc-gen-protorpc-py
#
# source: gpyrpc.proto

import abc
import sys
import typing

from google.protobuf import message as _message

from .protorpc import ServiceMeta as _ServiceMeta
from .protorpc import Server as _Server

from .gpyrpc_pb2 import (
    Complete_Args,
    Complete_Result,
    DocumentSymbol_Args,
    DocumentSymbol_Result,
    EvalCode_Args,
    EvalCode_Result,
    ExecProgram_Args,
    ExecProgram_Result,
    FormatCode_Args,
    FormatCode_Result,
    FormatPath_Args,
    FormatPath_Result,
    GetSchemaTypeMapping_Args,
    GetSchemaTypeMapping_Result,
    GetSchemaType_Args,
    GetSchemaType_Result,
    GoToDef_Args,
    GoToDef_Result,
    Hover_Args,
    Hover_Result,
    LintPath_Args,
    LintPath_Result,
    ListDepFiles_Args,
    ListDepFiles_Result,
    ListMethod_Args,
    ListMethod_Result,
    LoadSettingsFiles_Args,
    LoadSettingsFiles_Result,
    OverrideFile_Args,
    OverrideFile_Result,
    ParseFile_AST_Args,
    ParseFile_AST_Result,
    ParseFile_LarkTree_Args,
    ParseFile_LarkTree_Result,
    ParseProgram_AST_Args,
    ParseProgram_AST_Result,
    Ping_Args,
    Ping_Result,
    ResetPlugin_Args,
    ResetPlugin_Result,
    ResolveCode_Args,
    ResolveCode_Result,
    SpliceCode_Args,
    SpliceCode_Result,
    ValidateCode_Args,
    ValidateCode_Result,
)


class BuiltinService(metaclass=abc.ABCMeta):
    @abc.abstractmethod
    def Ping(self, args: Ping_Args) -> Ping_Result:
        pass

    @abc.abstractmethod
    def ListMethod(self, args: ListMethod_Args) -> ListMethod_Result:
        pass


class KclvmService(metaclass=abc.ABCMeta):
    @abc.abstractmethod
    def Ping(self, args: Ping_Args) -> Ping_Result:
        pass

    @abc.abstractmethod
    def ParseFile_LarkTree(
        self, args: ParseFile_LarkTree_Args
    ) -> ParseFile_LarkTree_Result:
        pass

    @abc.abstractmethod
    def ParseFile_AST(self, args: ParseFile_AST_Args) -> ParseFile_AST_Result:
        pass

    @abc.abstractmethod
    def ParseProgram_AST(self, args: ParseProgram_AST_Args) -> ParseProgram_AST_Result:
        pass

    @abc.abstractmethod
    def ExecProgram(self, args: ExecProgram_Args) -> ExecProgram_Result:
        pass

    @abc.abstractmethod
    def ResetPlugin(self, args: ResetPlugin_Args) -> ResetPlugin_Result:
        pass

    @abc.abstractmethod
    def FormatCode(self, args: FormatCode_Args) -> FormatCode_Result:
        pass

    @abc.abstractmethod
    def FormatPath(self, args: FormatPath_Args) -> FormatPath_Result:
        pass

    @abc.abstractmethod
    def LintPath(self, args: LintPath_Args) -> LintPath_Result:
        pass

    @abc.abstractmethod
    def OverrideFile(self, args: OverrideFile_Args) -> OverrideFile_Result:
        pass

    @abc.abstractmethod
    def EvalCode(self, args: EvalCode_Args) -> EvalCode_Result:
        pass

    @abc.abstractmethod
    def ResolveCode(self, args: ResolveCode_Args) -> ResolveCode_Result:
        pass

    @abc.abstractmethod
    def GetSchemaType(self, args: GetSchemaType_Args) -> GetSchemaType_Result:
        pass

    @abc.abstractmethod
    def GetSchemaTypeMapping(
        self, args: GetSchemaTypeMapping_Args
    ) -> GetSchemaTypeMapping_Result:
        pass

    @abc.abstractmethod
    def ValidateCode(self, args: ValidateCode_Args) -> ValidateCode_Result:
        pass

    @abc.abstractmethod
    def SpliceCode(self, args: SpliceCode_Args) -> SpliceCode_Result:
        pass

    @abc.abstractmethod
    def Complete(self, args: Complete_Args) -> Complete_Result:
        pass

    @abc.abstractmethod
    def GoToDef(self, args: GoToDef_Args) -> GoToDef_Result:
        pass

    @abc.abstractmethod
    def DocumentSymbol(self, args: DocumentSymbol_Args) -> DocumentSymbol_Result:
        pass

    @abc.abstractmethod
    def Hover(self, args: Hover_Args) -> Hover_Result:
        pass

    @abc.abstractmethod
    def ListDepFiles(self, args: ListDepFiles_Args) -> ListDepFiles_Result:
        pass

    @abc.abstractmethod
    def LoadSettingsFiles(
        self, args: LoadSettingsFiles_Args
    ) -> LoadSettingsFiles_Result:
        pass


class BuiltinService_Meta(_ServiceMeta):
    def __init__(self, instance: BuiltinService):
        super().__init__()
        self._instance = instance

    def get_service_name(self) -> str:
        return "BuiltinService"

    def get_method_list(self) -> typing.List[str]:
        return [
            "Ping",
            "ListMethod",
        ]

    def create_method_req_message(self, method: str) -> _message.Message:
        if method in ["Ping", "BuiltinService.Ping"]:
            return Ping_Args()
        if method in ["ListMethod", "BuiltinService.ListMethod"]:
            return ListMethod_Args()
        raise Exception(f"unknown method: {method}")

    def create_method_resp_message(self, method: str) -> _message.Message:
        if method in ["Ping", "BuiltinService.Ping"]:
            return Ping_Result()
        if method in ["ListMethod", "BuiltinService.ListMethod"]:
            return ListMethod_Result()
        raise Exception(f"unknown method: {method}")

    def get_service_instance(self) -> _message.Message:
        return typing.cast(_message.Message, self._instance)

    def call_method(self, method: str, req: _message.Message) -> _message.Message:
        if method in ["Ping", "BuiltinService.Ping"]:
            return self._instance.Ping(req)
        if method in ["ListMethod", "BuiltinService.ListMethod"]:
            return self._instance.ListMethod(req)
        raise Exception(f"unknown method: {method}")


class KclvmService_Meta(_ServiceMeta):
    def __init__(self, instance: KclvmService):
        super().__init__()
        self._instance = instance

    def get_service_name(self) -> str:
        return "KclvmService"

    def get_method_list(self) -> typing.List[str]:
        return [
            "Ping",
            "ParseFile_LarkTree",
            "ParseFile_AST",
            "ParseProgram_AST",
            "ExecProgram",
            "ResetPlugin",
            "FormatCode",
            "FormatPath",
            "LintPath",
            "OverrideFile",
            "EvalCode",
            "ResolveCode",
            "GetSchemaType",
            "GetSchemaTypeMapping",
            "ValidateCode",
            "SpliceCode",
            "Complete",
            "GoToDef",
            "DocumentSymbol",
            "Hover",
            "ListDepFiles",
            "LoadSettingsFiles",
        ]

    def create_method_req_message(self, method: str) -> _message.Message:
        if method in ["Ping", "KclvmService.Ping"]:
            return Ping_Args()
        if method in ["ParseFile_LarkTree", "KclvmService.ParseFile_LarkTree"]:
            return ParseFile_LarkTree_Args()
        if method in ["ParseFile_AST", "KclvmService.ParseFile_AST"]:
            return ParseFile_AST_Args()
        if method in ["ParseProgram_AST", "KclvmService.ParseProgram_AST"]:
            return ParseProgram_AST_Args()
        if method in ["ExecProgram", "KclvmService.ExecProgram"]:
            return ExecProgram_Args()
        if method in ["ResetPlugin", "KclvmService.ResetPlugin"]:
            return ResetPlugin_Args()
        if method in ["FormatCode", "KclvmService.FormatCode"]:
            return FormatCode_Args()
        if method in ["FormatPath", "KclvmService.FormatPath"]:
            return FormatPath_Args()
        if method in ["LintPath", "KclvmService.LintPath"]:
            return LintPath_Args()
        if method in ["OverrideFile", "KclvmService.OverrideFile"]:
            return OverrideFile_Args()
        if method in ["EvalCode", "KclvmService.EvalCode"]:
            return EvalCode_Args()
        if method in ["ResolveCode", "KclvmService.ResolveCode"]:
            return ResolveCode_Args()
        if method in ["GetSchemaType", "KclvmService.GetSchemaType"]:
            return GetSchemaType_Args()
        if method in ["GetSchemaTypeMapping", "KclvmService.GetSchemaTypeMapping"]:
            return GetSchemaTypeMapping_Args()
        if method in ["ValidateCode", "KclvmService.ValidateCode"]:
            return ValidateCode_Args()
        if method in ["SpliceCode", "KclvmService.SpliceCode"]:
            return SpliceCode_Args()
        if method in ["Complete", "KclvmService.Complete"]:
            return Complete_Args()
        if method in ["GoToDef", "KclvmService.GoToDef"]:
            return GoToDef_Args()
        if method in ["DocumentSymbol", "KclvmService.DocumentSymbol"]:
            return DocumentSymbol_Args()
        if method in ["Hover", "KclvmService.Hover"]:
            return Hover_Args()
        if method in ["ListDepFiles", "KclvmService.ListDepFiles"]:
            return ListDepFiles_Args()
        if method in ["LoadSettingsFiles", "KclvmService.LoadSettingsFiles"]:
            return LoadSettingsFiles_Args()
        raise Exception(f"unknown method: {method}")

    def create_method_resp_message(self, method: str) -> _message.Message:
        if method in ["Ping", "KclvmService.Ping"]:
            return Ping_Result()
        if method in ["ParseFile_LarkTree", "KclvmService.ParseFile_LarkTree"]:
            return ParseFile_LarkTree_Result()
        if method in ["ParseFile_AST", "KclvmService.ParseFile_AST"]:
            return ParseFile_AST_Result()
        if method in ["ParseProgram_AST", "KclvmService.ParseProgram_AST"]:
            return ParseProgram_AST_Result()
        if method in ["ExecProgram", "KclvmService.ExecProgram"]:
            return ExecProgram_Result()
        if method in ["ResetPlugin", "KclvmService.ResetPlugin"]:
            return ResetPlugin_Result()
        if method in ["FormatCode", "KclvmService.FormatCode"]:
            return FormatCode_Result()
        if method in ["FormatPath", "KclvmService.FormatPath"]:
            return FormatPath_Result()
        if method in ["LintPath", "KclvmService.LintPath"]:
            return LintPath_Result()
        if method in ["OverrideFile", "KclvmService.OverrideFile"]:
            return OverrideFile_Result()
        if method in ["EvalCode", "KclvmService.EvalCode"]:
            return EvalCode_Result()
        if method in ["ResolveCode", "KclvmService.ResolveCode"]:
            return ResolveCode_Result()
        if method in ["GetSchemaType", "KclvmService.GetSchemaType"]:
            return GetSchemaType_Result()
        if method in ["GetSchemaTypeMapping", "KclvmService.GetSchemaTypeMapping"]:
            return GetSchemaTypeMapping_Result()
        if method in ["ValidateCode", "KclvmService.ValidateCode"]:
            return ValidateCode_Result()
        if method in ["SpliceCode", "KclvmService.SpliceCode"]:
            return SpliceCode_Result()
        if method in ["Complete", "KclvmService.Complete"]:
            return Complete_Result()
        if method in ["GoToDef", "KclvmService.GoToDef"]:
            return GoToDef_Result()
        if method in ["DocumentSymbol", "KclvmService.DocumentSymbol"]:
            return DocumentSymbol_Result()
        if method in ["Hover", "KclvmService.Hover"]:
            return Hover_Result()
        if method in ["ListDepFiles", "KclvmService.ListDepFiles"]:
            return ListDepFiles_Result()
        if method in ["LoadSettingsFiles", "KclvmService.LoadSettingsFiles"]:
            return LoadSettingsFiles_Result()
        raise Exception(f"unknown method: {method}")

    def get_service_instance(self) -> _message.Message:
        return typing.cast(_message.Message, self._instance)

    def call_method(self, method: str, req: _message.Message) -> _message.Message:
        if method in ["Ping", "KclvmService.Ping"]:
            return self._instance.Ping(req)
        if method in ["ParseFile_LarkTree", "KclvmService.ParseFile_LarkTree"]:
            return self._instance.ParseFile_LarkTree(req)
        if method in ["ParseFile_AST", "KclvmService.ParseFile_AST"]:
            return self._instance.ParseFile_AST(req)
        if method in ["ParseProgram_AST", "KclvmService.ParseProgram_AST"]:
            return self._instance.ParseProgram_AST(req)
        if method in ["ExecProgram", "KclvmService.ExecProgram"]:
            return self._instance.ExecProgram(req)
        if method in ["ResetPlugin", "KclvmService.ResetPlugin"]:
            return self._instance.ResetPlugin(req)
        if method in ["FormatCode", "KclvmService.FormatCode"]:
            return self._instance.FormatCode(req)
        if method in ["FormatPath", "KclvmService.FormatPath"]:
            return self._instance.FormatPath(req)
        if method in ["LintPath", "KclvmService.LintPath"]:
            return self._instance.LintPath(req)
        if method in ["OverrideFile", "KclvmService.OverrideFile"]:
            return self._instance.OverrideFile(req)
        if method in ["EvalCode", "KclvmService.EvalCode"]:
            return self._instance.EvalCode(req)
        if method in ["ResolveCode", "KclvmService.ResolveCode"]:
            return self._instance.ResolveCode(req)
        if method in ["GetSchemaType", "KclvmService.GetSchemaType"]:
            return self._instance.GetSchemaType(req)
        if method in ["GetSchemaTypeMapping", "KclvmService.GetSchemaTypeMapping"]:
            return self._instance.GetSchemaTypeMapping(req)
        if method in ["ValidateCode", "KclvmService.ValidateCode"]:
            return self._instance.ValidateCode(req)
        if method in ["SpliceCode", "KclvmService.SpliceCode"]:
            return self._instance.SpliceCode(req)
        if method in ["Complete", "KclvmService.Complete"]:
            return self._instance.Complete(req)
        if method in ["GoToDef", "KclvmService.GoToDef"]:
            return self._instance.GoToDef(req)
        if method in ["DocumentSymbol", "KclvmService.DocumentSymbol"]:
            return self._instance.DocumentSymbol(req)
        if method in ["Hover", "KclvmService.Hover"]:
            return self._instance.Hover(req)
        if method in ["ListDepFiles", "KclvmService.ListDepFiles"]:
            return self._instance.ListDepFiles(req)
        if method in ["LoadSettingsFiles", "KclvmService.LoadSettingsFiles"]:
            return self._instance.LoadSettingsFiles(req)
        raise Exception(f"unknown method: {method}")


class BuiltinService_Server:
    def __init__(self, instance: BuiltinService):
        self.instance = instance

    def run(self, *, stdin=sys.stdin, stdout=sys.stdout):
        rpc_server = _Server()
        rpc_server.register_service(BuiltinService_Meta(self.instance))
        rpc_server.run(stdin=stdin, stdout=stdout)


class KclvmService_Server:
    def __init__(self, instance: KclvmService):
        self.instance = instance

    def run(self, *, stdin=sys.stdin, stdout=sys.stdout):
        rpc_server = _Server()
        rpc_server.register_service(KclvmService_Meta(self.instance))
        rpc_server.run(stdin=stdin, stdout=stdout)
