Editor/Wiring/Symbols/Symbol.cs

Abstract record used by the editor wiring system to represent named symbols. It defines a Guid Id and Name, and registers JSON polymorphic metadata mapping derived symbol types to discriminator strings.

using System;
using System.Text.Json.Serialization;

namespace Grains.RazorDesigner.Wiring;

[JsonPolymorphic( TypeDiscriminatorPropertyName = "$type" )]
[JsonDerivedType( typeof( StateSymbol ),      "State" )]
[JsonDerivedType( typeof( ParameterSymbol ),  "Parameter" )]
[JsonDerivedType( typeof( NodeRefSymbol ),    "NodeRef" )]
[JsonDerivedType( typeof( MethodSymbol ),     "Method" )]
[JsonDerivedType( typeof( LifecycleSymbol ),  "Lifecycle" )]
public abstract record Symbol
{
    public Guid Id { get; init; } = Guid.NewGuid();
    public string Name { get; init; } = "";
}