using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using QM.Exchange.Custom.Commands.Samples;
using QM.Exchange.Interface;

namespace QM.Exchange.Core.ProcessProgram
{
    /// <summary>
    /// 处理程序工厂
    /// </summary>
    public class CommandFactory
    {
        /// <summary>
        /// 创建程序执行者
        /// </summary>
        /// <returns>程序执行者</returns>
        public CommandExecutor CreateExecutor(CommonMessage message)
        {
            CommandExecutor executor = new CommandExecutor();

            //添加处理程序
            switch(message.MsgType)
            {
                case "RemoteShutLight"://远程关灯
                    executor.SetCommand(new RShutLightCommand(message));
                    break;
                case "Broadcast":
                    executor.SetCommand(new BroadcastCommand(message));
                    break;
            }

            return executor;
        }
    }
}