from collections.abc import Iterable
from typing import Any, TypeVar

from .address import Address, ExternalAddress
from .cell import Cell
from .deserialize import NullCell
from .slice import Slice
from .tvm_bitarray import TvmBitarray

_B = TypeVar("_B", bound="Builder")

class Builder(NullCell):
    def __init__(self, size: int = ..., type_: int = ...) -> None: ...
    @property
    def bits(self) -> TvmBitarray: ...
    @bits.setter
    def bits(self, value: TvmBitarray) -> None: ...
    @property
    def refs(self) -> list[Cell]: ...
    @refs.setter
    def refs(self, value: list[Cell]) -> None: ...
    @property
    def size(self) -> int: ...
    @size.setter
    def size(self, value: int) -> None: ...
    @property
    def used_bits(self) -> int: ...
    @property
    def available_bits(self) -> int: ...
    @property
    def available_bytes(self) -> int: ...
    @property
    def available_refs(self) -> int: ...
    def to_bytes(self) -> bytes: ...
    def store_cell(self: _B, cell: Cell) -> _B: ...
    def store_slice(self: _B, cell_slice: Slice) -> _B: ...
    def store_ref(self: _B, ref: Cell) -> _B: ...
    def store_bool(self: _B, value: bool) -> _B: ...
    def store_bit_int(self: _B, bit: int) -> _B: ...
    def store_bit(self: _B, bit: int | bool | str | TvmBitarray) -> _B: ...
    def store_bits(self: _B, bits: str | Iterable[int] | TvmBitarray) -> _B: ...
    def store_maybe_ref(self: _B, ref: Cell | None) -> _B: ...
    def store_uint(self: _B, value: int, size: int) -> _B: ...
    def store_int(self: _B, value: int, size: int) -> _B: ...
    def store_var_uint(self: _B, value: int, bit_length: int) -> _B: ...
    def store_var_int(self: _B, value: int, bit_length: int) -> _B: ...
    def store_coins(self: _B, amount: int) -> _B: ...
    def store_bytes(self: _B, value: bytes | bytearray) -> _B: ...
    def store_string(self: _B, value: str) -> _B: ...
    def store_snake_bytes(self: _B, value: bytes) -> _B: ...
    def store_snake_string(self: _B, value: str, need_prefix: bool = ...) -> _B: ...
    def store_address(self: _B, address: Address | ExternalAddress | str | None) -> _B: ...
    def store_dict(self: _B, dict_: Cell | None = ...) -> _B: ...
    def end_cell(self) -> Cell: ...
    def to_cell(self) -> Cell: ...
    def to_slice(self) -> Slice: ...
    @classmethod
    def from_boc(cls, data: Any) -> list[Cell]: ...
    @classmethod
    def one_from_boc(cls, data: Any) -> Cell: ...
    def __repr__(self) -> str: ...
