using System;
using System.Net.NetworkInformation;
using System.Runtime.InteropServices;
using skyscraper5.Skyscraper.IO.CrazycatStreamReader;

namespace skyscraper5.Skyscraper
{
    public class TunerMetadata
    {
        public int Index { get; }
        public string Name { get; }
        public STD_TYPE Type { get; }
        public Caps Caps { get; set; }
        public PhysicalAddress MacAddress { get; set; }

        public int DiseqcType;

        public int[] Satellites;
        public int[] Lnbs;
        public int[] Dishes;

		public TunerMetadata()
        {

        }

        public TunerMetadata(int index, string name, STD_TYPE type)
        {
            Index = index;
            Name = name;
            Type = type;
            Satellites = new int[4];
            Lnbs = new int[4];
            Dishes = new int[4];
        }

        public int GetNumSatsFromDiseqcType()
        {
            switch (DiseqcType)
            {
                case 0: return 1;
                case 1: return 2;
                case 2: return 4;
                default: throw new NotImplementedException(String.Format("{0} {1}", nameof(DiseqcType), DiseqcType));
            }
        }

        public bool IsSatellite()
        {
	        switch (Type)
	        {
		        case STD_TYPE.STD_DVBS: return true;
                case STD_TYPE.STD_DVBS2: return true;
		        case STD_TYPE.STD_DVBT: return false;
		        case STD_TYPE.STD_DVBT2: return false;
		        case STD_TYPE.STD_DVBC: return false;
		        case STD_TYPE.STD_DVBC2: return false;
                default: throw new NotImplementedException(Type.ToString());
			}
        }
    }
}
