# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
"""Client and server classes corresponding to protobuf-defined services."""
import grpc
import warnings

from qubitos.proto.quantum.backend.v1 import execution_pb2 as quantum_dot_backend_dot_v1_dot_execution__pb2
from qubitos.proto.quantum.backend.v1 import hardware_pb2 as quantum_dot_backend_dot_v1_dot_hardware__pb2
from qubitos.proto.quantum.backend.v1 import service_pb2 as quantum_dot_backend_dot_v1_dot_service__pb2

GRPC_GENERATED_VERSION = '1.76.0'
GRPC_VERSION = grpc.__version__
_version_not_supported = False

try:
    from grpc._utilities import first_version_is_lower
    _version_not_supported = first_version_is_lower(GRPC_VERSION, GRPC_GENERATED_VERSION)
except ImportError:
    _version_not_supported = True

if _version_not_supported:
    raise RuntimeError(
        f'The grpc package installed is at version {GRPC_VERSION},'
        + ' but the generated code in quantum/backend/v1/service_pb2_grpc.py depends on'
        + f' grpcio>={GRPC_GENERATED_VERSION}.'
        + f' Please upgrade your grpc module to grpcio>={GRPC_GENERATED_VERSION}'
        + f' or downgrade your generated code using grpcio-tools<={GRPC_VERSION}.'
    )


class QuantumBackendServiceStub(object):
    """QuantumBackendService provides access to quantum hardware and simulators.

    This is the primary interface for executing pulses and querying backend
    capabilities. All pulse execution flows through this service.

    Supported backends:
    - qutip_simulator: Local QuTiP-based simulator (always available)
    - iqm_garnet: IQM Garnet quantum processor (requires credentials)
    """

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

        Args:
            channel: A grpc.Channel.
        """
        self.ExecutePulse = channel.unary_unary(
                '/quantum.backend.v1.QuantumBackendService/ExecutePulse',
                request_serializer=quantum_dot_backend_dot_v1_dot_execution__pb2.ExecutePulseRequest.SerializeToString,
                response_deserializer=quantum_dot_backend_dot_v1_dot_execution__pb2.ExecutePulseResponse.FromString,
                _registered_method=True)
        self.ExecutePulseBatch = channel.unary_unary(
                '/quantum.backend.v1.QuantumBackendService/ExecutePulseBatch',
                request_serializer=quantum_dot_backend_dot_v1_dot_execution__pb2.ExecutePulseBatchRequest.SerializeToString,
                response_deserializer=quantum_dot_backend_dot_v1_dot_execution__pb2.ExecutePulseBatchResponse.FromString,
                _registered_method=True)
        self.GetHardwareInfo = channel.unary_unary(
                '/quantum.backend.v1.QuantumBackendService/GetHardwareInfo',
                request_serializer=quantum_dot_backend_dot_v1_dot_hardware__pb2.GetHardwareInfoRequest.SerializeToString,
                response_deserializer=quantum_dot_backend_dot_v1_dot_hardware__pb2.GetHardwareInfoResponse.FromString,
                _registered_method=True)
        self.Health = channel.unary_unary(
                '/quantum.backend.v1.QuantumBackendService/Health',
                request_serializer=quantum_dot_backend_dot_v1_dot_hardware__pb2.HealthRequest.SerializeToString,
                response_deserializer=quantum_dot_backend_dot_v1_dot_hardware__pb2.HealthResponse.FromString,
                _registered_method=True)
        self.ListBackends = channel.unary_unary(
                '/quantum.backend.v1.QuantumBackendService/ListBackends',
                request_serializer=quantum_dot_backend_dot_v1_dot_service__pb2.ListBackendsRequest.SerializeToString,
                response_deserializer=quantum_dot_backend_dot_v1_dot_service__pb2.ListBackendsResponse.FromString,
                _registered_method=True)


class QuantumBackendServiceServicer(object):
    """QuantumBackendService provides access to quantum hardware and simulators.

    This is the primary interface for executing pulses and querying backend
    capabilities. All pulse execution flows through this service.

    Supported backends:
    - qutip_simulator: Local QuTiP-based simulator (always available)
    - iqm_garnet: IQM Garnet quantum processor (requires credentials)
    """

    def ExecutePulse(self, request, context):
        """Execute a single pulse on the specified backend.

        The pulse is validated before execution. If validation fails,
        returns INVALID_ARGUMENT error.

        For simulators: returns measurement samples from the final state.
        For hardware: submits to queue and returns when complete.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def ExecutePulseBatch(self, request, context):
        """Execute multiple pulses in a batch.

        More efficient than individual calls when running many pulses.
        Can optionally stop on first error or continue despite failures.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def GetHardwareInfo(self, request, context):
        """Get detailed information about a backend.

        Returns capabilities, resource limits, connectivity, and current status.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def Health(self, request, context):
        """Check health of a specific backend or all backends.

        Use for monitoring and to check availability before submitting jobs.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def ListBackends(self, request, context):
        """List all available backends.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')


