﻿using Kitsunebot.LuaCommands;
using Kitsunebot.LuaCommands.Commands;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Kitsunebot
{
    public class CommandFactory : LuaCommands.IExecutorFactory
    {
        public IChannelFactory ChannelFactory { get { return _client; } set { _client = value; } }
        private IChannelFactory _client;
        protected IFeedback _fb;

        public CommandFactory(IChannelFactory client, IFeedback fb)
        {
            _fb = fb;
            _client = client;
        }

        public LuaCommands.ILuaExecutor GetExecutor(Channel.Channel channel)
        {
            List<ICommand> cmds = new List<ICommand>();

            cmds.Add(new Command_Whisper(channel, _client, _fb));
            cmds.Add(new Command_Send(channel, _client, _fb));
            cmds.Add(new Command_JoinChannel(channel, _client, _fb));
            cmds.Add(new Command_LeaveChannel(channel, _client, _fb));
            cmds.Add(new Command_GetEvents(channel, _client, _fb));
            cmds.Add(new Command_DoString(channel, _client, _fb));
            cmds.Add(new Command_GetScript(channel, _client, _fb));
            cmds.Add(new Command_AddRemoveScript(channel, _client, _fb));
            cmds.Add(new Command_AddStartupScript(channel, _client, _fb));
            cmds.Add(new Command_LuaCommand(channel, _client, _fb));
            cmds.Add(new Command_Invalid(channel, _client, _fb));

            return new Commander(channel, cmds);
        }
    }
}
