<?php

declare(strict_types=1);

namespace App\Framework\Console\Layout;

use App\Framework\DI\Attributes\Initializer;
use App\Framework\DI\Container;

final readonly class LayoutInitializer
{
    #[Initializer]
    public function initialize(Container $container): void
    {
        // Register terminal size detection
        $container->singleton(TerminalSize::class, function () {
            return TerminalSize::detect();
        });

        // Register responsive output factory
        $container->bind(ResponsiveOutput::class, function (Container $container) {
            return function ($output) use ($container) {
                return ResponsiveOutput::create(
                    $output,
                    $container->get(TerminalSize::class)
                );
            };
        });
    }
}
