using ytLive.Helpers;
using ytLive.Services.Entitlement;
namespace ytLive.ViewModels;
///
/// The entitlement surface: whether this session may emit output above the free budget.
///
/// Deliberately a separate partial from License.cs: that file owns *how* a
/// licence is validated (Polar today), this one owns *what the answer means* for output.
/// Steam's DLC check and Polar's lease both collapse into ; nothing
/// downstream of cares which one proved it.
///
public partial class MainViewModel
{
///
/// The single input to .
///
/// Fail closed: an unresolved or unreadable licence is simply false, so a
/// build with no entitlement emits the free profile. There is no "unknown" branch to get
/// wrong.
///
/// Developer mode never ships: is only ever
/// settable inside a development build (see ), so this expression
/// reduces to IsPremium in a Release binary.
///
public bool HasProOutput => IsPremium || DeveloperMode || _entitlement.IsPro;
///
/// The entitlement rail for this session. Lifetime = Steam DLC; until the DLC app id exists it
/// is , which reads false (fail closed). Tests
/// inject a fake through .
///
private IEntitlement _entitlement = SteamEntitlement.NotConfigured();
/// Test seam: swap the rail without a Steam client. Internal — the test assembly is
/// the only caller, and a public setter here would be a licence bypass surface.
internal IEntitlement EntitlementOverride
{
get => _entitlement;
set
{
_entitlement = value;
OnPropertyChanged(nameof(HasProOutput));
}
}
private bool _developerMode;
///
/// Development-only override: ignore the output budget and allow every shipped tier.
///
/// There is no UI to reach this in a Release build — the panel that hosts the
/// checkbox is excluded from the Release compile — and the setter refuses the value
/// unless is true, so even a hand-edited settings
/// file cannot unlock it.
///
public bool DeveloperMode
{
get => _developerMode;
set
{
if (!DevBuild.IsDevelopment) return;
if (!SetProperty(ref _developerMode, value)) return;
OnPropertyChanged(nameof(HasProOutput));
}
}
}