"""
@generated by mypy-protobuf.  Do not edit manually!
isort:skip_file
"""

import abc
import collections.abc
import grpc
import grpc.aio
import ni.measurementlink.sessionmanagement.v1.session_management_service_pb2
import typing

_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]
    ...

class SessionManagementServiceStub:
    """Service to keep track of open sessions used by measurement services, and to allow measurement services to access sessions by I/O resource and site."""

    def __init__(self, channel: typing.Union[grpc.Channel, grpc.aio.Channel]) -> None: ...
    ReserveSessions: grpc.UnaryUnaryMultiCallable[
        ni.measurementlink.sessionmanagement.v1.session_management_service_pb2.ReserveSessionsRequest,
        ni.measurementlink.sessionmanagement.v1.session_management_service_pb2.ReserveSessionsResponse,
    ]
    """Reserve session(s) for the given I/O resources (pins, relays, channels), sites, and instrument type ID and returns the information needed to create or access the session.
    Also reserves the session so other processes cannot access it with a ReserveSessions() call.
    Status Codes for errors:
    - INVALID_ARGUMENT:
        - Pin Map Context references a site number that is not defined in the pin map
        - Pin or relay name does not match any pin, pin group, relay, or relay group names in the pin map
        - Timeout specified is less than -1.
    - NOT_FOUND:
        - Pin Map Context has a pin map ID that does not match any pin maps registered with the Pin Map Service.
    - UNAVAILABLE:
        - Session(s) were already reserved and didn't become available before the specified timeout expired.
    """

    UnreserveSessions: grpc.UnaryUnaryMultiCallable[
        ni.measurementlink.sessionmanagement.v1.session_management_service_pb2.UnreserveSessionsRequest,
        ni.measurementlink.sessionmanagement.v1.session_management_service_pb2.UnreserveSessionsResponse,
    ]
    """Unreserves sessions so they can be accessed by other clients.
    - RESOURCE_EXHAUSTED:
        - Error occurred while unreserving sessions.
    """

    RegisterSessions: grpc.UnaryUnaryMultiCallable[
        ni.measurementlink.sessionmanagement.v1.session_management_service_pb2.RegisterSessionsRequest,
        ni.measurementlink.sessionmanagement.v1.session_management_service_pb2.RegisterSessionsResponse,
    ]
    """Registers the sessions with this service. Indicates that the sessions are open and will need to be closed later.
    Status Codes for errors:
    - ALREADY_EXISTS:
        - Session by the same name is already registered.
    - INVALID_ARGUMENT:
        - Session names list has an empty string.
    """

    UnregisterSessions: grpc.UnaryUnaryMultiCallable[
        ni.measurementlink.sessionmanagement.v1.session_management_service_pb2.UnregisterSessionsRequest,
        ni.measurementlink.sessionmanagement.v1.session_management_service_pb2.UnregisterSessionsResponse,
    ]
    """Unregisters the sessions with this service. Indicates that the sessions have been closed and will need to be reopened before they can be used again."""

    ReserveAllRegisteredSessions: grpc.UnaryUnaryMultiCallable[
        ni.measurementlink.sessionmanagement.v1.session_management_service_pb2.ReserveAllRegisteredSessionsRequest,
        ni.measurementlink.sessionmanagement.v1.session_management_service_pb2.ReserveAllRegisteredSessionsResponse,
    ]
    """Reserves and gets all sessions currently registered with this service.
    - INVALID_ARGUMENT:
        - Timeout specified is less than -1.
    - UNAVAILABLE:
        - Session(s) were already reserved and didn't become available before the specified timeout expired.
    """

    RegisterMultiplexerSessions: grpc.UnaryUnaryMultiCallable[
        ni.measurementlink.sessionmanagement.v1.session_management_service_pb2.RegisterMultiplexerSessionsRequest,
        ni.measurementlink.sessionmanagement.v1.session_management_service_pb2.RegisterMultiplexerSessionsResponse,
    ]
    """Registers the multiplexer sessions with this service. Indicates that the sessions are open and will need to be closed later.
    Status Codes for errors:
    - ALREADY_EXISTS:
        - Session by the same name is already registered.
    - INVALID_ARGUMENT:
        - Session names list has an empty string.
    """

    UnregisterMultiplexerSessions: grpc.UnaryUnaryMultiCallable[
        ni.measurementlink.sessionmanagement.v1.session_management_service_pb2.UnregisterMultiplexerSessionsRequest,
        ni.measurementlink.sessionmanagement.v1.session_management_service_pb2.UnregisterMultiplexerSessionsResponse,
    ]
    """Unregisters the multiplexer sessions with this service. Indicates that the sessions have been closed and will need to be reopened before they can be used again."""

    GetMultiplexerSessions: grpc.UnaryUnaryMultiCallable[
        ni.measurementlink.sessionmanagement.v1.session_management_service_pb2.GetMultiplexerSessionsRequest,
        ni.measurementlink.sessionmanagement.v1.session_management_service_pb2.GetMultiplexerSessionsResponse,
    ]
    """Gets all the connected multiplexer session(s) for the given pin map context and returns information needed to create or access the session.
    Status Codes for errors:
    - INVALID_ARGUMENT:
        - Pin Map Context references a site number that is not defined in the pin map.
    - NOT_FOUND:
        - Pin Map Context has a pin map ID that does not match any pin maps registered with the Pin Map Service.
    """

    GetAllRegisteredMultiplexerSessions: grpc.UnaryUnaryMultiCallable[
        ni.measurementlink.sessionmanagement.v1.session_management_service_pb2.GetAllRegisteredMultiplexerSessionsRequest,
        ni.measurementlink.sessionmanagement.v1.session_management_service_pb2.GetAllRegisteredMultiplexerSessionsResponse,
    ]
    """Gets all multiplexer sessions currently registered with this service."""

    GetSessions: grpc.UnaryUnaryMultiCallable[
        ni.measurementlink.sessionmanagement.v1.session_management_service_pb2.GetSessionsRequest,
        ni.measurementlink.sessionmanagement.v1.session_management_service_pb2.GetSessionsResponse,
    ]
    """Gets all reserved or registered sessions for the specified instrument and multiplexer types."""

