from pydantic import BaseModel
from typing import Optional, List
from datetime import datetime


class NotificationCreate(BaseModel):
    """Create notification schema"""
    user_id: int
    notification_type: str
    title: str
    message: str
    link: Optional[str] = None
    related_id: Optional[int] = None
    related_type: Optional[str] = None


class NotificationResponse(BaseModel):
    """Notification response schema"""
    id: int
    user_id: int
    notification_type: str
    title: str
    message: str
    link: Optional[str] = None
    related_id: Optional[int] = None
    related_type: Optional[str] = None
    is_read: bool
    read_at: Optional[datetime] = None
    created_at: datetime

    class Config:
        from_attributes = True


class NotificationListResponse(BaseModel):
    """Notification list with unread count"""
    notifications: List[NotificationResponse]
    unread_count: int
    total: int


class NotificationMarkRead(BaseModel):
    """Mark notifications as read"""
    notification_ids: List[int]
