<?php

namespace App\Modules\Admin\Operations\Repositories;

use App\Modules\Admin\Operations\Models\PlatformAuditEvent;

class PlatformAuditRepository
{
    /**
     * @param  array<string, mixed>|null  $meta
     */
    public function record(
        ?int $actorUserId,
        ?int $tenantId,
        string $category,
        string $action,
        ?array $meta = null,
    ): PlatformAuditEvent {
        return PlatformAuditEvent::query()->create([
            'actor_user_id' => $actorUserId,
            'tenant_id' => $tenantId,
            'category' => $category,
            'action' => $action,
            'meta' => $meta,
        ]);
    }
}
