# Generated by cstruct-stubgen
from typing import BinaryIO, Literal, overload

import dissect.cstruct as __cs__
from typing_extensions import TypeAlias

class _c_cramfs(__cs__.cstruct):
    CRAMFS_MAGIC: Literal[684539205] = ...
    CRAMFS_SIGNATURE: Literal["Compressed ROMFS"] = ...
    CRAMFS_BLOCK_SIZE: Literal[4096] = ...
    CRAMFS_MODE_WIDTH: Literal[16] = ...
    CRAMFS_UID_WIDTH: Literal[16] = ...
    CRAMFS_GID_WIDTH: Literal[8] = ...
    CRAMFS_NAMELEN_WIDTH: Literal[6] = ...
    CRAMFS_OFFSET_WIDTH: Literal[26] = ...
    CRAMFS_MAXPATHLEN: Literal[252] = ...
    CRAMFS_SIZE_WIDTH: Literal[24] = ...
    CRAMFS_FLAG_FSID_VERSION_2: Literal[1] = ...
    CRAMFS_FLAG_SORTED_DIRS: Literal[2] = ...
    CRAMFS_FLAG_HOLES: Literal[256] = ...
    CRAMFS_FLAG_WRONG_SIGNATURE: Literal[512] = ...
    CRAMFS_FLAG_SHIFTED_ROOT_OFFSET: Literal[1024] = ...
    CRAMFS_FLAG_BLKSZ_MASK: Literal[14336] = ...
    CRAMFS_FLAG_COMP_METHOD_MASK: Literal[49152] = ...
    CRAMFS_FLAG_EXT_BLOCK_POINTERS: Literal[2048] = ...
    CRAMFS_FLAG_DIRECT_POINTER: Literal[1073741824] = ...
    CRAMFS_FLAG_UNCOMPRESSED_BLOCK: Literal[2147483648] = ...
    CRAMFS_FLAG_BLKSZ_SHIFT: Literal[11] = ...
    CRAMFS_FLAG_COMP_METHOD_SHIFT: Literal[14] = ...
    CRAMFS_FLAG_COMP_METHOD_NONE: Literal[0] = ...
    CRAMFS_FLAG_COMP_METHOD_GZIP: Literal[1] = ...
    CRAMFS_FLAG_COMP_METHOD_LZMA: Literal[2] = ...
    CRAMFS_SUPPORTED_FLAGS: Literal[65535] = ...
    class cramfs_inode(__cs__.Structure):
        mode: _c_cramfs.uint32
        uid: _c_cramfs.uint32
        size: _c_cramfs.uint32
        gid: _c_cramfs.uint32
        namelen: _c_cramfs.uint32
        offset: _c_cramfs.uint32
        name: __cs__.CharArray
        @overload
        def __init__(
            self,
            mode: _c_cramfs.uint32 | None = ...,
            uid: _c_cramfs.uint32 | None = ...,
            size: _c_cramfs.uint32 | None = ...,
            gid: _c_cramfs.uint32 | None = ...,
            namelen: _c_cramfs.uint32 | None = ...,
            offset: _c_cramfs.uint32 | None = ...,
            name: __cs__.CharArray | None = ...,
        ): ...
        @overload
        def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...

    class cramfs_info(__cs__.Structure):
        crc: _c_cramfs.uint32
        edition: _c_cramfs.uint32
        blocks: _c_cramfs.uint32
        files: _c_cramfs.uint32
        @overload
        def __init__(
            self,
            crc: _c_cramfs.uint32 | None = ...,
            edition: _c_cramfs.uint32 | None = ...,
            blocks: _c_cramfs.uint32 | None = ...,
            files: _c_cramfs.uint32 | None = ...,
        ): ...
        @overload
        def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...

    class cramfs_super_block(__cs__.Structure):
        magic: _c_cramfs.uint32
        size: _c_cramfs.uint32
        flags: _c_cramfs.uint32
        future: _c_cramfs.uint32
        signature: __cs__.CharArray
        fsid: _c_cramfs.cramfs_info
        name: __cs__.CharArray
        root: _c_cramfs.cramfs_inode
        @overload
        def __init__(
            self,
            magic: _c_cramfs.uint32 | None = ...,
            size: _c_cramfs.uint32 | None = ...,
            flags: _c_cramfs.uint32 | None = ...,
            future: _c_cramfs.uint32 | None = ...,
            signature: __cs__.CharArray | None = ...,
            fsid: _c_cramfs.cramfs_info | None = ...,
            name: __cs__.CharArray | None = ...,
            root: _c_cramfs.cramfs_inode | None = ...,
        ): ...
        @overload
        def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...

# Technically `c_cramfs` is an instance of `_c_cramfs`, but then we can't use it in type hints
c_cramfs: TypeAlias = _c_cramfs
