using log4net;
using log4net.Repository.Hierarchy;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace skyscraper8.Ietf.Rfc4566_SDP
{
	public class SdpConnectionData
	{
		private static readonly ILog logger = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name);

		public SdpConnectionData(string[] args)
		{
			if (!SdpNetworkType.TryParse(args[0], true, out _networkType))
			{
				logger.ErrorFormat("Unknown Network Type \"{0}\", assuming \"IN\" - please consider sharing a sample of this stream so this can be implemented.", args[0]);
				_networkType = SdpNetworkType.IN;
			}

			if (!SdpAddressType.TryParse(args[1], true, out _addressType))
			{
				logger.ErrorFormat("Unknown Address Type \"{0}\", assuming \"IP4\" - please consider sharing a sample of this stream so this can be implemented.", args[1]);
				_addressType = SdpAddressType.IP4;
			}

			DestinationAddress = args[2];
		}

		public string DestinationAddress { get; private set; }
		private SdpAddressType _addressType;
		public SdpAddressType AddressType
		{
			get => _addressType;
		}

		private SdpNetworkType _networkType;
		public SdpNetworkType NetworkType
		{
			get => _networkType;
		}
	}
}
