<?php

declare(strict_types=1);

namespace Seka\Portal\Modul\Vzdelavanie\Events\Kniznica;

use Illuminate\Contracts\Auth\Authenticatable;
use Illuminate\Support\Facades\App;
use Symfony\Component\HttpFoundation\ParameterBag;

/**
 * Trait ActivityLogTrait
 *
 * @package Seka\Portal\Modul\Vzdelavanie\Events\Kniznica
 */
trait ActivityLogTrait
{
    public ?ParameterBag $request;

    public ?Authenticatable $pouzivatel;

    protected function setActivityLogParameters(): void
    {
        $this->pouzivatel = auth()->user();
        $this->request = App::runningInConsole() ? null : new ParameterBag(
            array_merge(request()->server->all(), request()->headers->all()),
        );
    }
}
