# Copyright (c) 2017-2024 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
# fmt: off
# isort: skip_file
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
"""Client and server classes corresponding to protobuf-defined services."""
import grpc

from . import topology_aggregation_service_pb2 as com_dot_digitalasset_dot_canton_dot_topology_dot_admin_dot_v0_dot_topology__aggregation__service__pb2


class TopologyAggregationServiceStub(object):
    """*
    Topology information aggregation service

    This service allows deep inspection into the aggregated topology state.
    The services runs both on the domain and on the participant and uses the same
    data. The service provides GRPC access to the information aggregated by the identity providing
    service client.
    """

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

        Args:
            channel: A grpc.Channel.
        """
        self.ListParties = channel.unary_unary(
                '/com.digitalasset.canton.topology.admin.v0.TopologyAggregationService/ListParties',
                request_serializer=com_dot_digitalasset_dot_canton_dot_topology_dot_admin_dot_v0_dot_topology__aggregation__service__pb2.ListPartiesRequest.SerializeToString,
                response_deserializer=com_dot_digitalasset_dot_canton_dot_topology_dot_admin_dot_v0_dot_topology__aggregation__service__pb2.ListPartiesResponse.FromString,
                )
        self.ListKeyOwners = channel.unary_unary(
                '/com.digitalasset.canton.topology.admin.v0.TopologyAggregationService/ListKeyOwners',
                request_serializer=com_dot_digitalasset_dot_canton_dot_topology_dot_admin_dot_v0_dot_topology__aggregation__service__pb2.ListKeyOwnersRequest.SerializeToString,
                response_deserializer=com_dot_digitalasset_dot_canton_dot_topology_dot_admin_dot_v0_dot_topology__aggregation__service__pb2.ListKeyOwnersResponse.FromString,
                )


class TopologyAggregationServiceServicer(object):
    """*
    Topology information aggregation service

    This service allows deep inspection into the aggregated topology state.
    The services runs both on the domain and on the participant and uses the same
    data. The service provides GRPC access to the information aggregated by the identity providing
    service client.
    """

    def ListParties(self, request, context):
        """*
        Obtain information about a certain set of active parties matching a given filter criterion.

        The request allows to filter per (domain, party, asOf) where the domain and party argument are
        used in order to filter the result list using the `startsWith` method on the respective resulting string.

        As such, if you just need to do a lookup, then define a precise filter. Given the uniqueness of the
        identifiers (and the fact that the identifiers contain key fingerprints), we should only ever get a single
        result back if we are doing a precise lookup.

        The response is a sequence of tuples (party, domain, participant, privilege, trust-level).
        The response is restricted to active parties and their active participants.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def ListKeyOwners(self, request, context):
        """*
        Obtain key owner information matching a given filter criterion.

        Key owners in the system are different types of entities: Participant, Mediator, Domain Topology Manager and
        Sequencer. The present method allows to define a filter to search for a key owner
        using filters on (asOf, domain, ownerType, owner)

        The response is a sequence of (domain, ownerType, owner, keys) where keys is a sequence of
        (fingerprint, bytes, key purpose). As such, we can use this method to export currently used signing or encryption
        public keys.

        This method is quite general, as depending on the arguments, very different results can be obtained.

        Using OwnerType = 'Participant' allows to query for all participants.
        Using OwnerType = 'Sequencer' allows to query for all sequencers defined.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')


def add_TopologyAggregationServiceServicer_to_server(servicer, server):
    rpc_method_handlers = {
            'ListParties': grpc.unary_unary_rpc_method_handler(
                    servicer.ListParties,
                    request_deserializer=com_dot_digitalasset_dot_canton_dot_topology_dot_admin_dot_v0_dot_topology__aggregation__service__pb2.ListPartiesRequest.FromString,
                    response_serializer=com_dot_digitalasset_dot_canton_dot_topology_dot_admin_dot_v0_dot_topology__aggregation__service__pb2.ListPartiesResponse.SerializeToString,
            ),
            'ListKeyOwners': grpc.unary_unary_rpc_method_handler(
                    servicer.ListKeyOwners,
                    request_deserializer=com_dot_digitalasset_dot_canton_dot_topology_dot_admin_dot_v0_dot_topology__aggregation__service__pb2.ListKeyOwnersRequest.FromString,
                    response_serializer=com_dot_digitalasset_dot_canton_dot_topology_dot_admin_dot_v0_dot_topology__aggregation__service__pb2.ListKeyOwnersResponse.SerializeToString,
            ),
    }
    generic_handler = grpc.method_handlers_generic_handler(
            'com.digitalasset.canton.topology.admin.v0.TopologyAggregationService', rpc_method_handlers)
    server.add_generic_rpc_handlers((generic_handler,))


 # This class is part of an EXPERIMENTAL API.
class TopologyAggregationService(object):
    """*
    Topology information aggregation service

    This service allows deep inspection into the aggregated topology state.
    The services runs both on the domain and on the participant and uses the same
    data. The service provides GRPC access to the information aggregated by the identity providing
    service client.
    """

    @staticmethod
    def ListParties(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, '/com.digitalasset.canton.topology.admin.v0.TopologyAggregationService/ListParties',
            com_dot_digitalasset_dot_canton_dot_topology_dot_admin_dot_v0_dot_topology__aggregation__service__pb2.ListPartiesRequest.SerializeToString,
            com_dot_digitalasset_dot_canton_dot_topology_dot_admin_dot_v0_dot_topology__aggregation__service__pb2.ListPartiesResponse.FromString,
            options, channel_credentials,
            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)

    @staticmethod
    def ListKeyOwners(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, '/com.digitalasset.canton.topology.admin.v0.TopologyAggregationService/ListKeyOwners',
            com_dot_digitalasset_dot_canton_dot_topology_dot_admin_dot_v0_dot_topology__aggregation__service__pb2.ListKeyOwnersRequest.SerializeToString,
            com_dot_digitalasset_dot_canton_dot_topology_dot_admin_dot_v0_dot_topology__aggregation__service__pb2.ListKeyOwnersResponse.FromString,
            options, channel_credentials,
            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
