"""
Schemas for notification API responses
"""
from typing import Optional, Dict, Any
from datetime import datetime
from pydantic import BaseModel, Field


class NotificationProductInfo(BaseModel):
    """Product information in notification"""
    product_id: int
    product_name: str
    product_image: Optional[str] = None


class NotificationStoreInfo(BaseModel):
    """Store information in notification"""
    store_id: int
    store_name: str
    store_location: str


class NotificationResponse(BaseModel):
    """Notification response model"""
    notification_id: int
    title: str
    body: str
    image_url: Optional[str] = None
    notification_type: str
    data: Dict[str, Any] = Field(default_factory=dict)
    product_id: Optional[int] = None
    store_id: Optional[int] = None
    listing_id: Optional[int] = None
    distance_km: Optional[float] = None
    is_read: bool
    fcm_sent: bool
    sent_at: Optional[str] = None
    read_at: Optional[str] = None
    created_at: Optional[str] = None
    product: Optional[NotificationProductInfo] = None
    store: Optional[NotificationStoreInfo] = None


class NotificationListResponse(BaseModel):
    """Response for notification list"""
    notifications: list[NotificationResponse]
    total: int
    skip: int
    limit: int
    unread_only: bool = False


class UnreadCountResponse(BaseModel):
    """Response for unread count"""
    unread_count: int


class MarkReadResponse(BaseModel):
    """Response for marking notification as read"""
    notification_id: int
    is_read: bool
    read_at: Optional[str] = None
    message: str


class MarkAllReadResponse(BaseModel):
    """Response for marking all notifications as read"""
    updated_count: int
    message: str


class DeleteNotificationResponse(BaseModel):
    """Response for deleting notification"""
    notification_id: int
    message: str

