using Godot;
using ReactorMaintenance.Godot.Data;

namespace ReactorMaintenance.Godot.Controls;

public partial class LevelHeader : HBoxContainer
{
    public override void _Ready()
    {
        AddChild(m_Title);
        AddChild(m_Progress);
        AddChild(m_Badge);
        AddChild(m_Summary);

        m_Title.SizeFlagsHorizontal = SizeFlags.ExpandFill;
        m_Title.AddThemeFontSizeOverride("font_size", 24);
        m_Progress.HorizontalAlignment = HorizontalAlignment.Center;
        m_Summary.HorizontalAlignment = HorizontalAlignment.Right;
    }

    public void SetLevel(CampaignLevel level, int levelNumber, int levelCount, string state)
    {
        m_Title.Text = level.Name;
        m_Progress.Text = $"Level {levelNumber} / {levelCount}";
        m_Badge.SetState(state);
        m_Summary.Text = "Heat nominal | Reactor offline";
    }

    private readonly StateBadge m_Badge = new();
    private readonly Label m_Progress = new();
    private readonly Label m_Summary = new();
    private readonly Label m_Title = new();
}