import typing

from gi.repository import GLib
from gi.repository import GObject

T = typing.TypeVar("T")

MAJOR_VERSION: int = 1
MICRO_VERSION: int = 0
MINOR_VERSION: int = 84
TYPE_TAG_N_TYPES: int = 22
_lock = ...  # FIXME Constant
_namespace: str = "GIRepository"
_version: str = "2.0"

def arg_info_get_closure(info: BaseInfo) -> int: ...
def arg_info_get_destroy(info: BaseInfo) -> int: ...
def arg_info_get_direction(info: BaseInfo) -> Direction: ...
def arg_info_get_ownership_transfer(info: BaseInfo) -> Transfer: ...
def arg_info_get_scope(info: BaseInfo) -> ScopeType: ...
def arg_info_get_type(info: BaseInfo) -> BaseInfo: ...
def arg_info_is_caller_allocates(info: BaseInfo) -> bool: ...
def arg_info_is_optional(info: BaseInfo) -> bool: ...
def arg_info_is_return_value(info: BaseInfo) -> bool: ...
def arg_info_is_skip(info: BaseInfo) -> bool: ...
def arg_info_load_type(info: BaseInfo) -> BaseInfo: ...
def arg_info_may_be_null(info: BaseInfo) -> bool: ...
def callable_info_can_throw_gerror(info: BaseInfo) -> bool: ...
def callable_info_get_arg(info: BaseInfo, n: int) -> BaseInfo: ...
def callable_info_get_caller_owns(info: BaseInfo) -> Transfer: ...
def callable_info_get_instance_ownership_transfer(info: BaseInfo) -> Transfer: ...
def callable_info_get_n_args(info: BaseInfo) -> int: ...
def callable_info_get_return_attribute(info: BaseInfo, name: str) -> str: ...
def callable_info_get_return_type(info: BaseInfo) -> BaseInfo: ...
def callable_info_invoke(
    info: BaseInfo,
    function: None,
    in_args: typing.Sequence[Argument],
    out_args: typing.Sequence[Argument],
    return_value: Argument,
    is_method: bool,
    throws: bool,
) -> bool: ...
def callable_info_is_method(info: BaseInfo) -> bool: ...
def callable_info_iterate_return_attributes(
    info: BaseInfo,
) -> typing.Tuple[bool, AttributeIter, str, str]: ...
def callable_info_load_arg(info: BaseInfo, n: int) -> BaseInfo: ...
def callable_info_load_return_type(info: BaseInfo) -> BaseInfo: ...
def callable_info_may_return_null(info: BaseInfo) -> bool: ...
def callable_info_skip_return(info: BaseInfo) -> bool: ...
def cclosure_marshal_generic(
    closure: typing.Callable[..., typing.Any],
    return_gvalue: typing.Any,
    n_param_values: int,
    param_values: typing.Any,
    invocation_hint: None,
    marshal_data: None,
) -> None: ...
def constant_info_get_type(info: BaseInfo) -> BaseInfo: ...
def enum_info_get_error_domain(info: BaseInfo) -> str: ...
def enum_info_get_method(info: BaseInfo, n: int) -> BaseInfo: ...
def enum_info_get_n_methods(info: BaseInfo) -> int: ...
def enum_info_get_n_values(info: BaseInfo) -> int: ...
def enum_info_get_storage_type(info: BaseInfo) -> TypeTag: ...
def enum_info_get_value(info: BaseInfo, n: int) -> BaseInfo: ...
def field_info_get_flags(info: BaseInfo) -> FieldInfoFlags: ...
def field_info_get_offset(info: BaseInfo) -> int: ...
def field_info_get_size(info: BaseInfo) -> int: ...
def field_info_get_type(info: BaseInfo) -> BaseInfo: ...
def function_info_get_flags(info: BaseInfo) -> FunctionInfoFlags: ...
def function_info_get_property(info: BaseInfo) -> BaseInfo: ...
def function_info_get_symbol(info: BaseInfo) -> str: ...
def function_info_get_vfunc(info: BaseInfo) -> BaseInfo: ...
def get_major_version() -> int: ...
def get_micro_version() -> int: ...
def get_minor_version() -> int: ...
def info_new(
    type: InfoType, container: BaseInfo, typelib: Typelib, offset: int
) -> BaseInfo: ...
def info_type_to_string(type: InfoType) -> str: ...
def interface_info_find_method(info: BaseInfo, name: str) -> BaseInfo: ...
def interface_info_find_signal(info: BaseInfo, name: str) -> BaseInfo: ...
def interface_info_find_vfunc(info: BaseInfo, name: str) -> BaseInfo: ...
def interface_info_get_constant(info: BaseInfo, n: int) -> BaseInfo: ...
def interface_info_get_iface_struct(info: BaseInfo) -> BaseInfo: ...
def interface_info_get_method(info: BaseInfo, n: int) -> BaseInfo: ...
def interface_info_get_n_constants(info: BaseInfo) -> int: ...
def interface_info_get_n_methods(info: BaseInfo) -> int: ...
def interface_info_get_n_prerequisites(info: BaseInfo) -> int: ...
def interface_info_get_n_properties(info: BaseInfo) -> int: ...
def interface_info_get_n_signals(info: BaseInfo) -> int: ...
def interface_info_get_n_vfuncs(info: BaseInfo) -> int: ...
def interface_info_get_prerequisite(info: BaseInfo, n: int) -> BaseInfo: ...
def interface_info_get_property(info: BaseInfo, n: int) -> BaseInfo: ...
def interface_info_get_signal(info: BaseInfo, n: int) -> BaseInfo: ...
def interface_info_get_vfunc(info: BaseInfo, n: int) -> BaseInfo: ...
def invoke_error_quark() -> int: ...
def object_info_find_method(info: BaseInfo, name: str) -> typing.Optional[BaseInfo]: ...
def object_info_find_method_using_interfaces(
    info: BaseInfo, name: str
) -> typing.Tuple[typing.Optional[BaseInfo], BaseInfo]: ...
def object_info_find_signal(info: BaseInfo, name: str) -> typing.Optional[BaseInfo]: ...
def object_info_find_vfunc(info: BaseInfo, name: str) -> typing.Optional[BaseInfo]: ...
def object_info_find_vfunc_using_interfaces(
    info: BaseInfo, name: str
) -> typing.Tuple[typing.Optional[BaseInfo], BaseInfo]: ...
def object_info_get_abstract(info: BaseInfo) -> bool: ...
def object_info_get_class_struct(info: BaseInfo) -> typing.Optional[BaseInfo]: ...
def object_info_get_constant(info: BaseInfo, n: int) -> BaseInfo: ...
def object_info_get_field(info: BaseInfo, n: int) -> BaseInfo: ...
def object_info_get_final(info: BaseInfo) -> bool: ...
def object_info_get_fundamental(info: BaseInfo) -> bool: ...
def object_info_get_get_value_function(info: BaseInfo) -> typing.Optional[str]: ...
def object_info_get_interface(info: BaseInfo, n: int) -> BaseInfo: ...
def object_info_get_method(info: BaseInfo, n: int) -> BaseInfo: ...
def object_info_get_n_constants(info: BaseInfo) -> int: ...
def object_info_get_n_fields(info: BaseInfo) -> int: ...
def object_info_get_n_interfaces(info: BaseInfo) -> int: ...
def object_info_get_n_methods(info: BaseInfo) -> int: ...
def object_info_get_n_properties(info: BaseInfo) -> int: ...
def object_info_get_n_signals(info: BaseInfo) -> int: ...
def object_info_get_n_vfuncs(info: BaseInfo) -> int: ...
def object_info_get_parent(info: BaseInfo) -> typing.Optional[BaseInfo]: ...
def object_info_get_property(info: BaseInfo, n: int) -> BaseInfo: ...
def object_info_get_ref_function(info: BaseInfo) -> typing.Optional[str]: ...
def object_info_get_set_value_function(info: BaseInfo) -> typing.Optional[str]: ...
def object_info_get_signal(info: BaseInfo, n: int) -> BaseInfo: ...
def object_info_get_type_init(info: BaseInfo) -> str: ...
def object_info_get_type_name(info: BaseInfo) -> str: ...
def object_info_get_unref_function(info: BaseInfo) -> typing.Optional[str]: ...
def object_info_get_vfunc(info: BaseInfo, n: int) -> BaseInfo: ...
def property_info_get_flags(info: BaseInfo) -> GObject.ParamFlags: ...
def property_info_get_getter(info: BaseInfo) -> typing.Optional[BaseInfo]: ...
def property_info_get_ownership_transfer(info: BaseInfo) -> Transfer: ...
def property_info_get_setter(info: BaseInfo) -> typing.Optional[BaseInfo]: ...
def property_info_get_type(info: BaseInfo) -> BaseInfo: ...
def registered_type_info_get_g_type(info: BaseInfo) -> typing.Type[typing.Any]: ...
def registered_type_info_get_type_init(info: BaseInfo) -> str: ...
def registered_type_info_get_type_name(info: BaseInfo) -> str: ...
def signal_info_get_class_closure(info: BaseInfo) -> BaseInfo: ...
def signal_info_get_flags(info: BaseInfo) -> GObject.SignalFlags: ...
def signal_info_true_stops_emit(info: BaseInfo) -> bool: ...
def struct_info_find_field(info: BaseInfo, name: str) -> BaseInfo: ...
def struct_info_find_method(info: BaseInfo, name: str) -> BaseInfo: ...
def struct_info_get_alignment(info: BaseInfo) -> int: ...
def struct_info_get_copy_function(info: BaseInfo) -> typing.Optional[str]: ...
def struct_info_get_field(info: BaseInfo, n: int) -> BaseInfo: ...
def struct_info_get_free_function(info: BaseInfo) -> typing.Optional[str]: ...
def struct_info_get_method(info: BaseInfo, n: int) -> BaseInfo: ...
def struct_info_get_n_fields(info: BaseInfo) -> int: ...
def struct_info_get_n_methods(info: BaseInfo) -> int: ...
def struct_info_get_size(info: BaseInfo) -> int: ...
def struct_info_is_foreign(info: BaseInfo) -> bool: ...
def struct_info_is_gtype_struct(info: BaseInfo) -> bool: ...
def type_info_argument_from_hash_pointer(
    info: BaseInfo, hash_pointer: None, arg: Argument
) -> None: ...
def type_info_get_array_fixed_size(info: BaseInfo) -> int: ...
def type_info_get_array_length(info: BaseInfo) -> int: ...
def type_info_get_array_type(info: BaseInfo) -> ArrayType: ...
def type_info_get_interface(info: BaseInfo) -> BaseInfo: ...
def type_info_get_param_type(info: BaseInfo, n: int) -> BaseInfo: ...
def type_info_get_storage_type(info: BaseInfo) -> TypeTag: ...
def type_info_get_tag(info: BaseInfo) -> TypeTag: ...
def type_info_hash_pointer_from_argument(info: BaseInfo, arg: Argument) -> None: ...
def type_info_is_pointer(info: BaseInfo) -> bool: ...
def type_info_is_zero_terminated(info: BaseInfo) -> bool: ...
def type_tag_argument_from_hash_pointer(
    storage_type: TypeTag, hash_pointer: None, arg: Argument
) -> None: ...
def type_tag_hash_pointer_from_argument(
    storage_type: TypeTag, arg: Argument
) -> None: ...
def type_tag_to_string(type: TypeTag) -> str: ...
def union_info_find_method(info: BaseInfo, name: str) -> BaseInfo: ...
def union_info_get_alignment(info: BaseInfo) -> int: ...
def union_info_get_copy_function(info: BaseInfo) -> typing.Optional[str]: ...
def union_info_get_discriminator(info: BaseInfo, n: int) -> BaseInfo: ...
def union_info_get_discriminator_offset(info: BaseInfo) -> int: ...
def union_info_get_discriminator_type(info: BaseInfo) -> BaseInfo: ...
def union_info_get_field(info: BaseInfo, n: int) -> BaseInfo: ...
def union_info_get_free_function(info: BaseInfo) -> typing.Optional[str]: ...
def union_info_get_method(info: BaseInfo, n: int) -> BaseInfo: ...
def union_info_get_n_fields(info: BaseInfo) -> int: ...
def union_info_get_n_methods(info: BaseInfo) -> int: ...
def union_info_get_size(info: BaseInfo) -> int: ...
def union_info_is_discriminated(info: BaseInfo) -> bool: ...
def value_info_get_value(info: BaseInfo) -> int: ...
def vfunc_info_get_address(
    info: BaseInfo, implementor_gtype: typing.Type[typing.Any]
) -> None: ...
def vfunc_info_get_flags(info: BaseInfo) -> VFuncInfoFlags: ...
def vfunc_info_get_invoker(info: BaseInfo) -> BaseInfo: ...
def vfunc_info_get_offset(info: BaseInfo) -> int: ...
def vfunc_info_get_signal(info: BaseInfo) -> BaseInfo: ...

