using skyscraper5.Skyscraper.IO;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace skyscraper5.T2MI.Packets.AdressingFunctions
{
    internal class _0x04_CellId : AddressingFunction
    {
        public _0x04_CellId(byte[] buffer)
            : base(0x02, true, true)
        {
            if (buffer.Length != 3)
            {
                Valid = false;
                return;
            }

            MemoryStream ms = new MemoryStream(buffer, false);
            CellId = ms.ReadUInt16BE();

            byte v = ms.ReadUInt8();
            WaitForEnableFlag = (v & 0x80) != 0;
        }

        public ushort CellId { get; }
        public bool WaitForEnableFlag { get; }
    }
}
