"""EchoFunction — minimal governed function example."""
from __future__ import annotations

from typing import Any

from gsap_broker.functions.base import FunctionContext, FunctionPlugin, FunctionResult


class EchoFunction(FunctionPlugin):
    function_id = "echo-function"
    corpus_entry_cid = "sha256:" + "e" * 64
    capability_mask = 1  # READ
    trigger_events = ["CONNECTOR_INVOKED"]
    accord_template = ""
    gsap_required = False
    chronicle_enabled = True
    max_duration_seconds = 5
    display_name = "Echo Function"
    description = "Returns event data unchanged — used for integration testing."
    version = "0.1.0"

    async def handle(self, event: dict[str, Any], context: FunctionContext) -> FunctionResult:
        return FunctionResult(success=True, data=event)

    def health_check(self) -> bool:
        return True
