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

namespace skyscraper5.Dvb
{
    [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
    sealed class ExtensionDescriptorAttribute : Attribute
    {
        public byte DescriptorId { get; }
        public string[] CompatibleTables { get; }

        public ExtensionDescriptorAttribute(byte descriptorId, params string[] compatibleTables)
        {
            DescriptorId = descriptorId;
            CompatibleTables = compatibleTables;
        }

        public bool Matches(string table)
        {
            foreach (string compatibleTable in CompatibleTables)
            {
                if (compatibleTable == table)
                    return true;
            }

            return false;
        }
    }
}
