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

namespace PXP.Crawler.API.Plugins.Utils
{
    [NodeInfo("Count", typeof(CountNode), Category = "Utils",
        DefaultWidth = 100, DefaultHeight = 40)]
    public class CountNode : Node
    {
        private int count = 0;

        public CountNode(Program program) : base(program)
        {
        }

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

        [NodePropertyPin(NodePinDirection.Input)]
        public IList Values
        {
            get
            {
                return null;
            }
            set
            {
                if (value == null)
                {
                    count = 0;
                }
                else
                {
                    count = value.Count;                    
                }
            }
        }

        [NodePropertyPin(NodePinDirection.Output)]        
        public int Count
        {
            get
            {
                return count;
            }
            internal set
            {
                
            }
        }
    }
}
