<?php

declare(strict_types=1);

namespace App\Services;

use App\Models\Log;

final class ActivityLogger
{
    /**
     * Log an activity to the database.
     */
    public static function log(
        string $action,
        ?int $userId = null,
        ?int $sessionId = null,
        ?int $categoryId = null,
        ?array $metadata = null,
    ): void {
        Log::create([
            'user_id' => $userId,
            'session_id' => $sessionId,
            'category_id' => $categoryId,
            'action' => $action,
            'metadata' => $metadata,
        ]);
    }
}
