# 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 terrascope_api.models import credit_pb2 as credit__pb2

GRPC_GENERATED_VERSION = '1.66.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},'
        + f' but the generated code in credit_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 CreditApiStub(object):
    """Missing associated documentation comment in .proto file."""

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

        Args:
            channel: A grpc.Channel.
        """
        self.add = channel.unary_unary(
                '/oi.papi.credit.CreditApi/add',
                request_serializer=credit__pb2.CreditAddRequest.SerializeToString,
                response_deserializer=credit__pb2.CreditAddResponse.FromString,
                _registered_method=True)
        self.remove = channel.unary_unary(
                '/oi.papi.credit.CreditApi/remove',
                request_serializer=credit__pb2.CreditRemoveRequest.SerializeToString,
                response_deserializer=credit__pb2.CreditRemoveResponse.FromString,
                _registered_method=True)
        self.refund = channel.unary_unary(
                '/oi.papi.credit.CreditApi/refund',
                request_serializer=credit__pb2.CreditRefundRequest.SerializeToString,
                response_deserializer=credit__pb2.CreditRefundResponse.FromString,
                _registered_method=True)
        self.set_algorithm = channel.unary_unary(
                '/oi.papi.credit.CreditApi/set_algorithm',
                request_serializer=credit__pb2.CreditAlgorithmMultiplierSetRequest.SerializeToString,
                response_deserializer=credit__pb2.CreditAlgorithmMultiplierSetResponse.FromString,
                _registered_method=True)
        self.set_data_source = channel.unary_unary(
                '/oi.papi.credit.CreditApi/set_data_source',
                request_serializer=credit__pb2.CreditDataSourceMultiplierSetRequest.SerializeToString,
                response_deserializer=credit__pb2.CreditDataSourceMultiplierSetResponse.FromString,
                _registered_method=True)
        self.estimate = channel.unary_unary(
                '/oi.papi.credit.CreditApi/estimate',
                request_serializer=credit__pb2.CreditEstimateRequest.SerializeToString,
                response_deserializer=credit__pb2.CreditEstimateResponse.FromString,
                _registered_method=True)
        self.summary = channel.unary_unary(
                '/oi.papi.credit.CreditApi/summary',
                request_serializer=credit__pb2.CreditSummaryRequest.SerializeToString,
                response_deserializer=credit__pb2.CreditSummaryResponse.FromString,
                _registered_method=True)
        self.transactions = channel.unary_unary(
                '/oi.papi.credit.CreditApi/transactions',
                request_serializer=credit__pb2.CreditTransactionsRequest.SerializeToString,
                response_deserializer=credit__pb2.CreditTransactionsResponse.FromString,
                _registered_method=True)


class CreditApiServicer(object):
    """Missing associated documentation comment in .proto file."""

    def add(self, request, context):
        """
        Add credits to the specified CreditSource (department). Currently, this can only be done at the department level by an Admin user.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def remove(self, request, context):
        """
        Removes credits from a department. Currently, this can only be done at the department level.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def refund(self, request, context):
        """
        Refunds credits to a department. This can only be done by an admin user.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def set_algorithm(self, request, context):
        """
        Assign a price to the specified Algorithm. Price must be a multiple of $0.001. This can only be done by an admin user.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def set_data_source(self, request, context):
        """
        Assign a price to the specified DataSource. Price must be a multiple of $0.001. This can only be done by an admin user.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def estimate(self, request, context):
        """
        Returns an estimate of the credits required to compute results for the specified Algorithm.
        Estimates the full cost, including open orders based on the ending date of the specified TOI.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def summary(self, request, context):
        """
        Retrieves the credit summary for the specified user's department.
        As credits are associated with a department, all users of the a department see the same credit summary.
        Currently, this can only be done at the department level.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def transactions(self, request, context):
        """
        Retrieves the detailed view of all Transactions associated with a department.
        Can filter for a time range or Transaction type. Currently, this can only be done at the department level.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')


def add_CreditApiServicer_to_server(servicer, server):
    rpc_method_handlers = {
            'add': grpc.unary_unary_rpc_method_handler(
                    servicer.add,
                    request_deserializer=credit__pb2.CreditAddRequest.FromString,
                    response_serializer=credit__pb2.CreditAddResponse.SerializeToString,
            ),
            'remove': grpc.unary_unary_rpc_method_handler(
                    servicer.remove,
                    request_deserializer=credit__pb2.CreditRemoveRequest.FromString,
                    response_serializer=credit__pb2.CreditRemoveResponse.SerializeToString,
            ),
            'refund': grpc.unary_unary_rpc_method_handler(
                    servicer.refund,
                    request_deserializer=credit__pb2.CreditRefundRequest.FromString,
                    response_serializer=credit__pb2.CreditRefundResponse.SerializeToString,
            ),
            'set_algorithm': grpc.unary_unary_rpc_method_handler(
                    servicer.set_algorithm,
                    request_deserializer=credit__pb2.CreditAlgorithmMultiplierSetRequest.FromString,
                    response_serializer=credit__pb2.CreditAlgorithmMultiplierSetResponse.SerializeToString,
            ),
            'set_data_source': grpc.unary_unary_rpc_method_handler(
                    servicer.set_data_source,
                    request_deserializer=credit__pb2.CreditDataSourceMultiplierSetRequest.FromString,
                    response_serializer=credit__pb2.CreditDataSourceMultiplierSetResponse.SerializeToString,
            ),
            'estimate': grpc.unary_unary_rpc_method_handler(
                    servicer.estimate,
                    request_deserializer=credit__pb2.CreditEstimateRequest.FromString,
                    response_serializer=credit__pb2.CreditEstimateResponse.SerializeToString,
            ),
            'summary': grpc.unary_unary_rpc_method_handler(
                    servicer.summary,
                    request_deserializer=credit__pb2.CreditSummaryRequest.FromString,
                    response_serializer=credit__pb2.CreditSummaryResponse.SerializeToString,
            ),
            'transactions': grpc.unary_unary_rpc_method_handler(
                    servicer.transactions,
                    request_deserializer=credit__pb2.CreditTransactionsRequest.FromString,
                    response_serializer=credit__pb2.CreditTransactionsResponse.SerializeToString,
            ),
    }
    generic_handler = grpc.method_handlers_generic_handler(
            'oi.papi.credit.CreditApi', rpc_method_handlers)
    server.add_generic_rpc_handlers((generic_handler,))
    server.add_registered_method_handlers('oi.papi.credit.CreditApi', rpc_method_handlers)


 # This class is part of an EXPERIMENTAL API.
class CreditApi(object):
    """Missing associated documentation comment in .proto file."""

    @staticmethod
    def add(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,
            '/oi.papi.credit.CreditApi/add',
            credit__pb2.CreditAddRequest.SerializeToString,
            credit__pb2.CreditAddResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def remove(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,
            '/oi.papi.credit.CreditApi/remove',
            credit__pb2.CreditRemoveRequest.SerializeToString,
            credit__pb2.CreditRemoveResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def refund(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,
            '/oi.papi.credit.CreditApi/refund',
            credit__pb2.CreditRefundRequest.SerializeToString,
            credit__pb2.CreditRefundResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def set_algorithm(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,
            '/oi.papi.credit.CreditApi/set_algorithm',
            credit__pb2.CreditAlgorithmMultiplierSetRequest.SerializeToString,
            credit__pb2.CreditAlgorithmMultiplierSetResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def set_data_source(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,
            '/oi.papi.credit.CreditApi/set_data_source',
            credit__pb2.CreditDataSourceMultiplierSetRequest.SerializeToString,
            credit__pb2.CreditDataSourceMultiplierSetResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def estimate(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,
            '/oi.papi.credit.CreditApi/estimate',
            credit__pb2.CreditEstimateRequest.SerializeToString,
            credit__pb2.CreditEstimateResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def summary(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,
            '/oi.papi.credit.CreditApi/summary',
            credit__pb2.CreditSummaryRequest.SerializeToString,
            credit__pb2.CreditSummaryResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def transactions(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,
            '/oi.papi.credit.CreditApi/transactions',
            credit__pb2.CreditTransactionsRequest.SerializeToString,
            credit__pb2.CreditTransactionsResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)
