Files
ytLlive/Services/SceneAccessPolicy.cs
T

33 lines
1.2 KiB
C#

using ytLive.Models;
namespace ytLive.Services;
/// <summary>
/// The per-scene source access matrix (see the source catalog in TASKS.md).
/// One source's availability in a scene is a product decision, enforced by
/// scene name on every place a source can be added. Countdown and Credits are
/// Text *modes*, not source types: their scene restrictions gate the mode when
/// the Text ship step lands. Chatbox / Alerts / Socials are inert values until
/// their features ship — the rows are live from today.
/// </summary>
public static class SceneAccessPolicy
{
public static bool Allows(string? sceneName, SourceType type)
{
if (!SceneCatalog.IsCanonical(sceneName)) return false;
return type switch
{
SourceType.DisplayCapture or SourceType.WindowCapture =>
SceneCatalog.Is(sceneName, SceneCatalog.Live),
SourceType.Background or SourceType.Image or SourceType.TextOverlay or
SourceType.Alerts or SourceType.Socials => true,
SourceType.Chatbox =>
SceneCatalog.Is(sceneName, SceneCatalog.Live)
|| SceneCatalog.Is(sceneName, SceneCatalog.Brb)
|| SceneCatalog.IsChat(sceneName),
_ => false,
};
}
}