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

namespace PSO2SERVER.Protocol.Packets
{
    public class LoadPlayerInventoryPacket : Packet
    {
        /// Player object.
        public ObjectHeader ObjectHeader { get; set; } = new ObjectHeader();
        /// Character's name.
        public string Name { get; set; } = string.Empty;
        /// Meseta currently held.
        public ulong Meseta { get; set; } = 0;
        /// Max inventory capacity.
        public uint Maxcapacity { get; set; } = 0;
        public List<PSO2Items> Items { get; set; }= new List<PSO2Items>();
        
        public LoadPlayerInventoryPacket(uint account_id, Client client)
        {
            ObjectHeader = new ObjectHeader(account_id, ObjectType.Player);
            Name = client.Character.Name;
        }

        #region implemented abstract members of Packet

        public override byte[] Build()
        {
            var pkt = new PacketWriter();
            pkt.WriteObjectHeader(ObjectHeader);
            pkt.Write(Name);

            return pkt.ToArray();
        }

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

        #endregion
    }
}