using System.Collections.Generic;
using System.Linq;
using System.Windows;
using Machinations.FromFlash.graph;
using Machinations.FromFlash.machinations.model;

namespace Machinations.UserComponents
{
    public class InnerInOut : InOutBase
    {
        public InnerInOut(IUserComponentSchema userComponent, Point position, int inOutNumber) : base(userComponent, position, inOutNumber)
        {
        }

        public InnerInOut()
        {
        }

        public InnerInOut(IUserComponentSchema userComponent, Point position, int inOutNumber, bool inputValue) : this(userComponent, position, inOutNumber)
        {
            m_input = inputValue;
        }

        public override NodeClass NodeClass => NodeClass.InnerInOut;

        public List<MachinationsConnection> InnerConnections
        {
            get { return m_connections; }
        }

        
        public override string InOutType { get { return "InnerInOut"; } }
        protected override bool Inner { get { return true; } }
        protected override bool DirectionChecked(bool directionIn)
        {
            if (m_connections.Any())
            {
                return m_input == directionIn;
            }
            return true;
        }

        public void GetGeneralValues(InnerInOut from)
        {
            Position = from.Position;
            Name = from.Name;
            UserComponent = from.UserComponent;
        }
    }
}
