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

namespace skyscraper5.Skyscraper.Scraper.StreamAutodetection.Contestants
{
	[SkyscraperPlugin]
	class BatContestant : Contestant, IBatEventHandler, IDisposable
    {
		private static readonly ILog logger = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name);

		public BatContestant(int pid) : base("BAT", pid)
        {
            PacketProcessor = new PsiDecoder(pid, new BatParser(this));
        }

        public void OnBatBouquet(BatBouquet batBouquet)
        {
            Score++;
        }

        public void OnBatTransportStream(BatBouquet batBouquet, BatTransportStream child)
        {
            Score++;
        }

        public override void Dispose()
        {
            
        }

        public override void DeclareWinner(SkyscraperContext skyscraperContext, int pid, ProgramContext programContext)
        {
            logger.ErrorFormat("{0} {1} not yet implemented", nameof(BatContestant), nameof(DeclareWinner));
            skyscraperContext.DvbContext.RegisterPacketProcessor(pid, new PacketDiscarder());
        }

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