using System;

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

        public TsDescriptorAttribute(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;
        }
    }
}