def add_QuantumBackendServiceServicer_to_server(servicer, server):
    rpc_method_handlers = {
            'ExecutePulse': grpc.unary_unary_rpc_method_handler(
                    servicer.ExecutePulse,
                    request_deserializer=quantum_dot_backend_dot_v1_dot_execution__pb2.ExecutePulseRequest.FromString,
                    response_serializer=quantum_dot_backend_dot_v1_dot_execution__pb2.ExecutePulseResponse.SerializeToString,
            ),
            'ExecutePulseBatch': grpc.unary_unary_rpc_method_handler(
                    servicer.ExecutePulseBatch,
                    request_deserializer=quantum_dot_backend_dot_v1_dot_execution__pb2.ExecutePulseBatchRequest.FromString,
                    response_serializer=quantum_dot_backend_dot_v1_dot_execution__pb2.ExecutePulseBatchResponse.SerializeToString,
            ),
            'GetHardwareInfo': grpc.unary_unary_rpc_method_handler(
                    servicer.GetHardwareInfo,
                    request_deserializer=quantum_dot_backend_dot_v1_dot_hardware__pb2.GetHardwareInfoRequest.FromString,
                    response_serializer=quantum_dot_backend_dot_v1_dot_hardware__pb2.GetHardwareInfoResponse.SerializeToString,
            ),
            'Health': grpc.unary_unary_rpc_method_handler(
                    servicer.Health,
                    request_deserializer=quantum_dot_backend_dot_v1_dot_hardware__pb2.HealthRequest.FromString,
                    response_serializer=quantum_dot_backend_dot_v1_dot_hardware__pb2.HealthResponse.SerializeToString,
            ),
            'ListBackends': grpc.unary_unary_rpc_method_handler(
                    servicer.ListBackends,
                    request_deserializer=quantum_dot_backend_dot_v1_dot_service__pb2.ListBackendsRequest.FromString,
                    response_serializer=quantum_dot_backend_dot_v1_dot_service__pb2.ListBackendsResponse.SerializeToString,
            ),
    }
    generic_handler = grpc.method_handlers_generic_handler(
            'quantum.backend.v1.QuantumBackendService', rpc_method_handlers)
    server.add_generic_rpc_handlers((generic_handler,))
    server.add_registered_method_handlers('quantum.backend.v1.QuantumBackendService', rpc_method_handlers)


 # This class is part of an EXPERIMENTAL API.
class QuantumBackendService(object):
    """QuantumBackendService provides access to quantum hardware and simulators.

    This is the primary interface for executing pulses and querying backend
    capabilities. All pulse execution flows through this service.

    Supported backends:
    - qutip_simulator: Local QuTiP-based simulator (always available)
    - iqm_garnet: IQM Garnet quantum processor (requires credentials)
    """

    @staticmethod
    def ExecutePulse(request,
            target,
            options=(),
            channel_credentials=None,
            call_credentials=None,
            insecure=False,
            compression=None,
            wait_for_ready=None,
            timeout=None,
            metadata=None):
        return grpc.experimental.unary_unary(
            request,
            target,
            '/quantum.backend.v1.QuantumBackendService/ExecutePulse',
            quantum_dot_backend_dot_v1_dot_execution__pb2.ExecutePulseRequest.SerializeToString,
            quantum_dot_backend_dot_v1_dot_execution__pb2.ExecutePulseResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def ExecutePulseBatch(request,
            target,
            options=(),
            channel_credentials=None,
            call_credentials=None,
            insecure=False,
            compression=None,
            wait_for_ready=None,
            timeout=None,
            metadata=None):
        return grpc.experimental.unary_unary(
            request,
            target,
            '/quantum.backend.v1.QuantumBackendService/ExecutePulseBatch',
            quantum_dot_backend_dot_v1_dot_execution__pb2.ExecutePulseBatchRequest.SerializeToString,
            quantum_dot_backend_dot_v1_dot_execution__pb2.ExecutePulseBatchResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def GetHardwareInfo(request,
            target,
            options=(),
            channel_credentials=None,
            call_credentials=None,
            insecure=False,
            compression=None,
            wait_for_ready=None,
            timeout=None,
            metadata=None):
        return grpc.experimental.unary_unary(
            request,
            target,
            '/quantum.backend.v1.QuantumBackendService/GetHardwareInfo',
            quantum_dot_backend_dot_v1_dot_hardware__pb2.GetHardwareInfoRequest.SerializeToString,
            quantum_dot_backend_dot_v1_dot_hardware__pb2.GetHardwareInfoResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def Health(request,
            target,
            options=(),
            channel_credentials=None,
            call_credentials=None,
            insecure=False,
            compression=None,
            wait_for_ready=None,
            timeout=None,
            metadata=None):
        return grpc.experimental.unary_unary(
            request,
            target,
            '/quantum.backend.v1.QuantumBackendService/Health',
            quantum_dot_backend_dot_v1_dot_hardware__pb2.HealthRequest.SerializeToString,
            quantum_dot_backend_dot_v1_dot_hardware__pb2.HealthResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def ListBackends(request,
            target,
            options=(),
            channel_credentials=None,
            call_credentials=None,
            insecure=False,
            compression=None,
            wait_for_ready=None,
            timeout=None,
            metadata=None):
        return grpc.experimental.unary_unary(
            request,
            target,
            '/quantum.backend.v1.QuantumBackendService/ListBackends',
            quantum_dot_backend_dot_v1_dot_service__pb2.ListBackendsRequest.SerializeToString,
            quantum_dot_backend_dot_v1_dot_service__pb2.ListBackendsResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)
