"""Type stubs for the public pyaxml API."""

from typing import Any
from pyaxml.proto import axml_pb2

Element = Any  # lxml.etree._Element or xml.etree.ElementTree.Element

class StringBlocks:
    """Compatibility class for string pool manipulation via protobuf."""

    def __init__(self, proto: Any = None) -> None: ...
    @property
    def proto(self) -> Any: ...
    @proto.setter
    def proto(self, value: Any) -> None: ...
    def switch(self, old_str: str, new_str: str) -> None: ...
    def decode_str(self, idx: int) -> str: ...

class StringBlocksProxy:
    """Proxy for AXML.stringblocks allows .proto get/set."""

    @property
    def proto(self) -> Any: ...
    @proto.setter
    def proto(self, value: Any) -> None: ...

class AXML:
    """Android Binary XML document wrapper."""

    def __init__(self) -> None: ...
    @classmethod
    def from_axml(cls, data: bytes) -> "AXML": ...
    def pack(self) -> bytes: ...
    def to_xml(self) -> Element: ...
    def from_xml(self, element: "Element | str") -> None: ...
    def compute(self) -> None: ...
    def string_count(self) -> int: ...
    def get_string(self, idx: int) -> str: ...
    @property
    def stringblocks(self) -> StringBlocksProxy: ...
    def to_proto(self) -> "axml_pb2.AXML": ...  # type: ignore[name-defined]
    @classmethod
    def from_proto(cls, proto: "axml_pb2.AXML") -> "AXML": ...  # type: ignore[name-defined]

class ARSC:
    """Android Resource Table container."""

    @classmethod
    def from_axml(cls, data: bytes) -> "ARSC": ...
    def list_packages(self, language: str | None = None) -> str: ...
    def package_count(self) -> int: ...
    def compute(self) -> None: ...
    @property
    def proto(self) -> "axml_pb2.ARSC": ...  # type: ignore[name-defined]
    def get_packages(self) -> list: ...
    def get_id_public(
        self,
        pkg: Any,
        type_name: str,
        name: str,
        language: str | None = None,
    ) -> tuple[int, int]: ...
    def add_id_public(self, pkg: Any, type_name: str, name: str, path: str) -> None: ...
    def to_proto(self) -> "axml_pb2.ARSC": ...  # type: ignore[name-defined]
    @classmethod
    def from_proto(cls, proto: "axml_pb2.ARSC") -> "ARSC": ...  # type: ignore[name-defined]

class AXMLGuess:
    """Auto-detect binary format (AXML or ARSC) and parse accordingly."""

    @classmethod
    def from_axml(cls, data: bytes) -> tuple: ...

__version__: str
