<?php
declare(strict_types=1);

namespace App\Framework\Http\Session;


use App\Framework\DateTime\Clock;
use App\Framework\DI\Container;
use App\Framework\DI\Initializer;
use App\Framework\Http\ResponseManipulator;


final readonly class SessionInitializer
{
    public function __construct(
        private Container $container
    ) {}

    /**
     * Initialisiert die Session-Komponenten im Container
     */
    #[Initializer]
    public function __invoke(): SessionManager
    {
        $clock = $this->container->get(Clock::class);

        return new SessionManager(
            new RandomBytesSessionIdGenerator(),
            new ResponseManipulator(),
            $clock
        );
    }
}
