from typing import Any

class TagGraph:
    def collect_tags(self) -> list[str]: ...

class Query:
    def is_match(self, graph: TagGraph) -> bool: ...
    def to_sql(self, args: list[Any]) -> str: ...
    def meta_queries(self) -> list[tuple[bool, str, str]]: ...

class Implication:
    def __init__(self, condition: list[str], consequence: list[str]): ...

class Patch:
    def is_empty(self) -> bool: ...
    def to_bytes(self) -> bytes: ...
    @staticmethod
    def from_bytes(data: bytes) -> "Patch": ...
    def apply_to(self, graph: TagGraph): ...

class PostProcessor:
    def add_definition(self, tag: str, query: Query): ...
    def remove_definition(self, tag: str): ...
    def get_definition(self, tag: str) -> Query | None: ...
    def add_implication(self, implication: Implication): ...
    def remove_implication(self, implication: Implication): ...
    def make_patch(self, graph: TagGraph) -> Patch: ...

def parse_tag_graph(graph: str) -> TagGraph: ...
def parse_query(query: str, inline: bool = False) -> Query: ...
def parse_implication(implication: str) -> Implication: ...
