using System;

namespace skyscraper5.Teletext.Vps
{
    public class VpsDataBlock
    {
        public VpsDataBlock(byte[] buffer)
        {
            byte[] vpsBuffer = new byte[15];
            vpsBuffer[0] = 255;
            vpsBuffer[1] = 0b10111010;
            Array.Copy(buffer, 0, vpsBuffer, 2, 13);

            Day = (vpsBuffer[10] & 0x7c) >> 2;

            Month = (vpsBuffer[10] & 0x80) >> 7;
            Month <<= 3;
            Month += (vpsBuffer[11] & 0x07);

            Hour = ((vpsBuffer[11] & 0xf8) >> 3);

            Minute = ((vpsBuffer[12] & 0x3f));
        }
        

        public int Minute { get; private set; }

        public int Hour { get; private set; }

        public int Month { get; private set; }

        public int Day { get; private set; }
    }
}