class SessionManagementServiceAsyncStub:
    """Service to keep track of open sessions used by measurement services, and to allow measurement services to access sessions by I/O resource and site."""

    ReserveSessions: grpc.aio.UnaryUnaryMultiCallable[
        ni.measurementlink.sessionmanagement.v1.session_management_service_pb2.ReserveSessionsRequest,
        ni.measurementlink.sessionmanagement.v1.session_management_service_pb2.ReserveSessionsResponse,
    ]
    """Reserve session(s) for the given I/O resources (pins, relays, channels), sites, and instrument type ID and returns the information needed to create or access the session.
    Also reserves the session so other processes cannot access it with a ReserveSessions() call.
    Status Codes for errors:
    - INVALID_ARGUMENT:
        - Pin Map Context references a site number that is not defined in the pin map
        - Pin or relay name does not match any pin, pin group, relay, or relay group names in the pin map
        - Timeout specified is less than -1.
    - NOT_FOUND:
        - Pin Map Context has a pin map ID that does not match any pin maps registered with the Pin Map Service.
    - UNAVAILABLE:
        - Session(s) were already reserved and didn't become available before the specified timeout expired.
    """

    UnreserveSessions: grpc.aio.UnaryUnaryMultiCallable[
        ni.measurementlink.sessionmanagement.v1.session_management_service_pb2.UnreserveSessionsRequest,
        ni.measurementlink.sessionmanagement.v1.session_management_service_pb2.UnreserveSessionsResponse,
    ]
    """Unreserves sessions so they can be accessed by other clients.
    - RESOURCE_EXHAUSTED:
        - Error occurred while unreserving sessions.
    """

    RegisterSessions: grpc.aio.UnaryUnaryMultiCallable[
        ni.measurementlink.sessionmanagement.v1.session_management_service_pb2.RegisterSessionsRequest,
        ni.measurementlink.sessionmanagement.v1.session_management_service_pb2.RegisterSessionsResponse,
    ]
    """Registers the sessions with this service. Indicates that the sessions are open and will need to be closed later.
    Status Codes for errors:
    - ALREADY_EXISTS:
        - Session by the same name is already registered.
    - INVALID_ARGUMENT:
        - Session names list has an empty string.
    """

    UnregisterSessions: grpc.aio.UnaryUnaryMultiCallable[
        ni.measurementlink.sessionmanagement.v1.session_management_service_pb2.UnregisterSessionsRequest,
        ni.measurementlink.sessionmanagement.v1.session_management_service_pb2.UnregisterSessionsResponse,
    ]
    """Unregisters the sessions with this service. Indicates that the sessions have been closed and will need to be reopened before they can be used again."""

    ReserveAllRegisteredSessions: grpc.aio.UnaryUnaryMultiCallable[
        ni.measurementlink.sessionmanagement.v1.session_management_service_pb2.ReserveAllRegisteredSessionsRequest,
        ni.measurementlink.sessionmanagement.v1.session_management_service_pb2.ReserveAllRegisteredSessionsResponse,
    ]
    """Reserves and gets all sessions currently registered with this service.
    - INVALID_ARGUMENT:
        - Timeout specified is less than -1.
    - UNAVAILABLE:
        - Session(s) were already reserved and didn't become available before the specified timeout expired.
    """

    RegisterMultiplexerSessions: grpc.aio.UnaryUnaryMultiCallable[
        ni.measurementlink.sessionmanagement.v1.session_management_service_pb2.RegisterMultiplexerSessionsRequest,
        ni.measurementlink.sessionmanagement.v1.session_management_service_pb2.RegisterMultiplexerSessionsResponse,
    ]
    """Registers the multiplexer sessions with this service. Indicates that the sessions are open and will need to be closed later.
    Status Codes for errors:
    - ALREADY_EXISTS:
        - Session by the same name is already registered.
    - INVALID_ARGUMENT:
        - Session names list has an empty string.
    """

    UnregisterMultiplexerSessions: grpc.aio.UnaryUnaryMultiCallable[
        ni.measurementlink.sessionmanagement.v1.session_management_service_pb2.UnregisterMultiplexerSessionsRequest,
        ni.measurementlink.sessionmanagement.v1.session_management_service_pb2.UnregisterMultiplexerSessionsResponse,
    ]
    """Unregisters the multiplexer sessions with this service. Indicates that the sessions have been closed and will need to be reopened before they can be used again."""

    GetMultiplexerSessions: grpc.aio.UnaryUnaryMultiCallable[
        ni.measurementlink.sessionmanagement.v1.session_management_service_pb2.GetMultiplexerSessionsRequest,
        ni.measurementlink.sessionmanagement.v1.session_management_service_pb2.GetMultiplexerSessionsResponse,
    ]
    """Gets all the connected multiplexer session(s) for the given pin map context and returns information needed to create or access the session.
    Status Codes for errors:
    - INVALID_ARGUMENT:
        - Pin Map Context references a site number that is not defined in the pin map.
    - NOT_FOUND:
        - Pin Map Context has a pin map ID that does not match any pin maps registered with the Pin Map Service.
    """

    GetAllRegisteredMultiplexerSessions: grpc.aio.UnaryUnaryMultiCallable[
        ni.measurementlink.sessionmanagement.v1.session_management_service_pb2.GetAllRegisteredMultiplexerSessionsRequest,
        ni.measurementlink.sessionmanagement.v1.session_management_service_pb2.GetAllRegisteredMultiplexerSessionsResponse,
    ]
    """Gets all multiplexer sessions currently registered with this service."""

    GetSessions: grpc.aio.UnaryUnaryMultiCallable[
        ni.measurementlink.sessionmanagement.v1.session_management_service_pb2.GetSessionsRequest,
        ni.measurementlink.sessionmanagement.v1.session_management_service_pb2.GetSessionsResponse,
    ]
    """Gets all reserved or registered sessions for the specified instrument and multiplexer types."""

