from enum import IntEnum

SQUASHFS_CHECK = 2

SQUASHFS_UIDS = 256
SQUASHFS_GUIDS = 255

SQUASHFS_MAJOR = 4
SQUASHFS_MINOR = 0
SQUASHFS_MAGIC = 0x73717368
SQUASHFS_START = 0

SQUASHFS_METADATA_SIZE = 8192
SQUASHFS_METADATA_LOG = 13

FRAGMENT_BUFFER_DEFAULT = 256
DATA_BUFFER_DEFAULT = 256

SQUASHFS_NAME_LEN = 256
SQUASHFS_INVALID = 0xFFFFFFFFFFFF
SQUASHFS_INVALID_FRAG = 0xFFFFFFFF
SQUASHFS_INVALID_XATTR = 0xFFFFFFFF
SQUASHFS_INVALID_BLK = 0xFFFFFFFFFFFFFFFF  # -1
SQUASHFS_USED_BLK = SQUASHFS_INVALID_BLK - 1  # -2

SQUASHFS_COMPRESSED_BIT = 1 << 15
SQUASHFS_COMPRESSED_BIT_BLOCK = 1 << 24


class Type(IntEnum):
    DIR = 1
    FILE = 2
    SYMLINK = 3
    BLKDEV = 4
    CHRDEV = 5
    FIFO = 6
    SOCKET = 7
    LDIR = 8
    LREG = 9
    LSYMLINK = 10
    LBLKDEV = 11
    LCHRDEV = 12
    LFIFO = 13
    LSOCKET = 14


class Compression(IntEnum):
    NO = 0
    ZLIB = 1
    LZMA = 2
    LZO = 3
    XZ = 4
    LZ4 = 5
    ZSTD = 6
