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

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

public class ThreeParameterNode : INode
{
    [NodeField(FieldDirection.Parameter)]
    [HasValueBetween(2, 8)]
    public NodeField<int?> Parameter1 { get; set; } = null!;

    [NodeField(FieldDirection.Parameter)]
    [Required]
    [HasMaxLength(13)]
    [HasDefaultValue(3)]
    public NodeField<string> Parameter2 { get; set; } = null!;

    [NodeField(FieldDirection.Parameter, "p3")]
    public NodeField<bool> Parameter3 { get; set; } = null!;

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

    internal static NodeDescriptor GetDescriptor()
    {
        return new NodeDescriptor(nameof(ThreeParameterNode), false, typeof(ThreeParameterNode).FullName!,
            typeof(ThreeParameterNode).FullName!,
            [
                new NodeFieldDescriptor(nameof(Parameter1), nameof(Parameter1), typeof(int).FullName!, true, false,
                    false,
                    FieldDirection.Parameter,
                    new NodeFieldDescriptor.NodeFieldMetaData(false, numberMinBound: 2, numberMaxBound: 8)),
                new NodeFieldDescriptor(nameof(Parameter2), nameof(Parameter2), typeof(string).FullName!, false, true,
                    false,
                    FieldDirection.Parameter, new NodeFieldDescriptor.NodeFieldMetaData(true, stringMaxLength: 13,
                        defaultValue: 3, canDefaultValueBeInitialized: true)),
                new NodeFieldDescriptor(nameof(Parameter3), "p3", typeof(bool).FullName!, false, false, false,
                    FieldDirection.Parameter, null)
            ], true, null);
    }
}