using FiestaBot.Enums;
using FiestaBot.Instances.Networking;
using FiestaBot.Manager.Networking;
using FiestaBot.Utilities;
using FiestaBot.Zone.Networking;
using System.Net;
using FiestaBot.Manager.ClientPacket;

namespace FiestaBot.Manager.Handlers
{
    internal class Manager04Handler
    {
        [ManagerPacketHandler(4, 2)]
        public static void ServerError(ManagerClient Socket, Packet Packet)
        {
            Packet.ReadShort(out short Error);
            Packet.Dispose();

            Logger.Log(LogType.World, "A world error occurred: {0}", (ConnectError)Error);
        }

        [ManagerPacketHandler(4, 3)]
        public static void ZoneIP(ManagerClient Socket, Packet Packet)
        {
            Packet.ReadString(out string IP, 16);
            Packet.ReadUShort(out ushort Port);

            new ZoneClient(IPAddress.Parse(IP), Port);

            Packet.Dispose();

            ManagerPacket.SendRequestAllData(Socket);
        }

        [ManagerPacketHandler(4, 18)]
        public static void AcademyResponse(ManagerClient Socket, Packet Packet)
        {
            //TODO: Academy response
            Packet.Dispose();
        }

        [ManagerPacketHandler(4, 151)]
        public static void AcademyInfo(ManagerClient Socket, Packet Packet)
        {
            //TODO: Academy info
            Packet.Dispose();
        }
    }
}
