"""
@generated by mypy-protobuf.  Do not edit manually!
isort:skip_file
*
Flag definition sync API

This proto defines a simple API to synchronize a feature flag definition.
It supports establishing a stream for getting notifications about changes in a flag definition.
"""

import abc
import collections.abc
import grpc
import grpc.aio
import openfeature.schemas.protobuf.flagd.sync.v1.sync_pb2
import sys
import typing

if sys.version_info >= (3, 13):
    import typing as typing_extensions
else:
    import typing_extensions

_T = typing.TypeVar("_T")

class _MaybeAsyncIterator(collections.abc.AsyncIterator[_T], collections.abc.Iterator[_T], metaclass=abc.ABCMeta): ...

class _ServicerContext(grpc.ServicerContext, grpc.aio.ServicerContext):  # type: ignore[misc, type-arg]
    ...

GRPC_GENERATED_VERSION: str
GRPC_VERSION: str
_FlagSyncServiceSyncFlagsType = typing_extensions.TypeVar(
    '_FlagSyncServiceSyncFlagsType',
    grpc.UnaryStreamMultiCallable[
        openfeature.schemas.protobuf.flagd.sync.v1.sync_pb2.SyncFlagsRequest,
        openfeature.schemas.protobuf.flagd.sync.v1.sync_pb2.SyncFlagsResponse,
    ],
    grpc.aio.UnaryStreamMultiCallable[
        openfeature.schemas.protobuf.flagd.sync.v1.sync_pb2.SyncFlagsRequest,
        openfeature.schemas.protobuf.flagd.sync.v1.sync_pb2.SyncFlagsResponse,
    ],
    default=grpc.UnaryStreamMultiCallable[
        openfeature.schemas.protobuf.flagd.sync.v1.sync_pb2.SyncFlagsRequest,
        openfeature.schemas.protobuf.flagd.sync.v1.sync_pb2.SyncFlagsResponse,
    ],
)

_FlagSyncServiceFetchAllFlagsType = typing_extensions.TypeVar(
    '_FlagSyncServiceFetchAllFlagsType',
    grpc.UnaryUnaryMultiCallable[
        openfeature.schemas.protobuf.flagd.sync.v1.sync_pb2.FetchAllFlagsRequest,
        openfeature.schemas.protobuf.flagd.sync.v1.sync_pb2.FetchAllFlagsResponse,
    ],
    grpc.aio.UnaryUnaryMultiCallable[
        openfeature.schemas.protobuf.flagd.sync.v1.sync_pb2.FetchAllFlagsRequest,
        openfeature.schemas.protobuf.flagd.sync.v1.sync_pb2.FetchAllFlagsResponse,
    ],
    default=grpc.UnaryUnaryMultiCallable[
        openfeature.schemas.protobuf.flagd.sync.v1.sync_pb2.FetchAllFlagsRequest,
        openfeature.schemas.protobuf.flagd.sync.v1.sync_pb2.FetchAllFlagsResponse,
    ],
)

_FlagSyncServiceGetMetadataType = typing_extensions.TypeVar(
    '_FlagSyncServiceGetMetadataType',
    grpc.UnaryUnaryMultiCallable[
        openfeature.schemas.protobuf.flagd.sync.v1.sync_pb2.GetMetadataRequest,
        openfeature.schemas.protobuf.flagd.sync.v1.sync_pb2.GetMetadataResponse,
    ],
    grpc.aio.UnaryUnaryMultiCallable[
        openfeature.schemas.protobuf.flagd.sync.v1.sync_pb2.GetMetadataRequest,
        openfeature.schemas.protobuf.flagd.sync.v1.sync_pb2.GetMetadataResponse,
    ],
    default=grpc.UnaryUnaryMultiCallable[
        openfeature.schemas.protobuf.flagd.sync.v1.sync_pb2.GetMetadataRequest,
        openfeature.schemas.protobuf.flagd.sync.v1.sync_pb2.GetMetadataResponse,
    ],
)

