// Created with MonoDevelop
//
//    Copyright (C) 2023 Hiperscan GmbH Dresden, Germany
//
//    This program is free software: you can redistribute it and/or modify
//    it under the terms of the GNU General Public License as published by
//    the Free Software Foundation, either version 3 of the License, or
//    (at your option) any later version.
//
//    This program is distributed in the hope that it will be useful,
//    but WITHOUT ANY WARRANTY; without even the implied warranty of
//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//    GNU General Public License for more details.
//
//    You should have received a copy of the GNU General Public License
//    along with this program.  If not, see <http://www.gnu.org/licenses/>.


using System;
using Hiperscan.Spectroscopy;
using Hiperscan.Unix;

namespace Hiperscan.SGS.Benchtop
{
    public class RecalibrationSet
    {
        public RecalibrationSet(ProbeType prope_type)
        {
            this.ProbeType = ProbeType;
        }

        public RecalibrationSet(RecalibrationSet recalibration_set, ProbeType prope_type) : this(prope_type)
        {
            if (recalibration_set.IsComplete == false)
                throw new Exception(Catalog.GetString("Recalibration set is not complete"));

            this.Dark = recalibration_set.Dark.Clone();
            this.White = recalibration_set.White.Clone();
            this.Oxid = recalibration_set.Oxid.Clone();
        }

        public bool IsComplete
        {
            get
            {
                if (this.Dark == null)
                    return false;

                if (this.White == null)
                    return false;

                if (this.Oxid == null)
                    return false;

                return true;
            }
        }

        private Spectrum dark = null;
        public Spectrum Dark
        {
            get
            {
                return this.dark;
            }
            set
            {
                this.dark = value;
                if (this.dark != null)
                    this.dark.ProbeType = this.ProbeType;
            }
        }

        private Spectrum white = null;
        public Spectrum White
        {
            get
            {
                return this.white;
            }
            set
            {
                this.white = value;
                if (this.white != null)
                    this.white.ProbeType = this.ProbeType;
            }
        }

        private Spectrum oxid = null;
        public Spectrum Oxid
        {
            get
            {
                return this.oxid;
            }
            set
            {
                this.oxid = value;
                if (this.oxid != null)
                    this.oxid.ProbeType = this.ProbeType;
            }
        }

        public ushort Average { get; set; } = 0;
        public ProbeType ProbeType { get; private set; }
    }
}
