"""
LangGraph callback handler for automatic usage tracking with Paygent.
This callback intercepts LangGraph/LangChain LLM calls and automatically sends usage data to Paygent.
"""

from typing import Any, Dict, List, Optional
from uuid import UUID

from .langchain_wrapper import PaygentLangChainCallback

class PaygentLangGraphCallback(PaygentLangChainCallback):
    """
    LangGraph callback handler that automatically tracks usage with Paygent.
    This is an alias for PaygentLangChainCallback since LangGraph uses
    the same callback architecture under the hood.
    
    Usage example:
    ```python
    from paygent_sdk import Client, PaygentLangGraphCallback
    from langgraph.graph import StateGraph
    
    paygent_client = Client("your-api-key")
    callback = PaygentLangGraphCallback(
        paygent_client,
        indicator="graph_execution",
        external_agent_id="agent-123",
        external_customer_id="customer-456"
    )
    
    # Pass the callback when invoking the graph
    app.invoke({"messages": [HumanMessage(content="Hello")]}, config={"callbacks": [callback]})
    ```
    """
    
    def __init__(
        self,
        paygent_client,
        indicator: str,
        external_agent_id: str,
        external_customer_id: str,
        external_customer_name: Optional[str] = None
    ):
        """
        Create a new PaygentLangGraphCallback.
        
        Args:
            paygent_client: The Paygent client instance for usage tracking
            indicator: Indicator for the usage event (e.g., "graph_execution")
            external_agent_id: External agent identifier
            external_customer_id: External customer identifier
            external_customer_name: Optional External customer name
        """
        super().__init__(
            paygent_client=paygent_client,
            indicator=indicator,
            external_agent_id=external_agent_id,
            external_customer_id=external_customer_id,
            external_customer_name=external_customer_name
        )
