<?php

namespace App\Core\Services;

use App\Models\ActivityLog;
use Illuminate\Support\Facades\Auth;

class AuditService
{
    public static function log(string $action, string $module, ?string $description = null, ?int $modelId = null, ?string $modelType = null): void
    {
        ActivityLog::create([
            'user_id' => Auth::id(),
            'action' => $action,
            'module' => $module,
            'description' => $description,
            'model_id' => $modelId,
            'model_type' => $modelType,
            'ip_address' => request()->ip(),
            'user_agent' => request()->userAgent(),
        ]);
    }
}
