# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
import grpc

from speechly.sal.v1 import compiler_pb2 as speechly_dot_sal_dot_v1_dot_compiler__pb2


class CompilerStub(object):
  """The Speechly Compiler API is used for validating and compiling Speechly Annotation Language source files.

  The service requires a Speechly API token, which is obtained from Speechly Dashboard (https://speechly.com/dashboard).

  The token acts as a proxy for the user who has generated it,
  i.e. all operations are performed with that user as a subject.
  """

  def __init__(self, channel):
    """Constructor.

    Args:
      channel: A grpc.Channel.
    """
    self.Compile = channel.stream_unary(
        '/speechly.sal.v1.Compiler/Compile',
        request_serializer=speechly_dot_sal_dot_v1_dot_compiler__pb2.CompileRequest.SerializeToString,
        response_deserializer=speechly_dot_sal_dot_v1_dot_compiler__pb2.CompileResult.FromString,
        )
    self.Validate = channel.stream_unary(
        '/speechly.sal.v1.Compiler/Validate',
        request_serializer=speechly_dot_sal_dot_v1_dot_compiler__pb2.AppSource.SerializeToString,
        response_deserializer=speechly_dot_sal_dot_v1_dot_compiler__pb2.ValidateResult.FromString,
        )
    self.ExtractSALSources = channel.stream_stream(
        '/speechly.sal.v1.Compiler/ExtractSALSources',
        request_serializer=speechly_dot_sal_dot_v1_dot_compiler__pb2.AppSource.SerializeToString,
        response_deserializer=speechly_dot_sal_dot_v1_dot_compiler__pb2.ExtractSALSourcesResult.FromString,
        )


class CompilerServicer(object):
  """The Speechly Compiler API is used for validating and compiling Speechly Annotation Language source files.

  The service requires a Speechly API token, which is obtained from Speechly Dashboard (https://speechly.com/dashboard).

  The token acts as a proxy for the user who has generated it,
  i.e. all operations are performed with that user as a subject.
  """

  def Compile(self, request_iterator, context):
    """Compiles the SAL source and returns compiled templates and / or any compilation errors and warnings.
    """
    context.set_code(grpc.StatusCode.UNIMPLEMENTED)
    context.set_details('Method not implemented!')
    raise NotImplementedError('Method not implemented!')

  def Validate(self, request_iterator, context):
    """Validates the SAL source and returns compilation notices / warnings and errors, if any.
    """
    context.set_code(grpc.StatusCode.UNIMPLEMENTED)
    context.set_details('Method not implemented!')
    raise NotImplementedError('Method not implemented!')

  def ExtractSALSources(self, request_iterator, context):
    """Extracts raw, not compiled SAL templates from the SAL source.
    """
    context.set_code(grpc.StatusCode.UNIMPLEMENTED)
    context.set_details('Method not implemented!')
    raise NotImplementedError('Method not implemented!')


def add_CompilerServicer_to_server(servicer, server):
  rpc_method_handlers = {
      'Compile': grpc.stream_unary_rpc_method_handler(
          servicer.Compile,
          request_deserializer=speechly_dot_sal_dot_v1_dot_compiler__pb2.CompileRequest.FromString,
          response_serializer=speechly_dot_sal_dot_v1_dot_compiler__pb2.CompileResult.SerializeToString,
      ),
      'Validate': grpc.stream_unary_rpc_method_handler(
          servicer.Validate,
          request_deserializer=speechly_dot_sal_dot_v1_dot_compiler__pb2.AppSource.FromString,
          response_serializer=speechly_dot_sal_dot_v1_dot_compiler__pb2.ValidateResult.SerializeToString,
      ),
      'ExtractSALSources': grpc.stream_stream_rpc_method_handler(
          servicer.ExtractSALSources,
          request_deserializer=speechly_dot_sal_dot_v1_dot_compiler__pb2.AppSource.FromString,
          response_serializer=speechly_dot_sal_dot_v1_dot_compiler__pb2.ExtractSALSourcesResult.SerializeToString,
      ),
  }
  generic_handler = grpc.method_handlers_generic_handler(
      'speechly.sal.v1.Compiler', rpc_method_handlers)
  server.add_generic_rpc_handlers((generic_handler,))
