from __future__ import annotations

from typing import Any, TypeVar

from .builder import Builder as Builder
from .deserialize import NullCell
from .exotic import LevelMask
from .slice import Slice as Slice
from .tvm_bitarray import BitarrayLike, TvmBitarray

_CellT = TypeVar("_CellT", bound="Cell")

class CellError(Exception): ...

class Cell(NullCell):
    bits: TvmBitarray
    refs: list[Cell]
    type_: int
    is_exotic: bool
    level_mask: LevelMask

    def __init__(
        self,
        bits: BitarrayLike,
        refs: list[Cell],
        cell_type: int = ...,
    ) -> None: ...
    @classmethod
    def empty(cls: type[_CellT]) -> _CellT: ...
    def resolve_mask(self) -> LevelMask: ...
    def to_builder(self) -> Builder: ...
    def to_slice(self) -> Slice: ...
    def get_refs_descriptor(self, lvl_mask: LevelMask) -> bytes: ...
    def get_bits_descriptor(self) -> bytes: ...
    def get_descriptors(self, lvl_mask: LevelMask = ...) -> bytes: ...
    def get_depth(self, lvl_mask: int = ...) -> int: ...
    def get_data_bytes(self) -> bytes: ...
    def get_representation(self) -> bytes: ...
    @property
    def hash(self) -> bytes: ...
    @property
    def data(self) -> bytes: ...
    def get_hash(self, lvl_mask: int) -> bytes: ...
    def calculate_hashes(self) -> None: ...
    def calculate_representation_hash(self) -> bytes: ...
    def order(self, result: dict[Any, Any] = ...) -> dict[Any, Any]: ...
    def serialize(self, indexes: dict[Any, Any], byte_len: int) -> bytes: ...
    def to_boc(
        self,
        has_idx: bool = ...,
        hash_crc32: bool = ...,
        has_cache_bits: bool = ...,
        flags: int = ...,
    ) -> bytes: ...
    @classmethod
    def from_boc(cls: type[_CellT], data: Any) -> list[_CellT]: ...
    @classmethod
    def one_from_boc(cls: type[_CellT], data: Any) -> _CellT: ...
    def begin_parse(self) -> Slice: ...
    def copy(self) -> Cell: ...
    def __hash__(self) -> int: ...
    def __getitem__(self, ref_i: int) -> Cell: ...
    def __eq__(self, other: object) -> bool: ...
    def __repr__(self) -> str: ...
