<?php

declare(strict_types=1);

namespace App\Services;

use App\Models\AuditLog;

class AuditService
{
    private AuditLog $auditLogModel;

    public function __construct()
    {
        $this->auditLogModel = new AuditLog();
    }

    public function log(?int $userId, string $action, string $entityType, ?int $entityId, ?array $oldValues, ?array $newValues, string $ipAddress): void
    {
        $this->auditLogModel->log($userId, $action, $entityType, $entityId, $oldValues, $newValues, $ipAddress);
    }

    public function getLogs(array $filters = [], int $page = 1, int $perPage = 30): array
    {
        return $this->auditLogModel->getLogs($filters, $page, $perPage);
    }
}
