"""
{{ display_name }} - State definition.

This module defines the state schema for the webhook handler workflow.
"""

from typing import Annotated, Optional

from torivers_sdk.automation import BaseState, merge_dict, merge_list


class {{ class_name }}State(BaseState):
    """State for {{ display_name }} webhook handler.

    Attributes:
        event_type: Type of webhook event.
        payload: Webhook payload data.
        headers: Request headers.
        event_id: Unique event identifier.
        is_valid: Whether event passed validation.
        processed: Whether event was processed.
        actions_taken: List of actions performed.
        response: Response data for caller.
    """

    # Input fields
    event_type: Optional[str] = None
    payload: Annotated[dict, merge_dict] = {}
    headers: Annotated[dict, merge_dict] = {}
    timestamp: Optional[str] = None

    # Processing fields
    event_id: Optional[str] = None
    is_valid: bool = False
    validation_errors: Annotated[list, merge_list] = []

    # Output fields
    processed: bool = False
    actions_taken: Annotated[list, merge_list] = []
    response: Annotated[dict, merge_dict] = {}

    # Accumulated metadata
    metadata: Annotated[dict, merge_dict] = {}
