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

namespace PSO2SERVER.Protocol.Packets
{
    public class MailBodyPacket : Packet
    {
        public MailId Id { get; set; } = new MailId();
        public string Messaga { get; set; } = string.Empty;
        public uint Unk3 { get; set; } = 0;

        public MailBodyPacket()
        {
            Id = new MailId();
        }

        public MailBodyPacket(MailId id, string messaga, uint unk3)
        {
            Id = id;
            Messaga = messaga;
            Unk3 = unk3;
        }

        #region implemented abstract members of Packet

        public override byte[] Build()
        {
            var pkt = new PacketWriter();
            pkt.WriteStruct(Id);
            pkt.WriteUtf16(Messaga, 0x5913, 0x82);
            pkt.Write(Unk3);
            return pkt.ToArray();
        }

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

        #endregion
    }
}