using Microsoft.Xna.Framework;
using System;

namespace LeMangeurDEnfants.Core
{
    public interface IHaveFollower
    {
        Direction CurrentDirection { get; }
        IFollower NextFollower { get; set; }
        Point Position { get; }
        void Fail();
    }

    public interface IFollower : IHaveFollower
    {
        void AddNavigationNode(NavigationNode node);
    }

    public static class IHaveFollowerExt
    {
        public static IHaveFollower GetLastFollower(this IHaveFollower haveFollower)
        {
            var follower = haveFollower.NextFollower;
            return follower?.GetLastFollower() ?? haveFollower;
        }
    }

    public class NavigationNode
    {
        public NavigationNodeType Type { get; set; }

        public Direction Direction { get; set; }
        public Point Trigger { get; set; }
        public TimeSpan Wait { get; set; }
    }

    public enum NavigationNodeType
    {
        Trigger, Wait
    }
}