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

namespace PSO2SERVER.Protocol.Packets
{
    public class ARKSMissionListPacket : Packet
    {
        public uint Unk1 {  get; set; } = new uint();
        public List<Mission> Missions { get; set; } = new List<Mission>();
        public uint DailyUpdate { get; set; } = new uint();
        public uint WeeklyUpdate { get; set; } = new uint();
        public uint TierUpdate { get; set; } = new uint();

        public ARKSMissionListPacket(List<Mission> mission)
        {
            Unk1 = 0;
            Missions = mission;
            DailyUpdate = 1689272266;
            WeeklyUpdate = 1689273267;
            TierUpdate = 1689273267;

        }

        #region implemented abstract members of Packet

        public override byte[] Build()
        {
            var pkt = new PacketWriter();
            pkt.Write(Unk1);
            pkt.WriteMagic(Missions.Count, 0xC691, 0x47);
            foreach (var mission in Missions) {pkt.WriteStruct(mission);}
            pkt.Write(DailyUpdate);
            pkt.Write(WeeklyUpdate);
            pkt.Write(TierUpdate);
            return pkt.ToArray();
        }

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

        #endregion
    }
}