98 lines
3.8 KiB
C#

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<SolverNode> Nodes { get; set; } = [];
public List<SolverSolution> Solutions { get; set; } = [];
public List<SolverFeature> 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 bool NeutralEndpoint { get; set; }
public SolverReassurance? Reassurance { get; set; }
public int Order { get; set; }
public Dictionary<string,int> Affinity { get; set; } = [];
public List<SolverChoice> Choices { get; set; } = [];
public List<SolverRoute> 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<string,int> Weights { get; set; } = [];
public SolverReassurance? Reassurance { get; set; }
}
public sealed class SolverReassurance
{
public string Title { get; set; } = "";
public string Summary { get; set; } = "";
public List<string> 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<string> Questions { get; set; } = [];
public List<string> 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<string,int> Signals { get; set; } = [];
public int Threshold { get; set; } = 3;
public string Principle { get; set; } = "";
public List<SolverFeatureLink> Features { get; set; } = [];
public List<string> 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<SolverSolution> Solutions, IReadOnlyDictionary<string,int> Scores, IReadOnlyList<SolverAnswer> 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);