namespace Inspectron.Epson.Templates.Language.Nodes;

public record BindingNode(string Path, string? Format, SourcePosition Position) : ITemplateNode
{
    public IReadOnlyList<ITemplateNode> Children => Array.Empty<ITemplateNode>();

    public static BindingNode Parse(string value, SourcePosition position)
    {
        var parts = value.Split(':', 2);
        var path = parts[0].Trim();
        var format = parts.Length > 1 ? parts[1].Trim() : null;
        return new BindingNode(path, format, position);
    }
}
