"""Notification service.""" from typing import Optional from sqlalchemy.orm import Session from app.models.notification import Notification def create_notification( db: Session, user_id: int, type: str, title: str, message: str, booking_id: Optional[int] = None, ) -> Notification: """ Create a new notification. Args: db: Database session user_id: ID of the user to notify type: Notification type (e.g., 'booking_created', 'booking_approved') title: Notification title message: Notification message booking_id: Optional booking ID this notification relates to Returns: Created notification object """ notification = Notification( user_id=user_id, type=type, title=title, message=message, booking_id=booking_id, ) db.add(notification) db.commit() db.refresh(notification) return notification