import typing

from gi.repository import GObject
from typing_extensions import Self

T = typing.TypeVar("T")

MODULE_IMPL_AR: int = 7
MODULE_IMPL_DL: int = 1
MODULE_IMPL_NONE: int = 0
MODULE_IMPL_WIN32: int = 3

def module_build_path(directory: typing.Optional[str], module_name: str) -> str: ...
def module_error() -> str: ...
def module_error_quark() -> int: ...
def module_supported() -> bool: ...

class Module(GObject.GPointer):
    @staticmethod
    def build_path(directory: typing.Optional[str], module_name: str) -> str: ...
    def close(self) -> bool: ...
    @staticmethod
    def error() -> str: ...
    @staticmethod
    def error_quark() -> int: ...
    def make_resident(self) -> None: ...
    def name(self) -> str: ...
    @staticmethod
    def supported() -> bool: ...
    def symbol(self, symbol_name: str) -> typing.Tuple[bool, None]: ...

class ModuleFlags(GObject.GFlags):
    LAZY = 1
    LOCAL = 2
    MASK = 3

class ModuleError(GObject.GEnum):
    CHECK_FAILED = 1
    FAILED = 0
