using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.IO;

namespace Inspectron.Camera.Emulation
{
    public class EmulationCameraProvider:ICameraProvider
    {
        
        private EmulationCamera _emulationCamera;

        public EmulationCameraProvider(params string[] emulationFolders)
        {
            List<ICamera> cameras = new List<ICamera>();
            foreach (string s in emulationFolders)
            {
                _emulationCamera = new EmulationCamera(this);
                _emulationCamera.Name = "Emulation "+Path.GetFileNameWithoutExtension(s);
                _emulationCamera.SetFolder(s);
                cameras.Add(_emulationCamera);
            }
            
            Cameras=new ReadOnlyCollection<ICamera>(cameras);
        }

        public string Name { get; } = "Emulation camera provider";
        public ReadOnlyCollection<ICamera> Discover()
        {
            return Cameras;
        }

        public ReadOnlyCollection<ICamera> Cameras { get; }
    }
}