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

import dissect.cstruct as __cs__

class _c_dm(__cs__.cstruct):
    THIN_SUPERBLOCK_MAGIC: Literal[27022010] = ...
    THIN_SUPERBLOCK_LOCATION: Literal[0] = ...
    THIN_VERSION: Literal[2] = ...
    SECTOR_TO_BLOCK_SHIFT: Literal[3] = ...
    SPACE_MAP_ROOT_SIZE: Literal[128] = ...
    class node_flags(__cs__.Enum):
        INTERNAL_NODE = ...
        LEAF_NODE = ...

    class node_header(__cs__.Structure):
        csum: _c_dm.uint32
        flags: _c_dm.uint32
        blocknr: _c_dm.uint64
        nr_entries: _c_dm.uint32
        max_entries: _c_dm.uint32
        value_size: _c_dm.uint32
        padding: _c_dm.uint32
        @overload
        def __init__(
            self,
            csum: _c_dm.uint32 | None = ...,
            flags: _c_dm.uint32 | None = ...,
            blocknr: _c_dm.uint64 | None = ...,
            nr_entries: _c_dm.uint32 | None = ...,
            max_entries: _c_dm.uint32 | None = ...,
            value_size: _c_dm.uint32 | None = ...,
            padding: _c_dm.uint32 | None = ...,
        ): ...
        @overload
        def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...

    class btree_node(__cs__.Structure):
        header: _c_dm.node_header
        @overload
        def __init__(self, header: _c_dm.node_header | None = ...): ...
        @overload
        def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...

    class thin_disk_superblock(__cs__.Structure):
        csum: _c_dm.uint32
        flags: _c_dm.uint32
        blocknr: _c_dm.uint64
        uuid: __cs__.Array[_c_dm.uint8]
        magic: _c_dm.uint64
        version: _c_dm.uint32
        time: _c_dm.uint32
        trans_id: _c_dm.uint64
        held_root: _c_dm.uint64
        data_space_map_root: __cs__.Array[_c_dm.uint8]
        metadata_space_map_root: __cs__.Array[_c_dm.uint8]
        data_mapping_root: _c_dm.uint64
        device_details_root: _c_dm.uint64
        data_block_size: _c_dm.uint32
        metadata_block_size: _c_dm.uint32
        metadata_nr_blocks: _c_dm.uint64
        compat_flags: _c_dm.uint32
        compat_ro_flags: _c_dm.uint32
        incompat_flags: _c_dm.uint32
        @overload
        def __init__(
            self,
            csum: _c_dm.uint32 | None = ...,
            flags: _c_dm.uint32 | None = ...,
            blocknr: _c_dm.uint64 | None = ...,
            uuid: __cs__.Array[_c_dm.uint8] | None = ...,
            magic: _c_dm.uint64 | None = ...,
            version: _c_dm.uint32 | None = ...,
            time: _c_dm.uint32 | None = ...,
            trans_id: _c_dm.uint64 | None = ...,
            held_root: _c_dm.uint64 | None = ...,
            data_space_map_root: __cs__.Array[_c_dm.uint8] | None = ...,
            metadata_space_map_root: __cs__.Array[_c_dm.uint8] | None = ...,
            data_mapping_root: _c_dm.uint64 | None = ...,
            device_details_root: _c_dm.uint64 | None = ...,
            data_block_size: _c_dm.uint32 | None = ...,
            metadata_block_size: _c_dm.uint32 | None = ...,
            metadata_nr_blocks: _c_dm.uint64 | None = ...,
            compat_flags: _c_dm.uint32 | None = ...,
            compat_ro_flags: _c_dm.uint32 | None = ...,
            incompat_flags: _c_dm.uint32 | None = ...,
        ): ...
        @overload
        def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...

    class disk_device_details(__cs__.Structure):
        mapped_blocks: _c_dm.uint64
        transaction_id: _c_dm.uint64
        creation_time: _c_dm.uint32
        snapshotted_time: _c_dm.uint32
        @overload
        def __init__(
            self,
            mapped_blocks: _c_dm.uint64 | None = ...,
            transaction_id: _c_dm.uint64 | None = ...,
            creation_time: _c_dm.uint32 | None = ...,
            snapshotted_time: _c_dm.uint32 | None = ...,
        ): ...
        @overload
        def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...

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

SECTOR_SIZE: int
