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

import dissect.cstruct as __cs__

class _c_lvm(__cs__.cstruct):
    DISK_BLOCK_SIZE_512B: Literal[512] = ...
    FS_PLIST_DEF_MAX_PARTITIONS: Literal[32] = ...
    LVM_MAGIC_NUMBER: Literal[3221344269] = ...
    LVM_INITIAL_MAJOR_VERSION: Literal[3] = ...
    LVM_MAJOR_VERSION_ESX60: Literal[6] = ...
    LVM_MAJOR_VERSION_ESX50: Literal[5] = ...
    LVM_IS_LVM6: Literal["((majorVersion == LVM_MAJOR_VERSION_ESX60) ? TRUE : FALSE)"] = ...
    LVM_DEV_HEADER_OFFSET: Literal[1048576] = ...
    LVM_MD_ALIGNMENT_DEFAULT: Literal[4096] = ...
    LVM_MAX_VOLUME_LABEL_LENGTH: Literal[64] = ...
    LVM_SIZEOF_LVM_DEVMETA_LVM5: Literal[512] = ...
    LVM_SIZEOF_LVM_DEVMETA_LVM6: Literal["(mdAlignment)"] = ...
    LVM_SIZEOF_LVM_DEVMETA: Literal[
        "(LVM_IS_LVM6(majorVersion) ? LVM_SIZEOF_LVM_DEVMETA_LVM6(mdAlignment) : LVM_SIZEOF_LVM_DEVMETA_LVM5)"
    ] = ...
    LVM_SIZEOF_EXTVOLMETA: Literal[256] = ...
    LVM_SIZEOF_VTENTRY: Literal[512] = ...
    LVM_SIZEOF_PTENTRY: Literal[128] = ...
    LVM_SIZEOF_SDTENTRY: Literal[256] = ...
    LVM_MAX_VOLUMES_PER_DEV_LVM5: Literal[512] = ...
    LVM_MAX_VOLUMES_PER_DEV_LVM6: Literal[1] = ...
    LVM_MAX_VOLUMES_PER_DEV: Literal[
        "(LVM_IS_LVM6(majorVersion) ? LVM_MAX_VOLUMES_PER_DEV_LVM6 : LVM_MAX_VOLUMES_PER_DEV_LVM5)"
    ] = ...
    LVM_UNUSED_MD_SECTORS_LVM5: Literal[512] = ...
    LVM_UNUSED_MD_SECTORS_LVM6: Literal[1023] = ...
    LVM_UNUSED_MD_SIZE_LVM5: Literal[262144] = ...
    LVM_UNUSED_MD_SIZE_LVM6: Literal[523776] = ...
    LVM_RESERVED_SIZE_LVM5: Literal[253952] = ...
    LVM_RESERVED_SIZE_LVM6: Literal[515584] = ...
    LVM_RESERVED_SIZE: Literal["(LVM_IS_LVM6(majorVersion) ? LVM_RESERVED_SIZE_LVM6 : LVM_RESERVED_SIZE_LVM5)"] = ...
    LVM_PES_PER_BITMAP: Literal[8192] = ...
    LVM_PE_BITMAP_SIZE_LVM5: Literal[1024] = ...
    LVM_PE_BITMAP_SIZE_LVM6: Literal["(MAX(mdAlignment, LVM_PE_BITMAP_SIZE_LVM5))"] = ...
    LVM_PE_BITMAP_SIZE: Literal[
        "(LVM_IS_LVM6(majorVersion) ? LVM_PE_BITMAP_SIZE_LVM6(mdAlignment) : LVM_PE_BITMAP_SIZE_LVM5)"
    ] = ...
    Bool: TypeAlias = _c_lvm.uint8
    class LVM_VolState(__cs__.Enum):
        LVM_INVALID = ...
        LVM_NORMAL = ...
        LVM_RESIG_PENDING = ...
        LVM_RESIG_DONE = ...
        LVM_SENTINEL = ...

    class UUID(__cs__.Structure):
        timeLo: _c_lvm.uint32
        timeHi: _c_lvm.uint32
        rand: _c_lvm.uint16
        macAddr: __cs__.CharArray
        @overload
        def __init__(
            self,
            timeLo: _c_lvm.uint32 | None = ...,
            timeHi: _c_lvm.uint32 | None = ...,
            rand: _c_lvm.uint16 | None = ...,
            macAddr: __cs__.CharArray | None = ...,
        ): ...
        @overload
        def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...

    class SCSI_DiskId(__cs__.Structure):
        type: _c_lvm.uint8
        len: _c_lvm.uint8
        lun: _c_lvm.uint16
        deviceType: _c_lvm.uint8
        scsiLevel: _c_lvm.uint8
        vendor: __cs__.CharArray
        model: __cs__.CharArray
        revision: __cs__.CharArray
        id: __cs__.CharArray
        @overload
        def __init__(
            self,
            type: _c_lvm.uint8 | None = ...,
            len: _c_lvm.uint8 | None = ...,
            lun: _c_lvm.uint16 | None = ...,
            deviceType: _c_lvm.uint8 | None = ...,
            scsiLevel: _c_lvm.uint8 | None = ...,
            vendor: __cs__.CharArray | None = ...,
            model: __cs__.CharArray | None = ...,
            revision: __cs__.CharArray | None = ...,
            id: __cs__.CharArray | None = ...,
        ): ...
        @overload
        def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...

    class LVM_DevMetadata(__cs__.Structure):
        magic: _c_lvm.uint32
        majorVersion: _c_lvm.uint32
        minorVersion: _c_lvm.uint32
        diskID: _c_lvm.SCSI_DiskId
        diskBlockSize: _c_lvm.uint32
        totalBytes: _c_lvm.uint64
        numVolumes: _c_lvm.uint32
        numPEs: _c_lvm.uint32
        lastPEIndex: _c_lvm.uint32
        generation: _c_lvm.uint64
        dataOffset: _c_lvm.uint64
        devID: _c_lvm.UUID
        initTimeUS: _c_lvm.uint64
        modTimeUS: _c_lvm.uint64
        lockedBy: _c_lvm.UUID
        lockedWhenUS: _c_lvm.uint64
        _unknown0: _c_lvm.uint32
        numPEMaps: _c_lvm.uint32
        extDevMetadataOffset: _c_lvm.uint64
        mdAlignment: _c_lvm.uint32
        numPEs6: _c_lvm.uint32
        flags: _c_lvm.uint32
        @overload
        def __init__(
            self,
            magic: _c_lvm.uint32 | None = ...,
            majorVersion: _c_lvm.uint32 | None = ...,
            minorVersion: _c_lvm.uint32 | None = ...,
            diskID: _c_lvm.SCSI_DiskId | None = ...,
            diskBlockSize: _c_lvm.uint32 | None = ...,
            totalBytes: _c_lvm.uint64 | None = ...,
            numVolumes: _c_lvm.uint32 | None = ...,
            numPEs: _c_lvm.uint32 | None = ...,
            lastPEIndex: _c_lvm.uint32 | None = ...,
            generation: _c_lvm.uint64 | None = ...,
            dataOffset: _c_lvm.uint64 | None = ...,
            devID: _c_lvm.UUID | None = ...,
            initTimeUS: _c_lvm.uint64 | None = ...,
            modTimeUS: _c_lvm.uint64 | None = ...,
            lockedBy: _c_lvm.UUID | None = ...,
            lockedWhenUS: _c_lvm.uint64 | None = ...,
            _unknown0: _c_lvm.uint32 | None = ...,
            numPEMaps: _c_lvm.uint32 | None = ...,
            extDevMetadataOffset: _c_lvm.uint64 | None = ...,
            mdAlignment: _c_lvm.uint32 | None = ...,
            numPEs6: _c_lvm.uint32 | None = ...,
            flags: _c_lvm.uint32 | None = ...,
        ): ...
        @overload
        def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...

    class LVM_ExtDevMetadata(__cs__.Structure):
        magic: _c_lvm.uint32
        numPEMaps: _c_lvm.uint32
        dataOffset: _c_lvm.uint64
        nextOffset: _c_lvm.uint64
        @overload
        def __init__(
            self,
            magic: _c_lvm.uint32 | None = ...,
            numPEMaps: _c_lvm.uint32 | None = ...,
            dataOffset: _c_lvm.uint64 | None = ...,
            nextOffset: _c_lvm.uint64 | None = ...,
        ): ...
        @overload
        def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...

    class LVM_VolID(__cs__.Structure):
        uuid: _c_lvm.UUID
        snapID: _c_lvm.uint32
        @overload
        def __init__(self, uuid: _c_lvm.UUID | None = ..., snapID: _c_lvm.uint32 | None = ...): ...
        @overload
        def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...

    class LVM_VolMetadata(__cs__.Structure):
        logicalSize: _c_lvm.uint64
        generation: _c_lvm.uint64
        state: _c_lvm.LVM_VolState
        name: __cs__.CharArray
        lvID: _c_lvm.LVM_VolID
        creationTimeUS: _c_lvm.uint64
        @overload
        def __init__(
            self,
            logicalSize: _c_lvm.uint64 | None = ...,
            generation: _c_lvm.uint64 | None = ...,
            state: _c_lvm.LVM_VolState | None = ...,
            name: __cs__.CharArray | None = ...,
            lvID: _c_lvm.LVM_VolID | None = ...,
            creationTimeUS: _c_lvm.uint64 | None = ...,
        ): ...
        @overload
        def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...

    class LVM_ExtVolMetadata(__cs__.Structure):
        numDevs: _c_lvm.uint32
        pad: __cs__.CharArray
        consumedPEs: _c_lvm.uint32
        @overload
        def __init__(
            self,
            numDevs: _c_lvm.uint32 | None = ...,
            pad: __cs__.CharArray | None = ...,
            consumedPEs: _c_lvm.uint32 | None = ...,
        ): ...
        @overload
        def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...

    class LVM_VolDescriptor(__cs__.Structure):
        volMeta: _c_lvm.LVM_VolMetadata
        volumeID: _c_lvm.uint32
        numPEs: _c_lvm.uint32
        firstPE: _c_lvm.uint64
        lastPE: _c_lvm.uint64
        modTimeUS: _c_lvm.uint64
        extVolMeta: _c_lvm.LVM_ExtVolMetadata
        pad: __cs__.CharArray
        @overload
        def __init__(
            self,
            volMeta: _c_lvm.LVM_VolMetadata | None = ...,
            volumeID: _c_lvm.uint32 | None = ...,
            numPEs: _c_lvm.uint32 | None = ...,
            firstPE: _c_lvm.uint64 | None = ...,
            lastPE: _c_lvm.uint64 | None = ...,
            modTimeUS: _c_lvm.uint64 | None = ...,
            extVolMeta: _c_lvm.LVM_ExtVolMetadata | None = ...,
            pad: __cs__.CharArray | None = ...,
        ): ...
        @overload
        def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...

    class LVM_VolTableEntry(__cs__.Structure):
        volDesc: _c_lvm.LVM_VolDescriptor
        @overload
        def __init__(self, volDesc: _c_lvm.LVM_VolDescriptor | None = ...): ...
        @overload
        def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...

    class LVM_PEDescriptor(__cs__.Structure):
        peID: _c_lvm.uint32
        volumeID: _c_lvm.uint32
        pOffset: _c_lvm.uint64
        lOffset: _c_lvm.uint64
        length: _c_lvm.uint64
        version: _c_lvm.uint32
        @overload
        def __init__(
            self,
            peID: _c_lvm.uint32 | None = ...,
            volumeID: _c_lvm.uint32 | None = ...,
            pOffset: _c_lvm.uint64 | None = ...,
            lOffset: _c_lvm.uint64 | None = ...,
            length: _c_lvm.uint64 | None = ...,
            version: _c_lvm.uint32 | None = ...,
        ): ...
        @overload
        def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...

    class LVM_PETableEntry(__cs__.Structure):
        used: _c_lvm.uint8
        peDesc: _c_lvm.LVM_PEDescriptor
        @overload
        def __init__(self, used: _c_lvm.uint8 | None = ..., peDesc: _c_lvm.LVM_PEDescriptor | None = ...): ...
        @overload
        def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...

    class LVM_SDTableEntry(__cs__.Structure):
        deviceName: __cs__.CharArray
        @overload
        def __init__(self, deviceName: __cs__.CharArray | None = ...): ...
        @overload
        def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...

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