using System;
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.Operators
{
    [NodeInfo("And (Logical)", typeof(CompareStringsNode), Category = "Operators", DefaultWidth = 55, DefaultHeight = 40)]
    public class AndNode : ValuesOperatorNodeBase<bool>
    {
        public AndNode(Program program) : base(program)
        {
            Name = "And";
        }

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

        protected internal override bool ComputeResult()
        {
            return value1 & value2;
        }   
    }

    [NodeInfo("Or (Logical)", typeof(CompareStringsNode), Category = "Operators", DefaultWidth = 55, DefaultHeight = 40)]
    public class OrNode : ValuesOperatorNodeBase<bool>
    {
        public OrNode(Program program)
            : base(program)
        {
            Name = "Or";
        }

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

        protected internal override bool ComputeResult()
        {
            return value1 | value2;
        }
    }

    [NodeInfo("Not (Logical)", typeof(CompareStringsNode), Category = "Operators", DefaultWidth = 55, DefaultHeight = 40)]
    public class NotNode : ValueOperatorNodeBase<bool>
    {
        public NotNode(Program program)
            : base(program)
        {
            Name = "Not";
        }

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

        protected internal override bool ComputeResult()
        {
            return ! cvalue;
        }
    }
}
