from datetime import datetime from typing import Optional, List, Dict, Any from pydantic import BaseModel, ConfigDict # Channel Schemas class ChannelBase(BaseModel): name: str type: str config: Dict[str, Any] = {} tags: List[str] = [] is_active: bool = True class ChannelCreate(ChannelBase): pass class ChannelUpdate(BaseModel): name: Optional[str] = None type: Optional[str] = None config: Optional[Dict[str, Any]] = None tags: Optional[List[str]] = None is_active: Optional[bool] = None class Channel(ChannelBase): model_config = ConfigDict(from_attributes=True) id: int created_at: datetime updated_at: datetime class ChannelList(BaseModel): channels: List[Channel] total: int # Notification Schemas class NotificationBase(BaseModel): title: Optional[str] = None body: str priority: str = "normal" class NotificationCreate(NotificationBase): channel_id: int class Notification(NotificationBase): model_config = ConfigDict(from_attributes=True) id: int channel_id: int status: str error_msg: Optional[str] = None sent_at: Optional[datetime] = None created_at: datetime class NotificationResult(BaseModel): channel: str channel_id: int status: str notification_id: int error_msg: Optional[str] = None class NotifyRequest(BaseModel): channels: Optional[List[str]] = None tags: Optional[List[str]] = None title: Optional[str] = None body: str priority: str = "normal" class NotifyResponse(BaseModel): success: bool results: List[NotificationResult] total: int sent: int failed: int