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

namespace PSO2SERVER.Protocol.Packets
{
    public class MoveToMatStoragePacket : Packet
    {
        /// <summary>
        /// Items updated in the inventory.
        /// </summary>
        public List<UpdatedInventoryItem> UpdatedInventory;  // Equivalent to Vec<UpdatedInventoryItem>

        /// <summary>
        /// Items updated in the material storage.
        /// </summary>
        public List<MaterialStorageItem> UpdatedMaterialStorage;  // Assuming this exists

        #region implemented abstract members of Packet

        public MoveToMatStoragePacket(List<UpdatedInventoryItem> updatedInventoryItems, List<MaterialStorageItem> materialStorageItems)
        {
            this.UpdatedInventory = updatedInventoryItems;
            this.UpdatedMaterialStorage = materialStorageItems;
        }

        public override byte[] Build()
        {
            var pkt = new PacketWriter();
            pkt.WriteMagic(UpdatedInventory.Count, 0x1644, 0x35);
            foreach (var item in UpdatedInventory) {pkt.WriteStruct(item);}
            pkt.WriteMagic(UpdatedMaterialStorage.Count, 0x1644, 0x35);
            foreach(var item in UpdatedMaterialStorage) {pkt.WriteStruct(item);}
            return pkt.ToArray();
        }

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

        #endregion
    }
}