// =============================================================================
// Tesla.Contract — Mock RPC client  (net48 only)
// =============================================================================
// Reconstructed verbatim from TeslaConsoleLaunchLib.dll. An offline test/dev
// stand-in for PodManagerConnection. Not referenced by the shipping Console UI,
// but retained for parity with the original assembly surface.
// =============================================================================

using System;
using System.Collections.Generic;
using System.Net;
using System.Threading;

namespace Tesla.Net
{
    public class MockPodManagerConnection : IPodManagerConnection, ILauncherService
    {
        public static readonly Guid RPAppGuid = new Guid("7D241B1F-AB6D-4e08-9C20-12294E743D94");

        public static readonly Guid RPMRAppGuid = new Guid("8F71D5C2-38E4-413c-8E22-88CAD08774D2");

        public static readonly Guid RPLCAppGuid = new Guid("57A0B3C2-D5CF-46d6-ABED-A8F4A26AB086");

        public static readonly Guid MW4AppGuid = new Guid("CC8500ED-A653-45a7-BEF8-C332D30371A6");

        public static readonly Guid MW4LCAppGuid = new Guid("8EE93A6C-F16A-49be-B867-37FAE9087FFF");

        private bool mIsOpen;

        private List<LaunchedAppData> mLaunchedApps = new List<LaunchedAppData>();

        public bool IsOpen => mIsOpen;

        public float VolumeLevel
        {
            get
            {
                throw new NotImplementedException();
            }
            set
            {
                throw new NotImplementedException();
            }
        }

        public void Open(IPEndPoint remoteEndPoint, byte[] secureKey)
        {
            Thread.Sleep(5000);
            mIsOpen = true;
        }

        public void Close()
        {
            Thread.Sleep(5000);
            mIsOpen = false;
        }

        public Guid InstallProduct(string filename)
        {
            throw new NotImplementedException();
        }

        public void ClearStore()
        {
            throw new NotImplementedException();
        }

        public DateTime Ping(DateTime now)
        {
            throw new NotImplementedException();
        }

        public Guid InitiateInstallProduct()
        {
            throw new NotImplementedException();
        }

        public OutOfBandProgress GetOutOfBandProgress(Guid invokeCallId)
        {
            throw new NotImplementedException();
        }

        public int LaunchApp(Guid launchKey)
        {
            throw new NotImplementedException();
        }

        public LaunchPair[] GetLaunchableApps()
        {
            return new LaunchPair[2]
            {
                new LaunchPair
                {
                    DisplayName = "BattleTech Firestorm",
                    LaunchKey = MW4AppGuid
                },
                new LaunchPair
                {
                    DisplayName = "Red Planet",
                    LaunchKey = RPAppGuid
                }
            };
        }

        public void KillApp(Guid launchKey, int processId)
        {
            throw new NotImplementedException();
        }

        public void KillAllOfType(Guid launchKey)
        {
            throw new NotImplementedException();
        }

        public void KillAllApps()
        {
            throw new NotImplementedException();
        }

        public void Shutdown(bool restart)
        {
            throw new NotImplementedException();
        }

        public LaunchedAppData[] GetLaunchedApps()
        {
            return mLaunchedApps.ToArray();
        }

        public LaunchData[] GetInstalledApps()
        {
            return new LaunchData[2]
            {
                new LaunchData
                {
                    LaunchPair = new LaunchPair
                    {
                        DisplayName = "BattleTech Firestorm",
                        LaunchKey = MW4AppGuid
                    }
                },
                new LaunchData
                {
                    LaunchPair = new LaunchPair
                    {
                        DisplayName = "Red Planet",
                        LaunchKey = RPAppGuid
                    }
                }
            };
        }

        public void RemoveApp(Guid index)
        {
            throw new NotImplementedException();
        }

        public void InstallApp(LaunchData data)
        {
            throw new NotImplementedException();
        }

        public void UninstallApp(Guid launchKey)
        {
            throw new NotImplementedException();
        }

        public FullUpdateData FullUpdate()
        {
            FullUpdateData result = default(FullUpdateData);
            result.InstalledApps = GetInstalledApps();
            result.LaunchedApps = GetLaunchedApps();
            result.VolumeLevel = VolumeLevel;
            return result;
        }
    }
}
