using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using PXP.Crawler.API.Model;

namespace PXP.Crawler.API.Plugins.Operators
{
    public interface IValuesComputeResult<T>
    {
        T ComputeResult();
    }

    public abstract class ValuesOperatorNodeBase<T> : Node
    {
        public ValuesOperatorNodeBase(Program program) : base(program)
        {
        }

        internal bool isEqual = false;

        protected internal T value1;
        protected internal T value2;
        protected internal T result;

        public override void CreateDesigner()
        {
            base.CreateDesigner();
            designer.Control.BackColor = Color.Teal;
        }

        [NodePin(NodePin.NodePinDirection.Input)]
        public T Value1
        {
            get
            {
                return value1;
            }
            set
            {
                value1 = value;
                Result = ComputeResult();
            }
        }

        [NodePin(NodePin.NodePinDirection.Input)]
        public T Value2
        {
            get
            {
                return value2;
            }
            set
            {
                value2 = value;
                Result = ComputeResult();
            }
        }

        [NodePin(NodePin.NodePinDirection.Output)]
        public T Result
        {
            get
            {
                return result;
            }
            internal set
            {
                result = value;
                NotifyPropertyChange("Result");
            }
        }

        protected internal abstract T ComputeResult();

    }
}
