<?php

namespace Apexl\Io\Display\Controllers;

use Apexl\Io\Component\Factories\GenericComponentFactory;
use Apexl\Io\Component\Interfaces\ComponentInterface;
use Apexl\Io\Controller;
use Apexl\Io\Display\Services\Render;
use Apexl\Io\Interfaces\OutputManagerInterface;

readonly class DisplayController extends Controller
{
    public function __construct(
        private GenericComponentFactory $componentFactory,
        protected Render $render,
        OutputManagerInterface $output,
    ) {
        parent::__construct($output);
    }

    protected function component(string $class, array $initParams = [], array $constructorParams = []): ComponentInterface
    {
        return $this->componentFactory->make($class, $initParams, $constructorParams);
    }
}
