ifixkart-admin/Backend/app/schemas/NotificationGateway.py
Adithiyan bbd3a3e959 feat: initial commit — full platform snapshot
- Backend: FastAPI app with all models, services, schemas, routes
- Admin Panel: Next.js dashboard with all modules
  (CRM, POS, repairs, warranties, billing, notifications, etc.)
- Ecommerce: storefront (submodule) + product catalog
- AI Agents: .agents/ skill library for Antigravity IDE
- Docs: architecture, billing, notification gateway markdown
- Submodules: Backend/OpenWA, Ecommerce/File 2/storefront
2026-10-13 12:59:47 +05:30

85 lines
2.6 KiB
Python

from datetime import datetime
from typing import Optional, List
from pydantic import BaseModel, Field
class NotificationDispatchCreate(BaseModel):
recipient: str = Field(..., description="Phone number for WhatsApp/SMS or Email address")
channel: str = Field(..., description="WHATSAPP, EMAIL, or WEB_PUSH")
subject: Optional[str] = None
message_body: str
template_id: Optional[str] = None
class EntityNotificationDispatchCreate(BaseModel):
channel: str = Field(..., description="EMAIL, WHATSAPP, or BOTH")
notification_type: str = Field(..., description="QUOTATION, INVOICE, REPAIR_TICKET, LEAD_QUALIFIED")
entity_id: str = Field(..., description="Primary key or quote number, e.g., SQ-2026-001")
idempotency_key: Optional[str] = Field(None, description="Explicit client or backend idempotency key")
custom_note: Optional[str] = Field(None, description="Optional custom note or staff instruction")
class NotificationAttemptResponse(BaseModel):
attempt_id: str
notification_id: str
attempt_number: int
provider: str
request_id: Optional[str] = None
status: str
error_log: Optional[str] = None
created_at: datetime
class Config:
from_attributes = True
class NotificationResponse(BaseModel):
notification_id: str
tenant_id: str
event_id: Optional[str] = None
notification_type: Optional[str] = None
entity_id: Optional[str] = None
idempotency_key: Optional[str] = None
recipient: str
channel: str
template_id: Optional[str] = None
status: str
subject: Optional[str] = None
message_body: str
attempt_count: int = 0
last_attempt_at: Optional[datetime] = None
next_retry_at: Optional[datetime] = None
last_error: Optional[str] = None
provider_response: Optional[str] = None
is_duplicate: bool = False
completed_at: Optional[datetime] = None
created_at: datetime
attempts: List[NotificationAttemptResponse] = []
class Config:
from_attributes = True
class DeadLetterNotificationResponse(BaseModel):
dlq_id: str
tenant_id: str
notification_id: str
reason: str
failed_at: datetime
is_resolved: bool
resolved_at: Optional[datetime] = None
class Config:
from_attributes = True
class WhatsAppSessionStatusResponse(BaseModel):
session_id: str
tenant_id: str
session_name: str
status: str
battery_level: Optional[int] = None
last_ping_at: Optional[datetime] = None
class Config:
from_attributes = True
class WhatsAppSessionQRResponse(BaseModel):
session_id: str
session_name: str
status: str
qr_code_base64: Optional[str] = None