"""Type stubs for aerofs.os module."""

from os import stat_result
from typing import Iterator, Literal, Optional, Union
from os import PathLike

class DirEntry:
    """Directory entry from scandir."""
    
    @property
    def name(self) -> str: ...
    @property
    def path(self) -> str: ...
    def is_dir(self) -> bool: ...
    def is_file(self) -> bool: ...

async def stat(path: Union[str, PathLike[str]]) -> stat_result: ...
async def remove(path: str) -> None: ...
async def unlink(path: str) -> None: ...
async def rename(src: str, dst: str) -> None: ...
async def replace(src: str, dst: str) -> None: ...
async def renames(old: str, new: str) -> None: ...
async def removedirs(name: str) -> None: ...

async def mkdir(path: str, mode: Optional[int] = None) -> None: ...
async def makedirs(
    path: str, mode: Optional[int] = None, exist_ok: bool = False
) -> None: ...
async def rmdir(path: str) -> None: ...

async def listdir(path: Optional[str] = None) -> list[str]: ...
async def scandir(path: Optional[str] = None) -> Iterator[DirEntry]: ...

async def getcwd() -> str: ...

async def access(
    path: Union[str, PathLike[str]],
    mode: Literal[0, 1, 2, 4],
) -> bool: ...

# Unix-only functions
async def link(src: str, dst: str) -> None: ...
async def symlink(src: str, dst: str) -> None: ...
async def readlink(path: str) -> str: ...
async def statvfs(path: str) -> object: ...
async def sendfile(
    out_fd: int, in_fd: int, offset: Optional[int], count: int
) -> int: ...

class _PathModule:
    """Async path operations module."""
    
    async def exists(self, path: str) -> bool: ...
    async def isfile(self, path: str) -> bool: ...
    async def isdir(self, path: str) -> bool: ...
    async def islink(self, path: str) -> bool: ...
    async def getsize(self, path: str) -> int: ...
    async def abspath(self, path: str) -> str: ...
    async def getmtime(self, path: str) -> float: ...
    async def getatime(self, path: str) -> float: ...
    async def getctime(self, path: str) -> float: ...
    async def ismount(self, path: str) -> bool: ...
    async def samefile(self, path1: str, path2: str) -> bool: ...
    async def sameopenfile(self, fd1: int, fd2: int) -> bool: ...

# Note: These are actually module-level functions, exposed as path.exists() etc.
async def exists(path: str) -> bool: ...
async def isfile(path: str) -> bool: ...
async def isdir(path: str) -> bool: ...
async def islink(path: str) -> bool: ...
async def getsize(path: str) -> int: ...
async def abspath(path: str) -> str: ...
async def getmtime(path: str) -> float: ...
async def getatime(path: str) -> float: ...
async def getctime(path: str) -> float: ...
async def ismount(path: str) -> bool: ...
async def samefile(path1: str, path2: str) -> bool: ...
async def sameopenfile(fd1: int, fd2: int) -> bool: ...

class path:
    """Submodule containing async path operations."""
    
    @staticmethod
    async def exists(path: str) -> bool: ...
    @staticmethod
    async def isfile(path: str) -> bool: ...
    @staticmethod
    async def isdir(path: str) -> bool: ...
    @staticmethod
    async def islink(path: str) -> bool: ...
    @staticmethod
    async def getsize(path: str) -> int: ...
    @staticmethod
    async def abspath(path: str) -> str: ...
    @staticmethod
    async def getmtime(path: str) -> float: ...
    @staticmethod
    async def getatime(path: str) -> float: ...
    @staticmethod
    async def getctime(path: str) -> float: ...
    @staticmethod
    async def ismount(path: str) -> bool: ...
    @staticmethod
    async def samefile(path1: str, path2: str) -> bool: ...
    @staticmethod
    async def sameopenfile(fd1: int, fd2: int) -> bool: ...

__all__: list[str]
