using System.Text.Json.Serialization;
using StabilityMatrix.Core.Models.Api.Comfy.NodeTypes;
namespace StabilityMatrix.Core.Models.Api.Comfy.Nodes;
[JsonSerializable(typeof(NamedComfyNode))]
public record NamedComfyNode([property: JsonIgnore] string Name) : ComfyNode, IOutputNode
{
///
/// Returns { Name, index } for use as a node connection
///
public object[] GetOutput(int index)
{
return new object[] { Name, index };
}
///
/// Returns typed { Name, index } for use as a node connection
///
public TOutput GetOutput(int index) where TOutput : NodeConnectionBase, new()
{
return new TOutput
{
Data = GetOutput(index)
};
}
}
[JsonSerializable(typeof(NamedComfyNode<>))]
public record NamedComfyNode(string Name) : NamedComfyNode(Name) where TOutput : NodeConnectionBase, new()
{
public TOutput Output => new TOutput
{
Data = GetOutput(0)
};
}