Editor/Layers/ArchAssetInstanceManifest.cs

Manifest class for ArchAssetInstance entries in the editor layer. It defines metadata (kind, slot name, domain, label, glyph) and implements filing and unfiling logic against an ArchPlan's Instances collection.

Reflection
using System;
using System.Collections.Generic;

namespace Sunless.Architecture;

public sealed class ArchAssetInstanceManifest : ArchKindManifest<ArchAssetInstance>
{
	public override ArchKind Kind => ArchKind.AssetInstance;

	public override string Slot => "Instances";

	public override ArchLayerDomain Domain => ArchLayerDomain.Connections;

	public override string Label => "Instance";

	public override string Glyph => "link";

	// A placed copy stands at the plan root, so nothing hosts it and only a hostless ask reaches its list.
	public override IEnumerable<object> Filed( ArchPlan plan, object host )
	{
		return plan is not null && host is null ? plan.Instances : Array.Empty<object>();
	}

	public override bool Unfile( ArchPlan plan, object payload )
	{
		return plan is not null && payload is ArchAssetInstance instance && plan.Instances.Remove( instance );
	}
}