using PSO2SERVER.Models;
using PSO2SERVER.Party;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace PSO2SERVER.Protocol.Packets
{
    public class PartyInfoPacket : Packet
    {
        /// Number of populated party infos.
        public uint num_of_infos { get; set; } = 0;
        public PartyInfo[] partyInfos { get; set; } = new PartyInfo[10];

        public PartyInfoPacket(PartyInfo[] partyInfos)
        {
            num_of_infos = (uint)partyInfos.Length;
            this.partyInfos = partyInfos;
        }

        #region implemented abstract members of Packet

        public override byte[] Build()
        {
            var pkt = new PacketWriter();
            pkt.WriteMagic(num_of_infos, 0xE7E8, 0xFF);
            pkt.WriteStructArray(partyInfos);
            return pkt.ToArray();
        }

        public override PacketHeader GetHeader()
        {
            return new PacketHeader(0x0E, 0x1B, PacketFlags.PACKED);
        }

        #endregion
    }
}