import logging
from defence360agent.contracts.messages import MessageType
from defence360agent.model.wordpress import WPSite

logger = logging.getLogger(__name__)


async def send_event(sink, event: str, site: WPSite, version: str = None):
    if version is None:
        version = "1.0.0"

    await sink.process_message(
        MessageType.WordpressPluginTelemetry(
            event=event,
            domain=site.domain,
            site_path=site.docroot,
            user=site.uid,
            plugin_version=version,
        )
    )
