namespace PlotLine.Models.WritingSolver; // Stable string IDs make editorial imports diffable. Published versions are immutable. public sealed class SolverGraph { public int SchemaVersion { get; set; } = 1; public string Version { get; set; } = ""; public string ChangeNote { get; set; } = ""; public bool IsDemo { get; set; } public int MinAnswers { get; set; } = 3; public int MaxAnswers { get; set; } = 6; public string EntryNode { get; set; } = ""; public List Nodes { get; set; } = []; public List Solutions { get; set; } = []; public List Features { get; set; } = []; } public sealed class SolverNode { public string Id { get; set; } = ""; public string Type { get; set; } = "question"; public string Title { get; set; } = ""; public string Help { get; set; } = ""; public bool Active { get; set; } = true; public bool Multiple { get; set; } public int MaxChoices { get; set; } public bool NeutralEndpoint { get; set; } public bool RequireAnswer { get; set; } public bool AllowNeutralChoices { get; set; } public SolverReassurance? Reassurance { get; set; } public int Order { get; set; } public Dictionary Affinity { get; set; } = []; public List Choices { get; set; } = []; public List Routes { get; set; } = []; } public sealed class SolverChoice { public string Id { get; set; } = ""; public string Text { get; set; } = ""; public string Help { get; set; } = ""; public string Icon { get; set; } = "book"; public bool Active { get; set; } = true; public bool Fallback { get; set; } public int Order { get; set; } public Dictionary Weights { get; set; } = []; public SolverReassurance? Reassurance { get; set; } } public sealed class SolverReassurance { public string Title { get; set; } = ""; public string Summary { get; set; } = ""; public List Advice { get; set; } = []; public string? Feature { get; set; } } public sealed class SolverRoute { public string Target { get; set; } = ""; public string? Choice { get; set; } public string? Signal { get; set; } public int Minimum { get; set; } public int Priority { get; set; } public bool AllowCycle { get; set; } } public class SolverPage { public string Id { get; set; } = ""; public string Slug { get; set; } = ""; public string Title { get; set; } = ""; public string PageTitle { get; set; } = ""; public string Description { get; set; } = ""; public string Summary { get; set; } = ""; public string Content { get; set; } = ""; public List Questions { get; set; } = []; public List SearchIntents { get; set; } = []; public bool Active { get; set; } = true; public bool Index { get; set; } public int Order { get; set; } public string? SocialImage { get; set; } } public sealed class SolverSolution : SolverPage { public Dictionary Signals { get; set; } = []; public int Threshold { get; set; } = 3; public Dictionary RequiredSignals { get; set; } = []; public string Principle { get; set; } = ""; public List Features { get; set; } = []; public List Related { get; set; } = []; } public sealed class SolverFeature : SolverPage { public string? Screenshot { get; set; } } public sealed class SolverFeatureLink { public string Feature { get; set; } = ""; public bool Primary { get; set; } public string Reason { get; set; } = ""; } public sealed record SolverAnswer(string Node, string[] Choices); public sealed record SolverOutcome(SolverNode? Next, IReadOnlyList Solutions, IReadOnlyDictionary Scores, IReadOnlyList Answers, SolverReassurance? Reassurance = null); public sealed record SolverJourney(SolverGraph Graph, SolverOutcome Outcome, string History, string? Error = null); public sealed record SolverPageView(SolverGraph Graph, SolverPage Page, bool IsFeature);