from collections.abc import Callable
from typing import Any

from .address import Address, ExternalAddress
from .builder import Builder
from .cell import Cell
from .deserialize import NullCell
from .tvm_bitarray import BitarrayLike, TvmBitarray

class SliceError(Exception): ...


class Slice(NullCell):
    bits: TvmBitarray
    refs: list[Cell]
    type_: int
    ref_offset: int

    def __init__(
        self,
        bits: TvmBitarray,
        refs: list[Cell],
        type_: int = ...,
    ) -> None: ...
    @property
    def remaining_bits(self) -> int: ...
    @property
    def remaining_refs(self) -> int: ...
    def is_special(self) -> bool: ...
    def preload_bit(self) -> int: ...
    def load_bit(self) -> int: ...
    def preload_bool(self) -> bool: ...
    def load_bool(self) -> bool: ...
    def skip_bits(self, length: int) -> Slice: ...
    def preload_bits(self, length: int) -> BitarrayLike: ...
    def load_bits(self, length: int) -> BitarrayLike: ...
    def preload_uint(self, length: int) -> int: ...
    def load_uint(self, length: int) -> int: ...
    def preload_int(self, length: int) -> int: ...
    def load_int(self, length: int) -> int: ...
    def preload_bytes(self, length: int) -> bytes: ...
    def load_bytes(self, length: int) -> bytes: ...
    def preload_address(self) -> Address | ExternalAddress | None: ...
    def load_address(self) -> Address | ExternalAddress | None: ...
    def preload_var_uint(self, bit_length: int) -> int: ...
    def load_var_uint(self, bit_length: int) -> int: ...
    def preload_var_int(self, bit_length: int) -> int: ...
    def load_var_int(self, bit_length: int) -> int: ...
    def preload_coins(self) -> int: ...
    def load_coins(self) -> int | None: ...
    def preload_string(self, byte_length: int = ...) -> str: ...
    def load_string(self, byte_length: int = ...) -> str: ...
    def load_snake_bytes(self) -> bytes: ...
    def load_snake_string(self) -> str: ...
    def preload_ref(self, offset: int = ...) -> Cell: ...
    def load_ref(self) -> Cell: ...
    def preload_maybe_ref(self) -> Cell | None: ...
    def load_maybe_ref(self) -> Cell | None: ...
    def load_hashmap(
        self,
        key_length: int,
        key_deserializer: Callable[..., Any] | None = ...,
        value_deserializer: Callable[..., Any] | None = ...,
    ) -> dict[Any, Any] | None: ...
    def load_hashmap_aug(
        self,
        key_length: int,
        x_deserializer: Callable[..., Any] | None = ...,
        y_deserializer: Callable[..., Any] | None = ...,
    ) -> tuple[dict[Any, Any], list[Any]] | None: ...
    def load_hashmap_aug_e(
        self,
        key_length: int,
        x_deserializer: Callable[..., Any] | None = ...,
        y_deserializer: Callable[..., Any] | None = ...,
    ) -> tuple[dict[Any, Any], list[Any]] | Cell: ...
    def preload_dict(
        self,
        key_length: int,
        key_deserializer: Callable[..., Any] | None = ...,
        value_deserializer: Callable[..., Any] | None = ...,
    ) -> dict[Any, Any] | None: ...
    def load_dict(
        self,
        key_length: int,
        key_deserializer: Callable[..., Any] | None = ...,
        value_deserializer: Callable[..., Any] | None = ...,
    ) -> dict[Any, Any] | None: ...
    def to_cell(self) -> Cell: ...
    def to_builder(self) -> Builder: ...
    @classmethod
    def from_cell(cls, cell: Cell) -> Slice: ...
    @classmethod
    def one_from_boc(cls, data: Any) -> Slice: ...
    def copy(self) -> Slice: ...
    def __repr__(self) -> str: ...
    def __str__(self, t: int = ..., comma: bool = ...) -> str: ...
