<?php

require_once __DIR__ . '/../vendor/autoload.php';

use PHPNative\Framework\Application;
use PHPNative\Ui\Widget\Button;
use PHPNative\Ui\Widget\Container;
use PHPNative\Ui\Widget\TextInput;
use PHPNative\Ui\Window;

$app = new Application();
$window = new Window('TextInput Test', 600, 400);

// Main container
$mainContainer = new Container('flex flex-col p-4 bg-gray-100');

// Container 2 - Mit TextInput und Button (flex-row)
$inputContainer = new Container('flex flex-row p-4 g-blue-200');

$input = new TextInput(
    placeholder: 'Type something...',
    style: 'flex-1 p-2 border border-gray-300 rounded mr-2',
);

$button = new Button('Submit', 'bg-green-500 text-white p-2 rounded-xl');

$inputContainer->addComponent($input);
$inputContainer->addComponent($button);
$mainContainer->addComponent($inputContainer);

$window->setRoot($mainContainer);
$app->addWindow($window);

echo "TextInput Test started!\n";
echo "- Red container (80px)\n";
echo "- Blue container with TextInput and Button (40px)\n";
echo "- Green container (80px)\n\n";

$app->run();
