using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace skyscraper5.Rds.Messages
{
    [RdsMessage(0x42,RdsMessageHeaderType.None)]
    class OdaFreeFormatGroup : RdsMessage
    {
        public OdaFreeFormatGroup(byte[] buffer)
        {
            ApplicationGroupTypeCode = buffer[0];

            byte configuration = buffer[1];
            PrioritySetting = (configuration & 0x30) >> 4;
            ModeSelection = (configuration & 0x0c) >> 2;
            BufferConfiguration = configuration & 0x03;

            
            Blocks = new byte[5];
            Array.Copy(buffer, 2, Blocks, 0, 5);
        }

        public byte[] Blocks { get; private set; }

        public int BufferConfiguration { get; private set; }

        public int ModeSelection { get; private set; }

        public int PrioritySetting { get; private set; }

        public byte ApplicationGroupTypeCode { get; private set; }
    }
}