class Argument(GObject.GPointer):
    v_boolean = ...  # FIXME Constant
    v_double = ...  # FIXME Constant
    v_float = ...  # FIXME Constant
    v_int = ...  # FIXME Constant
    v_int16 = ...  # FIXME Constant
    v_int32 = ...  # FIXME Constant
    v_int64 = ...  # FIXME Constant
    v_int8 = ...  # FIXME Constant
    v_long = ...  # FIXME Constant
    v_pointer = ...  # FIXME Constant
    v_short = ...  # FIXME Constant
    v_size = ...  # FIXME Constant
    v_ssize = ...  # FIXME Constant
    v_string = ...  # FIXME Constant
    v_uint = ...  # FIXME Constant
    v_uint16 = ...  # FIXME Constant
    v_uint32 = ...  # FIXME Constant
    v_uint64 = ...  # FIXME Constant
    v_uint8 = ...  # FIXME Constant
    v_ulong = ...  # FIXME Constant
    v_ushort = ...  # FIXME Constant

class AttributeIter(GObject.GPointer):
    """
    :Constructors:

    ::

        AttributeIter()
    """

    data: None = ...
    data2: None = ...
    data3: None = ...
    data4: None = ...

class BaseInfo(GObject.GBoxed):
    """
    :Constructors:

    ::

        BaseInfo()
    """

    dummy1: int = ...
    dummy2: int = ...
    dummy3: None = ...
    dummy4: None = ...
    dummy5: None = ...
    dummy6: int = ...
    dummy7: int = ...
    padding: list[None] = ...
    def equal(self, info2: BaseInfo) -> bool: ...
    def get_attribute(self, name: str) -> str: ...
    def get_container(self) -> BaseInfo: ...
    def get_name(self) -> str: ...
    def get_namespace(self) -> str: ...
    def get_type(self) -> InfoType: ...
    def get_typelib(self) -> Typelib: ...
    def is_deprecated(self) -> bool: ...
    def iterate_attributes(self) -> typing.Tuple[bool, AttributeIter, str, str]: ...

