using System;

namespace Icarus.Input {
    /// <summary>
    /// I am a singleton which can be used to retrieve Input Engine settings.
    /// Members are straightforward to access.
    /// </summary>
	public class InputSettings {

        #region Singleton Stuff
        /// <summary>
        /// Singleton instance.
        /// </summary>
        private static InputSettings instance = new InputSettings();
        
        /// <summary>
        /// Accessor/Modifier for singleton instance.
        /// </summary>
        public static InputSettings Instance {
            get { return instance; }
            set { instance = value;}
        }
        #endregion

        #region Instance Variables
        /// <summary>
        /// Maximum length of keyboard event queue before input loss is incurred.
        /// </summary>
        private int maxKeyboardEvents;
        /// <summary>
        /// Maximum length of mouse event queue before input loss is incurred.
        /// </summary>
        private int maxMouseEvents;
        /// <summary>
        /// Maximum length of joystick event queue before input loss is incurred.
        /// </summary>
        private int maxJoystickEvents;
        /// <summary>
        /// Time the thread takes between each update of devices.  
        /// Missed input can occur if value is set too high, Performance is lowered if value is too low.
        /// </summary>
        private int loopIntervalTime;
        #endregion

        #region Accessors/Modifiers
        /// <summary>
        /// This sets and accesses the GLOBAL maximum number of keyboard events that are queued.
        /// </summary>
        public int MaxKeyboardEvents {
            get { return maxKeyboardEvents; }
            set { maxKeyboardEvents = value;}
        }        
        /// <summary>
        /// This sets and accesses the GLOBAL maximum number of mouse events that are queued.
        /// </summary>
        public int MaxMouseEvents {
            get { return maxMouseEvents; }
            set { maxMouseEvents = value;}
        }        
        /// <summary>
        /// This sets and accesses the GLOBAL maximum number of joystick events that are queued.
        /// </summary>
        public int MaxJoystickEvents {
            get { return maxJoystickEvents; }
            set { maxJoystickEvents = value;}
        }
        /// <summary>
        /// This sets and accesses the GLOBAL time interval between input intervals.
        /// </summary>
        public int LoopIntervalTime {
            get { return loopIntervalTime; }
            set { loopIntervalTime = value; }
        }
        #endregion

        #region Initialization
        /// <summary>
        /// Initializes the Input Settings to the default values for the Game Engine.
        /// </summary>
        private InputSettings() {
            maxKeyboardEvents = 100000;
            maxMouseEvents = 100000;
            maxJoystickEvents = 100000;
            loopIntervalTime = 25;
        }

        /// <summary>
        /// Load the Input Settings from fileName.
        /// Loads defaults then overwrites them with values in File.
        /// </summary>
        /// <param name="fileName">Name of File to load</param>
        private InputSettings(string fileName) : this() {
        }
        #endregion

    }
}
