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

namespace skyscraper8.Ietf.Rfc4566_SDP
{
	public struct SdpTimes
	{
		private const long NTP_OFFSET = 2208988800L;
		private readonly long _startTime;
		private readonly long _stopTime;

		public SdpTimes(string[] args)
		{
			_startTime = long.Parse(args[0]);
			_stopTime = long.Parse(args[1]);
		}

		public bool IsNull
		{
			get => _startTime == 0;
		}

		public DateTime? StartTime
		{
			get
			{
				if (_startTime == 0)
					return null;

				long tmp = _startTime - NTP_OFFSET;
				return tmp.AsUnixtime();
			}
		}

		public DateTime? EndTime
		{
			get
			{
				if (_stopTime == 0)
					return null;

				long tmp = _stopTime - NTP_OFFSET;
				return tmp.AsUnixtime();
			}
		}
	}
}
