using System.ComponentModel.DataAnnotations;
using NodePipeline.Abstractions.Attributes;
using NodePipeline.Abstractions.Interfaces.Nodes;
using NodePipeline.Abstractions.Models;
using NodePipeline.Engine.CodeGeneration.Abstractions.Models;

namespace NodePipeline.Engine.Tests.CodeGeneratorTests.Fixtures.MockNodes;

public class ThreePortNode : INode
{
    [NodeField(FieldDirection.Input)] public NodeField<int?> Input1 { get; set; } = null!;

    [NodeField(FieldDirection.Input)]
    [Required]
    [DisallowNullableOutput]
    public NodeField<string> Input2 { get; set; } = null!;

    [NodeField(FieldDirection.Output, "out")]
    public NodeField<bool> Output1 { get; set; } = null!;

    public void Execute()
    {
        throw new NotImplementedException();
    }

    internal static NodeDescriptor GetDescriptor()
    {
        return new NodeDescriptor(nameof(ThreePortNode), false, typeof(ThreePortNode).FullName!,
            typeof(ThreePortNode).FullName!,
            [
                new NodeFieldDescriptor(nameof(Input1), nameof(Input1), typeof(int).FullName!, true, false, false,
                    FieldDirection.Input, null),
                new NodeFieldDescriptor(nameof(Input2), nameof(Input2), typeof(string).FullName!, false, true, false,
                    FieldDirection.Input, new NodeFieldDescriptor.NodeFieldMetaData(true, true)),
                new NodeFieldDescriptor(nameof(Output1), "out", typeof(bool).FullName!, false, false, false,
                    FieldDirection.Output, null)
            ], true, null);
    }
}