from _typeshed import ReadableBuffer
from typing import ClassVar, final
from cramjam import Buffer, BufferInput, BufferOutput

@final
class Filter:
    Arm: ClassVar[Filter]
    ArmThumb: ClassVar[Filter]
    Ia64: ClassVar[Filter]
    Lzma1: ClassVar[Filter]
    Lzma2: ClassVar[Filter]
    PowerPC: ClassVar[Filter]
    Sparc: ClassVar[Filter]
    X86: ClassVar[Filter]

@final
class MatchFinder:
    HashChain3: ClassVar[MatchFinder]
    HashChain4: ClassVar[MatchFinder]
    BinaryTree2: ClassVar[MatchFinder]
    BinaryTree3: ClassVar[MatchFinder]
    BinaryTree4: ClassVar[MatchFinder]

@final
class Mode:
    Fast: ClassVar[Mode]
    Normal: ClassVar[Mode]

@final
class Format:
    AUTO: ClassVar[Format]
    XZ: ClassVar[Format]
    ALONE: ClassVar[Format]
    RAW: ClassVar[Format]

@final
class Check:
    Crc64: ClassVar[Check]
    Crc32: ClassVar[Check]
    Sha256: ClassVar[Check]
    NONE: ClassVar[Check]

class Options:
    def __init__(self) -> None: ...
    def set_preset(self, preset: int) -> Options: ...
    def set_dict_size(self, dict_size: int) -> Options: ...
    def set_lc(self, lc: int) -> Options: ...
    def set_lp(self, lp: int) -> Options: ...
    def set_pb(self, pb: int) -> Options: ...
    def set_mode(self, mode: Mode) -> Options: ...
    def set_nice_len(self, nice_len: int) -> Options: ...
    def set_mf(self, mf: MatchFinder) -> Options: ...
    def set_depth(self, depth: int) -> Options: ...

class FilterChainItem:
    def __init__(self, filter: Filter, options: Options | None = None) -> None: ...

class FilterChain:
    def __init__(self) -> None: ...
    def append_filter(self, filter_chain_item: FilterChainItem) -> None: ...

def compress(
    data: BufferInput,
    preset: int | None = None,
    format: Format | None = None,
    check: Check | None = None,
    filters: FilterChain | None = None,
    options: Options | None = None,
    output_len: int | None = None,
) -> Buffer: ...
def compress_into(
    input: BufferInput,
    output: BufferOutput,
    preset: int | None = None,
    format: Format | None = None,
    check: Check | None = None,
    filters: FilterChain | None = None,
    options: Options | None = None,
) -> int: ...
def decompress_into(input: BufferInput, output: BufferOutput) -> int: ...
def decompress(data: BufferInput, output_len: int | None = None) -> Buffer: ...

class Compressor:
    def __init__(self, preset: int | None = None) -> None: ...
    def compress(self, input: ReadableBuffer) -> int: ...
    def flush(self) -> Buffer: ...
    def finish(self) -> Buffer: ...

class Decompressor:
    def __init__(self) -> None: ...
    def len(self) -> int: ...
    def decompress(self, input: BufferInput) -> int: ...
    def flush(self) -> Buffer: ...
    def finish(self) -> Buffer: ...
    def __len__(self) -> int: ...
    def __contains__(self, x: BufferInput) -> bool: ...
    def __repr__(self) -> str: ...
    def __bool__(self) -> bool: ...