class FlagSyncServiceStub(typing.Generic[_FlagSyncServiceSyncFlagsType, _FlagSyncServiceFetchAllFlagsType, _FlagSyncServiceGetMetadataType]):
    """FlagService implements a server streaming to provide realtime flag configurations"""

    @typing.overload
    def __init__(self: FlagSyncServiceStub[
        grpc.UnaryStreamMultiCallable[
            openfeature.schemas.protobuf.flagd.sync.v1.sync_pb2.SyncFlagsRequest,
            openfeature.schemas.protobuf.flagd.sync.v1.sync_pb2.SyncFlagsResponse,
        ],
        grpc.UnaryUnaryMultiCallable[
            openfeature.schemas.protobuf.flagd.sync.v1.sync_pb2.FetchAllFlagsRequest,
            openfeature.schemas.protobuf.flagd.sync.v1.sync_pb2.FetchAllFlagsResponse,
        ],
        grpc.UnaryUnaryMultiCallable[
            openfeature.schemas.protobuf.flagd.sync.v1.sync_pb2.GetMetadataRequest,
            openfeature.schemas.protobuf.flagd.sync.v1.sync_pb2.GetMetadataResponse,
        ],
    ], channel: grpc.Channel) -> None: ...

    @typing.overload
    def __init__(self: FlagSyncServiceStub[
        grpc.aio.UnaryStreamMultiCallable[
            openfeature.schemas.protobuf.flagd.sync.v1.sync_pb2.SyncFlagsRequest,
            openfeature.schemas.protobuf.flagd.sync.v1.sync_pb2.SyncFlagsResponse,
        ],
        grpc.aio.UnaryUnaryMultiCallable[
            openfeature.schemas.protobuf.flagd.sync.v1.sync_pb2.FetchAllFlagsRequest,
            openfeature.schemas.protobuf.flagd.sync.v1.sync_pb2.FetchAllFlagsResponse,
        ],
        grpc.aio.UnaryUnaryMultiCallable[
            openfeature.schemas.protobuf.flagd.sync.v1.sync_pb2.GetMetadataRequest,
            openfeature.schemas.protobuf.flagd.sync.v1.sync_pb2.GetMetadataResponse,
        ],
    ], channel: grpc.aio.Channel) -> None: ...

    SyncFlags: _FlagSyncServiceSyncFlagsType

    FetchAllFlags: _FlagSyncServiceFetchAllFlagsType

    GetMetadata: _FlagSyncServiceGetMetadataType

FlagSyncServiceAsyncStub: typing_extensions.TypeAlias = FlagSyncServiceStub[
    grpc.aio.UnaryStreamMultiCallable[
        openfeature.schemas.protobuf.flagd.sync.v1.sync_pb2.SyncFlagsRequest,
        openfeature.schemas.protobuf.flagd.sync.v1.sync_pb2.SyncFlagsResponse,
    ],
    grpc.aio.UnaryUnaryMultiCallable[
        openfeature.schemas.protobuf.flagd.sync.v1.sync_pb2.FetchAllFlagsRequest,
        openfeature.schemas.protobuf.flagd.sync.v1.sync_pb2.FetchAllFlagsResponse,
    ],
    grpc.aio.UnaryUnaryMultiCallable[
        openfeature.schemas.protobuf.flagd.sync.v1.sync_pb2.GetMetadataRequest,
        openfeature.schemas.protobuf.flagd.sync.v1.sync_pb2.GetMetadataResponse,
    ],
]

class FlagSyncServiceServicer(metaclass=abc.ABCMeta):
    """FlagService implements a server streaming to provide realtime flag configurations"""

    @abc.abstractmethod
    def SyncFlags(
        self,
        request: openfeature.schemas.protobuf.flagd.sync.v1.sync_pb2.SyncFlagsRequest,
        context: _ServicerContext,
    ) -> typing.Union[collections.abc.Iterator[openfeature.schemas.protobuf.flagd.sync.v1.sync_pb2.SyncFlagsResponse], collections.abc.AsyncIterator[openfeature.schemas.protobuf.flagd.sync.v1.sync_pb2.SyncFlagsResponse]]: ...

    @abc.abstractmethod
    def FetchAllFlags(
        self,
        request: openfeature.schemas.protobuf.flagd.sync.v1.sync_pb2.FetchAllFlagsRequest,
        context: _ServicerContext,
    ) -> typing.Union[openfeature.schemas.protobuf.flagd.sync.v1.sync_pb2.FetchAllFlagsResponse, collections.abc.Awaitable[openfeature.schemas.protobuf.flagd.sync.v1.sync_pb2.FetchAllFlagsResponse]]: ...

    @abc.abstractmethod
    def GetMetadata(
        self,
        request: openfeature.schemas.protobuf.flagd.sync.v1.sync_pb2.GetMetadataRequest,
        context: _ServicerContext,
    ) -> typing.Union[openfeature.schemas.protobuf.flagd.sync.v1.sync_pb2.GetMetadataResponse, collections.abc.Awaitable[openfeature.schemas.protobuf.flagd.sync.v1.sync_pb2.GetMetadataResponse]]: ...

def add_FlagSyncServiceServicer_to_server(servicer: FlagSyncServiceServicer, server: typing.Union[grpc.Server, grpc.aio.Server]) -> None: ...
