using Org.BouncyCastle.Utilities;
using PSO2SERVER.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace PSO2SERVER.Protocol.Packets
{
    public class StartCutscenePacket : Packet
    {
        public string scene_name {  get; set; }
        public uint[] unk1 { get; set; } = new uint[9];
        public List<ObjectHeader> unk2 { get; set; } = new List<ObjectHeader>();
        public ulong unk3 { get; set; }
        public uint unk4 { get; set; }
        public byte unk5 { get; set; }
        public byte unk6 { get; set; }
        public byte unk7 { get; set; }
        public string unk8 { get; set; }
        public string unk9 { get; set; }
        public uint unk10 { get; set; }
        public ObjectHeader unk11 { get; set; }

        public StartCutscenePacket(string scene_name, List<ObjectHeader> unk2, ulong unk3, uint unk4, byte unk5, byte unk6, byte unk7, string unk8, string unk9, uint unk10, ObjectHeader unk11)
        {
            this.scene_name = scene_name;
            this.unk2 = unk2;
            this.unk3 = unk3;
            this.unk4 = unk4;
            this.unk5 = unk5;
            this.unk6 = unk6;
            this.unk7 = unk7;
            this.unk8 = unk8;
            this.unk9 = unk9;
            this.unk10 = unk10;
            this.unk11 = unk11;
        }

        #region implemented abstract members of Packet

        public override byte[] Build()
        {
            var pkt = new PacketWriter();
            pkt.WriteAscii(scene_name, 0xB65A, 0x7D);
            pkt.WriteUintArray(unk1);
            pkt.WriteObjectHeaderList(unk2);
            pkt.Write(unk3);
            pkt.Write(unk4);
            pkt.Write(unk5);
            pkt.Write(unk6);
            pkt.Write(unk7);
            pkt.WriteAscii(unk8, 0xB65A, 0x7D);
            pkt.WriteAscii(unk9, 0xB65A, 0x7D);
            pkt.Write(unk10);
            pkt.WriteObjectHeader(unk11);
            return pkt.ToArray();
        }

        public override PacketHeader GetHeader()
        {
            return new PacketHeader(0x0B, 0x06, PacketFlags.None);
        }

        #endregion
    }
}