class Repository(GObject.Object):
    """
    :Constructors:

    ::

        Repository(**properties)

    Object GIRepository

    Signals from GObject:
      notify (GParam)
    """

    parent: GObject.Object = ...
    priv: RepositoryPrivate = ...
    @staticmethod
    def dump(arg: str) -> bool: ...
    def enumerate_versions(self, namespace_: str) -> list[str]: ...
    @staticmethod
    def error_quark() -> int: ...
    def find_by_error_domain(self, domain: int) -> BaseInfo: ...
    def find_by_gtype(self, gtype: typing.Type[typing.Any]) -> BaseInfo: ...
    def find_by_name(self, namespace_: str, name: str) -> BaseInfo: ...
    def get_c_prefix(self, namespace_: str) -> str: ...
    @staticmethod
    def get_default() -> Repository: ...
    def get_dependencies(self, namespace_: str) -> list[str]: ...
    def get_immediate_dependencies(self, namespace_: str) -> list[str]: ...
    def get_info(self, namespace_: str, index: int) -> BaseInfo: ...
    def get_loaded_namespaces(self) -> list[str]: ...
    def get_n_infos(self, namespace_: str) -> int: ...
    def get_object_gtype_interfaces(
        self, gtype: typing.Type[typing.Any]
    ) -> list[BaseInfo]: ...
    @staticmethod
    def get_option_group() -> GLib.OptionGroup: ...
    @staticmethod
    def get_search_path() -> list[str]: ...
    def get_shared_library(self, namespace_: str) -> typing.Optional[str]: ...
    def get_typelib_path(self, namespace_: str) -> str: ...
    def get_version(self, namespace_: str) -> str: ...
    def is_registered(
        self, namespace_: str, version: typing.Optional[str] = None
    ) -> bool: ...
    def load_typelib(self, typelib: Typelib, flags: RepositoryLoadFlags) -> str: ...
    @staticmethod
    def prepend_library_path(directory: str) -> None: ...
    @staticmethod
    def prepend_search_path(directory: str) -> None: ...
    def require(
        self, namespace_: str, version: typing.Optional[str], flags: RepositoryLoadFlags
    ) -> Typelib: ...
    def require_private(
        self,
        typelib_dir: str,
        namespace_: str,
        version: typing.Optional[str],
        flags: RepositoryLoadFlags,
    ) -> Typelib: ...

