TorbatYar/backend/services/loyalty/app/providers/contracts.py
Mortezakoohjani e41ecfad4c Sync platform docs, infra, and module services with Accounting integration.
Include Loyalty/Communication/Sports Center backends and registry updates alongside production nginx and compose wiring.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-25 22:35:23 +03:30

81 lines
2.2 KiB
Python

"""Platform capability contracts — interfaces only; no implementations in Loyalty."""
from __future__ import annotations
from typing import Any, Protocol
from uuid import UUID
class NotificationProvider(Protocol):
"""Contract for Notification service. Loyalty must not own delivery."""
async def notify(
self,
*,
tenant_id: UUID,
channel: str,
template_key: str,
payload: dict[str, Any],
) -> None: ...
class AnalyticsProvider(Protocol):
"""Contract for Analytics. Loyalty analytics engine arrives in Phase 7.8."""
async def track(
self, *, tenant_id: UUID, event_name: str, properties: dict[str, Any]
) -> None: ...
class Customer360Provider(Protocol):
"""Contract for Customer360. Loyalty stores external_customer_ref only."""
async def upsert_party_reference(
self, *, tenant_id: UUID, source: str, source_id: UUID, payload: dict[str, Any]
) -> None: ...
class AIProvider(Protocol):
"""Contract for AI Platform. Loyalty must not own model inference."""
async def suggest(
self, *, tenant_id: UUID, task: str, context: dict[str, Any]
) -> dict[str, Any]: ...
class ModuleIntegrationProvider(Protocol):
"""Contract for business modules (Restaurant, Marketplace, Ecommerce, …)."""
async def resolve_source_event(
self, *, tenant_id: UUID, module_key: str, event_ref: str
) -> dict[str, Any]: ...
class CRMProvider(Protocol):
"""Contract for CRM references. Loyalty does not own CRM entities."""
async def resolve_contact(
self, *, tenant_id: UUID, contact_ref: str
) -> dict[str, Any]: ...
class CommunicationProvider(Protocol):
"""Contract for Communication Platform. Loyalty must not own delivery."""
async def send(
self,
*,
tenant_id: UUID,
channel: str,
to: str,
template_key: str,
payload: dict[str, Any],
) -> None: ...
class FileStorageProvider(Protocol):
"""Contract for File Storage. Loyalty stores references only."""
async def resolve_file(
self, *, tenant_id: UUID, file_storage_id: str
) -> dict[str, Any]: ...