using System;
using System.Collections.Generic;
using PSO2SERVER.Models;
using PSO2SERVER.Protocol.Packets;

namespace PSO2SERVER.Protocol.Handlers
{
    [PacketHandlerAttr(0x11, 0x14)]
    public class BlockLogin : PacketHandler
    {
        // Player ID
        public ulong PlayerId { get; set; }

        // Unknown fields
        public byte Unk1 { get; set; }
        public byte Unk2 { get; set; }
        public ushort Unk3 { get; set; }
        public uint Unk4 { get; set; }
        public uint Unk5 { get; set; }

        // Version ID (32 bytes)
        public byte[] VerId { get; set; } = new byte[0x20];

        // Clients' active network interfaces
        public List<NetInterface> Interfaces { get; set; }

        // Login challenge
        public uint Challenge { get; set; }

        // Unknown data, fixed length (196 bytes)
        public byte[] Unk6 { get; set; } = new byte[0xC4];

        // Unknown field, 16 bytes
        public byte[] Unk7 { get; set; } = new byte[0x10];

        public override void HandlePacket(Client context, byte flags, byte[] data, uint position, uint size)
        {
            var info = string.Format("[<--] 接收到的数据 (hex): {0} 字节", data.Length);
            Logger.WriteHex(info, data);

            var reader = new PacketReader(data, position, size);

        }
    }
}
