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

namespace skyscraper5.Teletext.Wss
{
    class WssDataField
    {
        public WssDataField(byte[] buffer)
        {
            MemoryStream ms = new MemoryStream(buffer, false);
            byte readUInt8 = ms.ReadUInt8();
            FieldParity = (readUInt8 & 0x20) != 0;
            LineOffset = (readUInt8 & 0x1f);
            WssDataBlock = new WssDataBlock(ms.ReadUInt16BE());
        }

        public int LineOffset { get; private set; }
        public WssDataBlock WssDataBlock { get; }
        public bool FieldParity { get; private set; }
    }
}
