using InboxIntel.Domain.Common;
namespace InboxIntel.Domain.Entities;
///
/// System-wide feature flag (docs/discovery/multi-provider/04). The admin master switches:
/// a disabled flag turns its feature off for EVERYONE regardless of user preferences.
/// Reads are fail-closed — an unknown key counts as disabled.
///
public class FeatureFlag : AuditableEntity
{
/// Stable key, e.g. "ai.enabled", "provider.google".
public string Key { get; set; } = string.Empty;
public bool Enabled { get; set; }
/// True = a user preference may turn the feature OFF for themselves
/// (never on beyond the flag); false = system-only switch.
public bool UserOverridable { get; set; }
public string? Description { get; set; }
}
///
/// Per-user preferences (docs/discovery/multi-provider/04). One row per user, created
/// lazily; absent row = defaults. AiOptIn defaults true so enabling the ai.enabled flag
/// behaves exactly like today until a user opts out.
///
public class UserSetting : AuditableEntity
{
public Guid UserId { get; set; }
public User? User { get; set; }
/// "system" | "light" | "dark".
public string Theme { get; set; } = "dark";
/// Master per-user AI opt-in (effective only while ai.enabled is on).
public bool AiOptIn { get; set; } = true;
/// Free-form UI preferences (layout, density, notifications) as JSON.
public string? PreferencesJson { get; set; }
}