using skyscraper5.Skyscraper.Scraper.Storage;
using skyscraper8.DvbI;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using skyscraper8.Skyscraper.Scraper.Storage;

namespace skyscraper8.yo3explorer
{
	internal class yo3explorerToSkyscraperContextBridge
	{
		public DateTime CurrentTime { get; internal set; }
		public ServiceListEntryPointSource Source { get; internal set; }
		public int? OriginalNetworkId { get; internal set; }
		public int? TransportStreamId { get; internal set; }
		public int PID { get; internal set; }
		public DataStorage DataStorage { get; set; }

		public long GetSourceHash()
		{
			return DvbIUtils.GetSourceHash(Source, (ushort)OriginalNetworkId.Value, (ushort)TransportStreamId.Value, PID);
		}

		internal string ToHumanReadableSourceString()
		{
			switch (Source)
			{
				case ServiceListEntryPointSource.TransportStream:
					return String.Format("ONID: {0}, TSID: {1}, PID: {2}", OriginalNetworkId.Value, TransportStreamId.Value, PID);
				default:
					throw new NotImplementedException(Source.ToString());
			}
		}
	}
}
