using System;
namespace Hiperscan.SGS.Benchtop.LightSourceControl
{
    public class LightSourceSettings
    {
        public UInt16 Lamp1Voltage_mV { get; set; }
        public UInt16 Lamp2Voltage_mV { get; set; }
        public UInt16 Lamp3Voltage_mV { get; set; }
        public UInt16 Reserved { get; set; }

        public override string ToString()
        {
            string voltages = "Lightsource voltages;\n";
            voltages += String.Format("\tSet voltage lamp 1  : {0}mV\n", this.Lamp1Voltage_mV);
            voltages += String.Format("\tSet voltage lamp 1  : {0}mV\n", this.Lamp2Voltage_mV);
            voltages += String.Format("\tSet voltage lamp 1  : {0}mV\n", this.Lamp3Voltage_mV);
            voltages += String.Format("\tSet reserved        : {0}mV\n", this.Reserved);

            return voltages;
        }

        public UInt16 GetVoltageByLamp(LampSelection lamp)
        {
            switch (lamp)
            {
                case LampSelection.Lamp1:
                    return this.Lamp1Voltage_mV;
                case LampSelection.Lamp2:
                    return this.Lamp2Voltage_mV;
                case LampSelection.Lamp1AndLamp2:
                case LampSelection.All:
                    return this.Lamp3Voltage_mV;
                case LampSelection.None:
                    return 0;
                default:
                    throw new NotSupportedException();
            }
        }
    }
}
