using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Runtime.CompilerServices;
namespace ytLive.Models;
public class Scene : INotifyPropertyChanged
{
public string Id { get; init; } = Guid.NewGuid().ToString();
private string _name = string.Empty;
private bool _isEditing;
private bool _isHidden;
private bool _hasBackdrop;
private bool _hasSocialBar;
public string Name
{
get => _name;
set => Set(ref _name, value);
}
public bool IsEditing
{
get => _isEditing;
set => Set(ref _isEditing, value);
}
public bool IsHidden
{
get => _isHidden;
set => Set(ref _isHidden, value);
}
///
/// Whether the scene has a live desktop/game backdrop layer. Enforced by
/// policy: only the canonical Live scene ever has one (see SceneCatalog).
///
public bool HasBackdrop
{
get => _hasBackdrop;
set => Set(ref _hasBackdrop, value);
}
///
/// Whether the social bar plays on this scene. Toggled by the footer [+]/[-]
/// control — the socials themselves are a global resource (see SocialsConfig).
///
public bool HasSocialBar
{
get => _hasSocialBar;
set => Set(ref _hasSocialBar, value);
}
///
/// The scene's rendered elements in z-order (back to front): multi-instance
/// Sources plus this scene's webcam usage (), if any.
///
public ObservableCollection Elements { get; } = new();
/// This scene's webcam usage, or null if the creator hasn't added the webcam here.
public WebcamSceneConfig? WebcamConfig => Elements.OfType().FirstOrDefault();
public bool IsChatScene { get; init; }
public event PropertyChangedEventHandler? PropertyChanged;
private void Set(ref T field, T value, [CallerMemberName] string? propertyName = null)
{
if (EqualityComparer.Default.Equals(field, value)) return;
field = value;
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}