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

namespace skyscraper5.Dvb.SystemSoftwareUpdate.Descriptors
{
	[SkyscraperPlugin]
	[TsDescriptor(0x02,"UNT")]
    class UpdateDescriptor : TsDescriptor
    {
        public UpdateDescriptor(byte[] buffer)
        {
            UpdateFlag = buffer[0] & 0xc0;
            UpdateMethod = buffer[0] & 0x3c;
            UpdatePriority = buffer[0] & 0x03;

            if (buffer.Length > 1)
            {
                PrivateData = new byte[buffer.Length - 1];
                Array.Copy(buffer, 1, PrivateData, 0, PrivateData.Length);
            }
        }

        public int UpdatePriority { get; private set; }

        public int UpdateMethod { get; private set; }

        public int UpdateFlag { get; private set; }

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