class SessionManagementServiceServicer(metaclass=abc.ABCMeta):
    """Service to keep track of open sessions used by measurement services, and to allow measurement services to access sessions by I/O resource and site."""

    @abc.abstractmethod
    def ReserveSessions(
        self,
        request: ni.measurementlink.sessionmanagement.v1.session_management_service_pb2.ReserveSessionsRequest,
        context: _ServicerContext,
    ) -> typing.Union[ni.measurementlink.sessionmanagement.v1.session_management_service_pb2.ReserveSessionsResponse, collections.abc.Awaitable[ni.measurementlink.sessionmanagement.v1.session_management_service_pb2.ReserveSessionsResponse]]:
        """Reserve session(s) for the given I/O resources (pins, relays, channels), sites, and instrument type ID and returns the information needed to create or access the session.
        Also reserves the session so other processes cannot access it with a ReserveSessions() call.
        Status Codes for errors:
        - INVALID_ARGUMENT:
            - Pin Map Context references a site number that is not defined in the pin map
            - Pin or relay name does not match any pin, pin group, relay, or relay group names in the pin map
            - Timeout specified is less than -1.
        - NOT_FOUND:
            - Pin Map Context has a pin map ID that does not match any pin maps registered with the Pin Map Service.
        - UNAVAILABLE:
            - Session(s) were already reserved and didn't become available before the specified timeout expired.
        """

    @abc.abstractmethod
    def UnreserveSessions(
        self,
        request: ni.measurementlink.sessionmanagement.v1.session_management_service_pb2.UnreserveSessionsRequest,
        context: _ServicerContext,
    ) -> typing.Union[ni.measurementlink.sessionmanagement.v1.session_management_service_pb2.UnreserveSessionsResponse, collections.abc.Awaitable[ni.measurementlink.sessionmanagement.v1.session_management_service_pb2.UnreserveSessionsResponse]]:
        """Unreserves sessions so they can be accessed by other clients.
        - RESOURCE_EXHAUSTED:
            - Error occurred while unreserving sessions.
        """

    @abc.abstractmethod
    def RegisterSessions(
        self,
        request: ni.measurementlink.sessionmanagement.v1.session_management_service_pb2.RegisterSessionsRequest,
        context: _ServicerContext,
    ) -> typing.Union[ni.measurementlink.sessionmanagement.v1.session_management_service_pb2.RegisterSessionsResponse, collections.abc.Awaitable[ni.measurementlink.sessionmanagement.v1.session_management_service_pb2.RegisterSessionsResponse]]:
        """Registers the sessions with this service. Indicates that the sessions are open and will need to be closed later.
        Status Codes for errors:
        - ALREADY_EXISTS:
            - Session by the same name is already registered.
        - INVALID_ARGUMENT:
            - Session names list has an empty string.
        """

    @abc.abstractmethod
    def UnregisterSessions(
        self,
        request: ni.measurementlink.sessionmanagement.v1.session_management_service_pb2.UnregisterSessionsRequest,
        context: _ServicerContext,
    ) -> typing.Union[ni.measurementlink.sessionmanagement.v1.session_management_service_pb2.UnregisterSessionsResponse, collections.abc.Awaitable[ni.measurementlink.sessionmanagement.v1.session_management_service_pb2.UnregisterSessionsResponse]]:
        """Unregisters the sessions with this service. Indicates that the sessions have been closed and will need to be reopened before they can be used again."""

    @abc.abstractmethod
    def ReserveAllRegisteredSessions(
        self,
        request: ni.measurementlink.sessionmanagement.v1.session_management_service_pb2.ReserveAllRegisteredSessionsRequest,
        context: _ServicerContext,
    ) -> typing.Union[ni.measurementlink.sessionmanagement.v1.session_management_service_pb2.ReserveAllRegisteredSessionsResponse, collections.abc.Awaitable[ni.measurementlink.sessionmanagement.v1.session_management_service_pb2.ReserveAllRegisteredSessionsResponse]]:
        """Reserves and gets all sessions currently registered with this service.
        - INVALID_ARGUMENT:
            - Timeout specified is less than -1.
        - UNAVAILABLE:
            - Session(s) were already reserved and didn't become available before the specified timeout expired.
        """

    @abc.abstractmethod
    def RegisterMultiplexerSessions(
        self,
        request: ni.measurementlink.sessionmanagement.v1.session_management_service_pb2.RegisterMultiplexerSessionsRequest,
        context: _ServicerContext,
    ) -> typing.Union[ni.measurementlink.sessionmanagement.v1.session_management_service_pb2.RegisterMultiplexerSessionsResponse, collections.abc.Awaitable[ni.measurementlink.sessionmanagement.v1.session_management_service_pb2.RegisterMultiplexerSessionsResponse]]:
        """Registers the multiplexer sessions with this service. Indicates that the sessions are open and will need to be closed later.
        Status Codes for errors:
        - ALREADY_EXISTS:
            - Session by the same name is already registered.
        - INVALID_ARGUMENT:
            - Session names list has an empty string.
        """

    @abc.abstractmethod
    def UnregisterMultiplexerSessions(
        self,
        request: ni.measurementlink.sessionmanagement.v1.session_management_service_pb2.UnregisterMultiplexerSessionsRequest,
        context: _ServicerContext,
    ) -> typing.Union[ni.measurementlink.sessionmanagement.v1.session_management_service_pb2.UnregisterMultiplexerSessionsResponse, collections.abc.Awaitable[ni.measurementlink.sessionmanagement.v1.session_management_service_pb2.UnregisterMultiplexerSessionsResponse]]:
        """Unregisters the multiplexer sessions with this service. Indicates that the sessions have been closed and will need to be reopened before they can be used again."""

    @abc.abstractmethod
    def GetMultiplexerSessions(
        self,
        request: ni.measurementlink.sessionmanagement.v1.session_management_service_pb2.GetMultiplexerSessionsRequest,
        context: _ServicerContext,
    ) -> typing.Union[ni.measurementlink.sessionmanagement.v1.session_management_service_pb2.GetMultiplexerSessionsResponse, collections.abc.Awaitable[ni.measurementlink.sessionmanagement.v1.session_management_service_pb2.GetMultiplexerSessionsResponse]]:
        """Gets all the connected multiplexer session(s) for the given pin map context and returns information needed to create or access the session.
        Status Codes for errors:
        - INVALID_ARGUMENT:
            - Pin Map Context references a site number that is not defined in the pin map.
        - NOT_FOUND:
            - Pin Map Context has a pin map ID that does not match any pin maps registered with the Pin Map Service.
        """

    @abc.abstractmethod
    def GetAllRegisteredMultiplexerSessions(
        self,
        request: ni.measurementlink.sessionmanagement.v1.session_management_service_pb2.GetAllRegisteredMultiplexerSessionsRequest,
        context: _ServicerContext,
    ) -> typing.Union[ni.measurementlink.sessionmanagement.v1.session_management_service_pb2.GetAllRegisteredMultiplexerSessionsResponse, collections.abc.Awaitable[ni.measurementlink.sessionmanagement.v1.session_management_service_pb2.GetAllRegisteredMultiplexerSessionsResponse]]:
        """Gets all multiplexer sessions currently registered with this service."""

    @abc.abstractmethod
    def GetSessions(
        self,
        request: ni.measurementlink.sessionmanagement.v1.session_management_service_pb2.GetSessionsRequest,
        context: _ServicerContext,
    ) -> typing.Union[ni.measurementlink.sessionmanagement.v1.session_management_service_pb2.GetSessionsResponse, collections.abc.Awaitable[ni.measurementlink.sessionmanagement.v1.session_management_service_pb2.GetSessionsResponse]]:
        """Gets all reserved or registered sessions for the specified instrument and multiplexer types."""

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