<?php

namespace App\Framework\Queue;

use App\Framework\Core\PathProvider;
use App\Framework\DI\Initializer;

final readonly class QueueInitializer
{
    public function __construct(
        private PathProvider $pathProvider
    )
    {
    }
    #[Initializer]
    public function __invoke(): Queue
    {
        $queue = new RedisQueue(
            queueName: 'commands',
            host: 'redis',
            port: 6379,

        );

        $path = $this->pathProvider->resolvePath('/src/Framework/CommandBus/storage/queue/');

        return new FileQueue($path);
    }
}
