Coach.cs
namespace PixelPusher;

public static class Coach
{
	public static string Line { get; set; } = "";
	public static bool Drawn;
	public static bool Stamped;
	public static bool Played;
	public static bool Cleared;

	public static void OnEnterBuild()
	{
		if ( Lesson.Active )
		{
			Line = Lesson.Body;
			GameFlow.Bump();
			return;
		}

		if ( !Drawn )
			Line = "Push a pixel. Then open STAGE and paint a floor.";
		else if ( !Stamped )
			Line = "STAGE is waiting. Paint a floor, stamp a start, Drop In.";
		else if ( !Played )
			Line = "Tab or DROP IN. Space jumps. Grab the coins, then the exit.";
		else if ( !Cleared )
			Line = "Grab every coin, then the pink exit. World and Chip can wait.";
		else
			Line = "Cleared. Save on the Desk. Publish when it feels right.";
		GameFlow.Bump();
	}

	public static void OnStudio( GameScreen screen )
	{
		if ( Lesson.Active )
		{
			Line = Lesson.Body;
			GameFlow.Bump();
			return;
		}

		Line = screen switch
		{
			GameScreen.Pixel => Drawn ? "Nice. Open STAGE when you want a floor under it." : "PIXEL STUDIO. Push a pixel. Gold makes a good coin.",
			GameScreen.Stage => Stamped ? "DROP IN when the floor feels right. Tab also works." : "Paint a floor. Stamp start, coins, a spring, an exit.",
			GameScreen.World => "WORLD is later. Walk the slabs after you clear Stock the Cooler.",
			GameScreen.Chip => "CHIP STUDIO. Click cells, Space plays the loop. Stick to pick, A to drop a note.",
			GameScreen.Library => "Your Desk. Save here. Publish when the stage is clear.",
			_ => Line
		};
		GameFlow.Bump();
	}

	public static void OnPaint()
	{
		if ( Drawn )
			return;
		Drawn = true;
		Line = "Nice push. Open STAGE and paint a floor, then Drop In.";
		ChipVoices.Push();
		Lesson.OnPaint();
		GameFlow.Bump();
	}

	public static void OnStagePaint()
	{
		if ( Stamped )
			return;
		Stamped = true;
		Line = "Floor's down. Stamp start, three coins, a spring, an exit. Then Drop In.";
		GameFlow.Bump();
	}

	public static void OnPlay()
	{
		Played = true;
		Lesson.OnPlay();
		if ( Lesson.Active )
		{
			Line = Lesson.Body;
			GameFlow.Bump();
			return;
		}

		Line = Desk.Stage?.Goal == "grab"
			? "Grab every coin, then the exit. Jump has coyote."
			: "Jump has coyote. Land it. Reach the exit.";
		GameFlow.Bump();
	}

	public static void OnWalk()
	{
		Played = true;
		Line = "Walk the slabs. A/D along the street, W/S into the aisle, Space jumps.";
		GameFlow.Bump();
	}

	public static void OnCleared()
	{
		Cleared = true;
		Lesson.OnCleared();
		var next = StarterPack.NextStageId( Desk.Stage?.Name );
		Line = !string.IsNullOrEmpty( next )
			? "Cleared. NEXT STAGE is on the card — Night Shift, Back Lot, Closed Sundays."
			: Lesson.Finished
				? "That's the loop. More stages live on the Desk."
				: "Cleared. Save on the Desk. World and Chip can wait.";
		GameFlow.Bump();
	}
}