from typing import Any, Literal

from ton_core.boc.address import Address
from ton_core.boc.cell import Cell
from ton_core.boc.slice import Slice
from ton_core.tlb.tlb import TlbError, TlbScheme

class Account(TlbScheme):
    addr: Address
    storage_stat: StorageInfo
    storage: AccountStorage
    def __init__(self, addr: Address, storage_stat: StorageInfo, storage: AccountStorage) -> None: ...
    def serialize(self) -> Cell: ...
    @classmethod
    def deserialize(cls, cell_slice: Slice) -> Account | None: ...

class AccountBlock(TlbScheme):
    account_addr: str
    transactions: tuple[dict[Any, Any], list[Any]]
    state_update: object
    def __init__(self, account_addr: str, transactions: tuple[dict[Any, Any], list[Any]], state_update: object) -> None: ...
    @classmethod
    def serialize(cls, *args: object) -> None: ...
    @classmethod
    def deserialize(cls, cell_slice: Slice) -> AccountBlock: ...

class AccountError(TlbError): ...

class AccountState(TlbScheme):
    type_: str
    state_init: StateInit
    state_hash: bytes
    def __init__(self, type_: str, **kwargs: object) -> None: ...
    def serialize(self) -> Cell: ...
    @classmethod
    def deserialize(cls, cell_slice: Slice) -> AccountState: ...

class AccountStatus(TlbScheme):
    type_: Literal["uninitialized", "frozen", "active", "nonexist"]
    def __init__(self, type_: Literal["uninitialized", "frozen", "active", "nonexist"]) -> None: ...
    def serialize(self) -> Cell: ...
    @classmethod
    def deserialize(cls, cell_slice: Slice) -> AccountStatus: ...

class AccountStorage(TlbScheme):
    last_trans_lt: int
    balance: object
    state: AccountState
    def __init__(self, last_trans_lt: int, balance: object, state: AccountState) -> None: ...
    def serialize(self) -> Cell: ...
    @classmethod
    def deserialize(cls, cell_slice: Slice) -> AccountStorage: ...

class ShardAccount(TlbScheme):
    account: Account | None
    last_trans_hash: bytes
    last_trans_lt: int
    cell: Cell | None
    def __init__(self, account: Account | None, last_trans_hash: bytes, last_trans_lt: int, cell: Cell | None = ...) -> None: ...
    def serialize(self) -> Cell: ...
    @classmethod
    def deserialize(cls, cell_slice: Slice) -> ShardAccount: ...

class SimpleAccount(TlbScheme):
    address: Address
    balance: int
    state: SimpleAccountState
    def __init__(self, address: Address, balance: int, state: SimpleAccountState) -> None: ...
    @classmethod
    def serialize(cls, *args: object) -> None: ...
    @classmethod
    def deserialize(cls, *args: object) -> None: ...
    @classmethod
    def from_raw(cls, account: Account | None, address: Address | None = ...) -> SimpleAccount: ...
    def is_uninitialized(self) -> bool: ...
    def is_frozen(self) -> bool: ...
    def is_active(self) -> bool: ...

class SimpleAccountState(TlbScheme):
    type_: Literal["uninitialized", "frozen", "active"]
    state_hash: bytes | None
    state_init: StateInit | None
    def __init__(self, type_: Literal["uninitialized", "frozen", "active"], state_hash: bytes | None = ..., state_init: StateInit | None = ...) -> None: ...
    @classmethod
    def serialize(cls, *args: object) -> None: ...
    @classmethod
    def deserialize(cls, *args: object) -> None: ...
    @classmethod
    def from_raw(cls, account_state: AccountState | None) -> SimpleAccountState: ...

class StateInit(TlbScheme):
    split_depth: int | None
    special: TickTock | None
    code: Cell | None
    data: Cell | None
    library: Cell | None
    def __init__(self, split_depth: int | None = ..., special: TickTock | None = ..., code: Cell | None = ..., data: Cell | None = ..., library: Cell | None = ...) -> None: ...
    def serialize(self) -> Cell: ...
    @classmethod
    def deserialize(cls, cell_slice: Slice) -> StateInit: ...

class StorageExtraInfo(TlbScheme):
    type_: Literal["storage_extra_none", "storage_extra_info"]
    dict_hash: bytes | None
    def __init__(self, type_: Literal["storage_extra_none", "storage_extra_info"], dict_hash: bytes | None = ...) -> None: ...
    def serialize(self) -> Cell: ...
    @classmethod
    def deserialize(cls, cell_slice: Slice) -> StorageExtraInfo: ...

class StorageInfo(TlbScheme):
    used: StorageUsed
    last_paid: int
    storage_extra: StorageExtraInfo
    due_payment: int | None
    def __init__(self, used: StorageUsed, storage_extra: StorageExtraInfo, last_paid: int, due_payment: int | None) -> None: ...
    def serialize(self) -> Cell: ...
    @classmethod
    def deserialize(cls, cell_slice: Slice) -> StorageInfo: ...

class StorageUsed(TlbScheme):
    cells: int
    bits: int
    public_cells: int | None
    def __init__(self, cells: int, bits: int, *args: object, **kwargs: object) -> None: ...
    def serialize(self) -> Cell: ...
    @classmethod
    def deserialize(cls, cell_slice: Slice) -> StorageUsed: ...

class StorageUsedShort(TlbScheme):
    cells: int
    bits: int
    def __init__(self, cells: int, bits: int) -> None: ...
    @classmethod
    def serialize(cls, *args: object) -> None: ...
    @classmethod
    def deserialize(cls, cell_slice: Slice) -> StorageUsedShort: ...

class TickTock(TlbScheme):
    tick: bool
    tock: bool
    def __init__(self, tick: bool, tock: bool) -> None: ...
    def serialize(self) -> Cell: ...
    @classmethod
    def deserialize(cls, cell_slice: Slice) -> TickTock: ...
