#region Setup
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using ChartForgeX;
using ChartForgeX.Core;
using ChartForgeX.Primitives;
using ChartForgeX.Rendering;
using ChartForgeX.Themes;
using ChartForgeX.Topology;
using ChartForgeX.Typography;
using ChartForgeX.VisualArtifacts;
using ChartForgeX.VisualBlocks;
var mode = ThemeMode.Light;
var theme = VisualTheme.Graphite();
var model = SequenceSelfRoutesRecipe.Create("wide", mode);
var context = new VisualRenderContext(
new VisualLayoutOptions(new VisualSize(1000, 820)), theme, mode,
new VisualFrame("Self routes", "Finite native self routes", showLegend: false, showSurface: false));
var prepared = model.Prepare(context);
File.WriteAllText("visual.svg", prepared.ToSvg());
File.WriteAllBytes("visual.png", prepared.ToPng());
File.WriteAllText("visual.html", prepared.ToArtifact("example", VisualArtifactKind.Sequence).ToHtmlPage());
#endregion
/// Creates explicitly curved native self messages with measured badge and mirrored lifetime geometry.
public static class SequenceSelfRoutesRecipe {
/// Creates a compact or wide native sequence; omitted self routing remains the ordinary 56/24 law.
public static SequenceArtifact Create(string variant="wide",ThemeMode mode=ThemeMode.Light) {
if(variant is not ("compact" or "wide"))throw new ArgumentOutOfRangeException(nameof(variant));
var model=SequenceArtifact.Create("sequence-self-routes").Width(variant=="compact"?390:1000).Height(820).Title("Self routes")
.AddParticipant("A","Review").AddMessage("A","A","Check").AddMessage("A","A","Save");
model.Layout=new SequenceLayoutPolicy(participantMinimumWidth:64,participantMinimumHeight:60,participantSpacing:8,wrapPadding:8,selfMessageRouting:SequenceSelfMessageRouting.Curved);
model.Typography=new SequenceTypography(participant:new TextStyleOverride{FontSize=14},message:new TextStyleOverride{FontSize=12});model.Theme=VisualTheme.Graphite();model.ThemeMode=mode;return model;
}
}