# 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 . import api_pb2 as confidence_dot_flags_dot_resolver_dot_v1_dot_api__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 confidence/flags/resolver/v1/api_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 FlagResolverServiceStub(object):
    """Simplified from confidence-resolver/protos/confidence/flags/resolver/v1/api.proto
    and confidence-resolver/protos/confidence/flags/types/v1/types.proto
    Annotations removed for minimal dependencies
    """

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

        Args:
            channel: A grpc.Channel.
        """
        self.ResolveFlags = channel.unary_unary(
                '/confidence.flags.resolver.v1.FlagResolverService/ResolveFlags',
                request_serializer=confidence_dot_flags_dot_resolver_dot_v1_dot_api__pb2.ResolveFlagsRequest.SerializeToString,
                response_deserializer=confidence_dot_flags_dot_resolver_dot_v1_dot_api__pb2.ResolveFlagsResponse.FromString,
                _registered_method=True)


class FlagResolverServiceServicer(object):
    """Simplified from confidence-resolver/protos/confidence/flags/resolver/v1/api.proto
    and confidence-resolver/protos/confidence/flags/types/v1/types.proto
    Annotations removed for minimal dependencies
    """

    def ResolveFlags(self, request, context):
        """Resolve multiple flags into variants and values. This method resolves
        all flags that are enabled for the given client, or a subset of them
        specified in the request.
        A flag is resolved by evaluating its rules in order, a rule matches if:
        1) it is enabled, 2) the referred segment is active, and 3) the
        randomization unit is in the population indicated by the segment's
        targeting criteria and population allocation. The first rule that matches
        will assign a variant and value to the unit. Archived flags are not included.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')


def add_FlagResolverServiceServicer_to_server(servicer, server):
    rpc_method_handlers = {
            'ResolveFlags': grpc.unary_unary_rpc_method_handler(
                    servicer.ResolveFlags,
                    request_deserializer=confidence_dot_flags_dot_resolver_dot_v1_dot_api__pb2.ResolveFlagsRequest.FromString,
                    response_serializer=confidence_dot_flags_dot_resolver_dot_v1_dot_api__pb2.ResolveFlagsResponse.SerializeToString,
            ),
    }
    generic_handler = grpc.method_handlers_generic_handler(
            'confidence.flags.resolver.v1.FlagResolverService', rpc_method_handlers)
    server.add_generic_rpc_handlers((generic_handler,))
    server.add_registered_method_handlers('confidence.flags.resolver.v1.FlagResolverService', rpc_method_handlers)


 # This class is part of an EXPERIMENTAL API.
class FlagResolverService(object):
    """Simplified from confidence-resolver/protos/confidence/flags/resolver/v1/api.proto
    and confidence-resolver/protos/confidence/flags/types/v1/types.proto
    Annotations removed for minimal dependencies
    """

    @staticmethod
    def ResolveFlags(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,
            '/confidence.flags.resolver.v1.FlagResolverService/ResolveFlags',
            confidence_dot_flags_dot_resolver_dot_v1_dot_api__pb2.ResolveFlagsRequest.SerializeToString,
            confidence_dot_flags_dot_resolver_dot_v1_dot_api__pb2.ResolveFlagsResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)
