Editor/Output/ArchExpectedReports.cs

Interface and registry for expected architecture reports. IArchExpectedReport defines a Kind property and Describe method. ArchExpectedReports provides a Describe(kind, payload, target, tool) dispatcher that finds a matching report implementation from Standing() and calls its Describe method. Standing enumerates three concrete report types: ArchWallExpectedReport, ArchRoofExpectedReport, and ArchStairExpectedReport.

namespace Sunless.Architecture;

public interface IArchExpectedReport
{
	ArchKind Kind { get; }

	object Describe( object payload, ArchTarget target, ArchTool tool );
}

public static class ArchExpectedReports
{
	public static object Describe( ArchKind kind, object payload, ArchTarget target, ArchTool tool )
	{
		var report = Standing().FirstOrDefault( candidate => candidate.Kind == kind );

		return report?.Describe( payload, target, tool );
	}

	static IEnumerable<IArchExpectedReport> Standing()
	{
		yield return new ArchWallExpectedReport();
		yield return new ArchRoofExpectedReport();
		yield return new ArchStairExpectedReport();
	}
}