class RepositoryClass(GObject.GPointer):
    """
    :Constructors:

    ::

        RepositoryClass()
    """

    parent: GObject.ObjectClass = ...

class RepositoryPrivate(GObject.GPointer): ...

class Typelib(GObject.GPointer):
    def free(self) -> None: ...
    def get_namespace(self) -> str: ...
    def symbol(self, symbol_name: str, symbol: None) -> bool: ...

class UnresolvedInfo(GObject.GPointer): ...

class FieldInfoFlags(GObject.GFlags):
    READABLE = 1
    WRITABLE = 2

class FunctionInfoFlags(GObject.GFlags):
    IS_CONSTRUCTOR = 2
    IS_GETTER = 4
    IS_METHOD = 1
    IS_SETTER = 8
    THROWS = 32
    WRAPS_VFUNC = 16

class RepositoryLoadFlags(GObject.GFlags):
    IREPOSITORY_LOAD_FLAG_LAZY = 1

class VFuncInfoFlags(GObject.GFlags):
    MUST_CHAIN_UP = 1
    MUST_NOT_OVERRIDE = 4
    MUST_OVERRIDE = 2
    THROWS = 8

class ArrayType(GObject.GEnum):
    ARRAY = 1
    BYTE_ARRAY = 3
    C = 0
    PTR_ARRAY = 2

