Editor/Wall/ArchWallManifest.cs
using System;
using System.Collections.Generic;

namespace Sunless.Architecture;

public sealed class ArchWallManifest : ArchKindManifest<ArchWall> {
	public override ArchKind Kind => ArchKind.Wall;

	public override string Slot => "Walls";

	// A partition stands on a floor and a parapet stands on a deck, so one wall has two homes and every
	// lookup has to try both - which is the whole reason ArchPlan.AllWalls exists.
	public override IEnumerable<Type> Hosts => new[] { typeof( ArchRoom ), typeof( ArchRoofPart ) };

	public override string Label => "Wall";

	public override string Glyph => ArchIcons.Get( "subtool_wall", "wallpaper" );

	public override string Subtool => ArchSubtools.Wall;

	public override string HostOutput => "Wall run and faces";

	public override IEnumerable<ArchKind> Children => new[] { ArchKind.Opening, ArchKind.WallMod };

	public override int IndirectRank => 100;

	public override ArchLayerStage Stage( object payload ) => ArchLayerStage.Structure;

	public override string NameOf( object payload, int id ) {
		return payload is ArchWall wall ? $"Wall {wall.Id}" : base.NameOf( payload, id );
	}

	// Named by the face it turns outward, because a room's four walls are otherwise four identical rows.
	public override string DisplayName( object payload ) {
		if ( payload is not ArchWall wall ) {
			return null;
		}

		var outward = -wall.Normal;
		var side = MathF.Abs( outward.x ) > MathF.Abs( outward.y )
			? outward.x > 0f ? "East" : "West"
			: outward.y > 0f ? "North" : "South";

		return $"{side} Wall {wall.Id}";
	}
}