using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using skyscraper5.Dvb.Psi;
using skyscraper5.Dvb.Psi.Model;
using skyscraper5.Mpeg2;
using skyscraper5.Skyscraper.IO;
using skyscraper5.Skyscraper.Plugins;

namespace skyscraper5.Skyscraper.Scraper.StreamAutodetection.Contestants
{
	[SkyscraperPlugin]
	class NitContestant : Contestant, INitEventHandler, IDisposable
    {
        public NitContestant(int pid) : base("NIT", pid)
        {
            PacketProcessor = new PsiDecoder(pid, new NitParser(this));
        }

        public void SetNetworkId(ushort networkId, bool forceOverrite = false)
        {
        }

        public void OnNitTransportStream(ushort networkId, NitTransportStream transportStream)
        {
            Score++;
        }

        public void OnNitNetwork(NitNetwork nitNetwork)
        {
            Score++;
        }

        public override void Dispose()
        {
            
        }

        public override void DeclareWinner(SkyscraperContext skyscraperContext, int pid, ProgramContext programContext)
        {
			skyscraperContext.DvbContext.RegisterPacketProcessor(pid, new PsiDecoder(pid, new NitParser(skyscraperContext)));
		}

        public override void Introduce(ProgramContext programContext)
        {
	        
        }
    }
}
