# ----------------------------------------------------------------------------
#
#  Welcome to Baml! To use this generated code, please run the following:
#
#  $ pip install baml
#
# ----------------------------------------------------------------------------

# This file was generated by BAML: please do not edit it. Instead, edit the
# BAML files and re-generate this code using: baml-cli generate
# baml-cli is available with the baml package.

import threading
from typing import Any, Callable, Generic, Literal, Protocol, TypeVar, overload

T = TypeVar("T")


class BlockEvent:
    def __init__(self, block_label: str, event_type: str):
        self.block_label = block_label
        self.event_type = event_type  # "enter" | "exit"


class VarEvent(Generic[T]):
    def __init__(self, variable_name: str, value: T, timestamp: str, function_name: str):
        self.variable_name = variable_name
        self.value = value
        self.timestamp = timestamp
        self.function_name = function_name


BlockHandler = Callable[[BlockEvent], None]
VarEventHandler = Callable[[VarEvent[T]], None]
StreamHandler = Callable[[Any], None]  # Stream will be an async iterator


class InternalEventBindings(Protocol):
    function_name: str
    block: list[BlockHandler]
    vars: dict[str, list[VarEventHandler[Any]]]
    streams: dict[str, list[StreamHandler]]
    functions: dict[str, "InternalEventBindings"]


class EventCollectorInternal(Protocol):
    def __handlers__(self) -> InternalEventBindings: ...
