using System.Reflection;
namespace Chronos.App.Infrastructure;
/// Features a build switches on through MSBuild properties (Directory.Build.props), read from the assembly metadata.
public static class ProductFeatures
{
///
/// Monetization (BRIEF ยง21: ads, the anonymous usage counts consent, the licence) ships disabled until a build sets
/// ChronosAdsEnabled=true; until then nothing of it shows.
///
public static bool AdsEnabled { get; } = Flag("ChronosAdsEnabled");
private static bool Flag(string key) =>
typeof(ProductFeatures).Assembly.GetCustomAttributes().FirstOrDefault(a => a.Key == key)?.Value is { } value
&& bool.TryParse(value, out var on) && on;
}