<?php

namespace App\Modules\Admin\Billing\Services;

use App\Modules\Admin\Operations\Repositories\PlatformAuditRepository;

class BillingAuditService
{
    private const CATEGORY = 'billing';

    public function __construct(
        private readonly PlatformAuditRepository $audit,
    ) {}

    /**
     * @param  array<string, mixed>  $meta
     */
    public function log(?int $actorUserId, int $tenantId, string $action, array $meta = []): void
    {
        $this->audit->record($actorUserId, $tenantId, self::CATEGORY, $action, $meta);
    }

    /**
     * @param  array<string, mixed>  $meta
     */
    public function logSystem(int $tenantId, string $action, array $meta = []): void
    {
        $this->audit->record(null, $tenantId, self::CATEGORY, $action, $meta);
    }
}
