using System;
using System.Collections.Generic;
using Machinations.FromFlash.machinations.model;
using Machinations.UserComponents;

namespace Machinations.Status
{
    /// <summary>
    /// contains a list of class,for which is needed to do status, and can work as a factory by creating statuses to listed classes
    /// </summary>
    public static class TypesWithStatuses
    {
        public static List<Type> ElementTypes = new List<Type> {typeof(Pool), typeof(ResourceConnection), typeof(StateConnection), typeof(Register), typeof(Delay)};
        public static List<Type> TemplateTypes = new List<Type> { typeof(Cards)};


        public static IElementStatus GetStatus(Pool pool, int step)
        {
            return new PoolStatus(pool, step);
        }

        public static IElementStatus GetStatus(ResourceConnection connection, int step)
        {
            return new ConnectionStatus(connection, step);
        }

        public static IElementStatus GetStatus(StateConnection connection, int step)
        {
            return new StateConnectionStatus(connection, step);
        }

        public static IElementStatus GetStatus(Cards cards, int step)
        {
            return new CardStatus(cards, step);
        }

        public static IElementStatus GetStatus(Register register, int step)
        {
            return new RegisterStatus(register, step);
        }

        public static IElementStatus GetStatus(Delay delay, int step)
        {
            return new DelayStatus(delay, step);
        }

        public static List<Resource> CloneResources(this List<Resource> original)
        {
            var list = new List<Resource>();
            original.ForEach(r => list.Add(new Resource(r.Color, r.Position)));
            return list;
        }
    }
}
