from __future__ import annotations

import logging

from sqlalchemy.ext.asyncio import AsyncSession

from shared.events import register_handler
from shared.models.domain_event import DomainEvent

log = logging.getLogger(__name__)


async def on_order_created(event: DomainEvent, session: AsyncSession) -> None:
    log.info("order.created: order_id=%s", event.payload.get("order_id"))


async def on_order_paid(event: DomainEvent, session: AsyncSession) -> None:
    log.info("order.paid: order_id=%s", event.payload.get("order_id"))


register_handler("order.created", on_order_created)
register_handler("order.paid", on_order_paid)
