using System.Windows.Input;
using ytLive.Helpers;
namespace ytLive.ViewModels;
/// Which half of the top bar's dual segment is in force.
public enum BarWorld
{
/// Build Scenes — the edit surface. The default at launch (creator ruling 2026-11-12).
Build,
/// Record / Go Live — the output surface: which output, and the one action that starts it.
Output,
}
///
/// The top bar's one decision (creator ruling 2026-11-12): [ Build Scenes ][ Record / Go Live ].
/// Build Scenes is edit mode — there is no separate EDIT toggle any more, so "may I edit?" and
/// "which world am I in?" cannot disagree.
///
/// Clicking the highlighted segment is not a no-op: it re-enters that world, which matters while a
/// session runs because Build Scenes is the only way back to the layers (see
/// ).
///
public partial class MainViewModel
{
private BarWorld _barWorld = BarWorld.Build;
public BarWorld BarWorld => _barWorld;
public bool IsBuildWorld => _barWorld == BarWorld.Build;
public bool IsOutputWorld => _barWorld == BarWorld.Output;
/// The output stage belongs to the Record / Go Live world, and only while nothing is
/// running — a live session cannot change its output, so its switch is not offered.
public bool ShowOutputStage => IsOutputWorld && IsOffline && !IsRecording;
public ICommand EnterBuildWorldCommand { get; private set; } = null!;
public ICommand EnterOutputWorldCommand { get; private set; } = null!;
private void InitializeWorldCommands()
{
EnterBuildWorldCommand = new RelayCommand(_ => EnterWorld(BarWorld.Build));
EnterOutputWorldCommand = new RelayCommand(_ => EnterWorld(BarWorld.Output));
}
/// Switches worlds. Re-entering the current one still re-asserts its edit state, which is
/// what lets a creator take EDIT back mid-show by clicking Build Scenes.
internal void EnterWorld(BarWorld world)
{
_barWorld = world;
OnPropertyChanged(nameof(BarWorld));
OnPropertyChanged(nameof(IsBuildWorld));
OnPropertyChanged(nameof(IsOutputWorld));
EditingActive = world == BarWorld.Build;
OnPropertyChanged(nameof(ShowOutputStage));
}
}