using System.Collections.Generic;
using System.Threading;
using Inspectron.Camera.Image;

namespace Inspectron.Camera.NoImage
{
    public class NoImageCamera:ICamera
    {
        public NoImageCamera(ICameraProvider provider)
        {
            Provider = provider;
        }

        private int _acquisitionDelay = 0;
        public string Name { get; }
        public void Open()
        {
            
        }

        public bool IsOpen { get; }
        public void Close()
        {
            
        }

        public bool IsGrabbingContinuous { get; private set; }

        public void StartGrabContinuous()
        {
            IsGrabbingContinuous = true;
        }

        public void StopGrabContinuous()
        {
            IsGrabbingContinuous = false;
        }

        public void LoadParameters(string parametersFile)
        {
            throw new System.NotImplementedException();
        }

        public void SaveParameters(string parametersFile)
        {
            throw new System.NotImplementedException();
        }

        public void SaveParametersToDevice()
        {
            throw new System.NotImplementedException();
        }

        public int AcquisitionDelay
        {
            get => _acquisitionDelay;
            set => _acquisitionDelay = value;
        }

        public IImage GrabSingle()
        {
            Thread.Sleep(AcquisitionDelay);
            return null;
        }

        public event ImageGrabbedHandler ImageGrabbed=delegate{};
        public ICameraCapabilities Capabilities =>new NoImageCameraCapabilities();
        public IEnumerable<ICameraParameter> Parameters =>new List<ICameraParameter>()
        {
            new CameraParameter("AcquisitionDelay",() => this.AcquisitionDelay,x=>AcquisitionDelay=(int)x)
        };
        public ICameraProvider Provider { get; }
    }
}