<?php

namespace App\Services;

class NotificationService
{
    public function create(int $userId, string $title, string $message, string $type = 'info', ?string $url = null): void
    {
        db_connect()->table('notifications')->insert([
            'user_id' => $userId,
            'title' => $title,
            'message' => $message,
            'type' => $type,
            'action_url' => $url,
            'created_at' => date('Y-m-d H:i:s'),
        ]);
    }

    public function sendCareUpdate(int $userId, string $message, ?string $url = null): void
    {
        $this->create($userId, 'Care update', $message, 'care', $url);
        // SMS/email/push adapters can be connected here without changing domain logic.
    }
}