class Direction(GObject.GEnum):
    IN = 0
    INOUT = 2
    OUT = 1

class InfoType(GObject.GEnum):
    ARG = 17
    BOXED = 4
    CALLBACK = 2
    CONSTANT = 9
    ENUM = 5
    FIELD = 16
    FLAGS = 6
    FUNCTION = 1
    INTERFACE = 8
    INVALID = 0
    INVALID_0 = 10
    OBJECT = 7
    PROPERTY = 15
    SIGNAL = 13
    STRUCT = 3
    TYPE = 18
    UNION = 11
    UNRESOLVED = 19
    VALUE = 12
    VFUNC = 14

class RepositoryError(GObject.GEnum):
    LIBRARY_NOT_FOUND = 3
    NAMESPACE_MISMATCH = 1
    NAMESPACE_VERSION_CONFLICT = 2
    TYPELIB_NOT_FOUND = 0

class ScopeType(GObject.GEnum):
    ASYNC = 2
    CALL = 1
    FOREVER = 4
    INVALID = 0
    NOTIFIED = 3

class Transfer(GObject.GEnum):
    CONTAINER = 1
    EVERYTHING = 2
    NOTHING = 0

class TypeTag(GObject.GEnum):
    ARRAY = 15
    BOOLEAN = 1
    DOUBLE = 11
    ERROR = 20
    FILENAME = 14
    FLOAT = 10
    GHASH = 19
    GLIST = 17
    GSLIST = 18
    GTYPE = 12
    INT16 = 4
    INT32 = 6
    INT64 = 8
    INT8 = 2
    INTERFACE = 16
    UINT16 = 5
    UINT32 = 7
    UINT64 = 9
    UINT8 = 3
    UNICHAR = 21
    UTF8 = 13
    VOID = 0

class nvokeError(GObject.GEnum):
    ARGUMENT_MISMATCH = 2
    FAILED = 0
    SYMBOL_NOT_FOUND = 1
