"""
Simple test for UIPanel integration.
"""

from engine.pipeline.ui import UIPanel, UIConfig, StageControl

# Create panel
panel = UIPanel(UIConfig(panel_width=24))

# Add some mock stages
panel.register_stage(
    type(
        "Stage", (), {"name": "noise", "category": "effect", "is_enabled": lambda: True}
    ),
    enabled=True,
)
panel.register_stage(
    type(
        "Stage", (), {"name": "fade", "category": "effect", "is_enabled": lambda: True}
    ),
    enabled=False,
)
panel.register_stage(
    type(
        "Stage",
        (),
        {"name": "glitch", "category": "effect", "is_enabled": lambda: True},
    ),
    enabled=True,
)
panel.register_stage(
    type(
        "Stage",
        (),
        {"name": "font", "category": "transform", "is_enabled": lambda: True},
    ),
    enabled=True,
)

# Select first stage
panel.select_stage("noise")

# Render at 80x24
lines = panel.render(80, 24)
print("\n".join(lines))

print("\nStage list:")
for name, ctrl in panel.stages.items():
    print(f"  {name}: enabled={ctrl.enabled}, selected={ctrl.selected}")

print("\nToggle 'fade' and re-render:")
panel.toggle_stage("fade")
lines = panel.render(80, 24)
print("\n".join(lines))

print("\nEnabled stages:", panel.get_enabled_stages())
