TorbatYar/backend/services/crm/app/providers/contracts.py
Mortezakoohjani 064d67f099 Ship CRM Core Platform (phases 6.0–6.3) with docs and prod deploy.
Add the Sales CRM service through collaboration, sync architecture/registry docs, expose crm.torbatyar.ir, and include a production deploy script.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-24 20:32:00 +03:30

83 lines
2.4 KiB
Python

"""Platform capability contracts — interfaces only; no implementations in CRM."""
from __future__ import annotations
from typing import Any, Protocol
from uuid import UUID
class AutomationProvider(Protocol):
"""Contract for future Automation Platform. CRM must not own workflows."""
async def trigger_workflow(
self, *, tenant_id: UUID, workflow_key: str, payload: dict[str, Any]
) -> None: ...
class Customer360Provider(Protocol):
"""Contract for future Customer360. CRM must not own unified customer profile."""
async def upsert_party_reference(
self, *, tenant_id: UUID, source: str, source_id: UUID, payload: dict[str, Any]
) -> None: ...
class NotificationProvider(Protocol):
"""Contract for future Notification service. CRM 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 future Analytics Platform. CRM must not own analytics store."""
async def track(
self, *, tenant_id: UUID, event_name: str, properties: dict[str, Any]
) -> None: ...
class AIProvider(Protocol):
"""Contract for future AI Platform. CRM must not own model inference."""
async def suggest(
self, *, tenant_id: UUID, task: str, context: dict[str, Any]
) -> dict[str, Any]: ...
class CommunicationProvider(Protocol):
"""Contract for future Communication Platform. CRM must not own messaging."""
async def send_message(
self, *, tenant_id: UUID, channel: str, to: str, body: str
) -> None: ...
class HelpdeskProvider(Protocol):
"""Contract for future Helpdesk Platform. CRM must not own tickets."""
async def create_ticket_reference(
self, *, tenant_id: UUID, subject: str, related_crm_id: UUID
) -> None: ...
class FileStorageProvider(Protocol):
"""Contract for File Storage service. CRM stores references only."""
async def resolve_file(
self, *, tenant_id: UUID, file_storage_id: str
) -> dict[str, Any]: ...
class ProductServiceProvider(Protocol):
"""Contract for Product Service. CRM stores product_ref only — no inventory."""
async def resolve_product(
self, *, tenant_id: UUID, product_ref_id: str
) -> dict[str, Any]: ...