from _typeshed import Incomplete, Unused
from collections.abc import Iterator
from typing import Final, TypeAlias

import _win32typing
from pythoncom import com_record
from win32.lib.pywintypes import IIDType
from win32com.client import dynamic

_Stringifiable: TypeAlias = object

def GetObject(Pathname: str | None = None, Class=None, clsctx=None) -> CDispatch: ...
def GetActiveObject(Class: str, clsctx=...): ...
def Moniker(Pathname: str, clsctx=...): ...
def Dispatch(
    dispatch: str | dynamic.PyIDispatchType | IIDType | dynamic.PyIUnknownType,
    userName: str | None = None,
    resultCLSID: _Stringifiable | None = None,
    typeinfo: _win32typing.PyITypeInfo | None = None,
    clsctx: int = ...,
) -> dynamic.CDispatch: ...
def DispatchEx(clsid, machine=None, userName=None, resultCLSID=None, typeinfo=None, clsctx=None): ...

class CDispatch(dynamic.CDispatch):
    def __dir__(self) -> list[str]: ...

def CastTo(ob, target, typelib=None): ...

class Constants:
    __dicts__: list[Incomplete]
    def __getattr__(self, a: str): ...

constants: Final[Constants]

class EventsProxy:
    def __init__(self, ob) -> None: ...
    def __del__(self) -> None: ...
    def __getattr__(self, attr: str): ...
    def __setattr__(self, attr: str, val) -> None: ...

def DispatchWithEvents(clsid, user_event_class) -> EventsProxy: ...
def WithEvents(disp, user_event_class): ...
def getevents(clsid): ...
def Record(name, object) -> com_record: ...
def register_record_class(cls) -> None: ...

class DispatchBaseClass:
    def __init__(self, oobj=None) -> None: ...
    def __dir__(self) -> list[str]: ...
    def __eq__(self, other) -> bool: ...
    def __ne__(self, other) -> bool: ...
    def __getattr__(self, attr: str): ...
    def __setattr__(self, attr: str, value) -> None: ...

class CoClassBaseClass:
    def __init__(self, oobj=None) -> None: ...
    def __getattr__(self, attr: str): ...
    def __setattr__(self, attr: str, value) -> None: ...
    def __call__(self, *args, **kwargs): ...
    def __str__(self, *args: Unused) -> str: ...  # noqa: Y029
    def __int__(self, *args: Unused) -> int: ...
    def __iter__(self) -> Iterator[Incomplete]: ...
    def __len__(self) -> int: ...
    def __bool__(self) -> bool: ...

class VARIANT:
    varianttype: Incomplete
    def __init__(self, vt, value) -> None: ...

    @property
    def value(self): ...
    @value.setter
    def value(self, newval) -> None: ...
    @value.deleter
    def value(self) -> None: ...
