using Quasar.Common.Messages;
using Quasar.Common.Networking;
using Quasar.Server.Forms;
using Quasar.Server.Networking;

namespace Quasar.Server.Messages
{
    public class SystemOptionHandler : IMessageProcessor
    {
        public bool CanExecute(IMessage message) => message is SystemOptionResponse;

        public bool CanExecuteFrom(ISender sender) => true;

        public void Execute(ISender sender, IMessage message)
        {
            switch (message)
            {
                case SystemOptionResponse response:
                    Execute((Client)sender, response);
                    break;
            }
        }

        private void Execute(Client client, SystemOptionResponse message)
        {
            FrmSystemOptions.Instance?.HandleResponse(client, message);
        }
    }
}
