# Copyright 2026 Helmut Grohne <helmut@subdivi.de>
# SPDX-License-Identifier: LGPL-2.0-or-later


import asyncio
import contextlib

from .. import low_level
from .. import bus_messages


class FilterHandle:
    def __enter__(self) -> asyncio.Queue[low_level.Message]: ...

    def __exit__(
        self, exc_type: object, exc_val: object, exc_tb: object
    ) -> bool: ...


class DBusRouter:
    def filter(self, rule: bus_messages.MatchRule) -> FilterHandle: ...

    async def send_and_get_reply(
        self, message: low_level.Message
    ) -> low_level.Message: ...


def open_dbus_router() -> contextlib.AbstractAsyncContextManager[DBusRouter]: ...
