#ifndef TIRFSETTINGS_HPP_INCLUDED
#define TIRFSETTINGS_HPP_INCLUDED

#include <iostream>
#include <memory>
#include <optional>
#include <set>
#include <string>
#include <vector>
#include <NBO/NBO/Description.h>
#include <NBO/NBO/LSID_Type.h>
#include <NBO/NBO/Settings_Type.h>
#include <NBO/NBO/TIRFHardwareModuleRef.h>
#include <NBO/NBO/ENBOType.h>
#include <NBO/NBOGlobal.h>
#include <NBO/Shared/Base/NBOBaseClass.h>


namespace Inscoper::NBO {

class TIRFLightPath;

/*!
* \brief Represents the XML element TIRFSettings.
*
* Total Internal Reflection Fluorescence (TIRF) microscopy is a modality in which fluorescence is excited in a thin layer by an evanescent wave produced by total internal reflection. This element defines the TIRF conditions that were used for this Experiment.
*/
class NBO_EXPORT TIRFSettings : public Settings_Type {

public:
	
	TIRFSettings();
	~TIRFSettings();

	/*!
	* \brief Cast a NBOBaseClass to a TIRFSettings.
	*
	* \param base The base class to cast
	* \return The casted element, or nullptr if the cast fails
	*/
	static std::shared_ptr<TIRFSettings> fromBase(NBOBaseClassPtr base);

	/*!
	* \brief Returns the class type name.
	*
	* \return The class type name
	*/
	std::string getTypeName() const override;

	/*!
	* \brief Returns the XML element name corresponding to this class.
	*
	* \return The XML element name
	*/
	std::string getXMLName() const override;

	/*!
	* \brief Returns the NBO Type corresponding to this class.
	*
	* \return The NBO Type value
	*/
	ENBOType getNBOType() const override;

	/*!
	* \brief Returns a list of all classes derived from this class.
	*
	* \return The list of derived classes
	*/
	std::vector<NBOBaseClassPtr> getChildren() const override;

	/*!
	* \brief Returns a list of all child elements contained in this class.
	*
	* \return The list of child classes
	*/
	std::vector<NBOBaseClassPtr> getSubElements() const override;

	/*!
	* \brief Populates this object from a JSON file.
	*
	* \param path The path to the JSON file
	* \param validate If true, validates constraints on value. Default is true.
	*/
	void fromJsonFile(const std::string& path, bool validate = true);

	/*!
	* \brief Populates this object from a JSON string.
	*
	* \param json_string The JSON content as a string
	* \param validate If true, validates constraints on value. Default is true.
	*/
	void fromJsonString(const std::string& json_string, bool validate = true);

	/*!
	* \brief Populates this object from a XML file.
	*
	* \param path The path to the XML file
	* \param validate If true, validates constraints on value. Default is true.
	*/
	void fromXmlFile(const std::string& path, bool validate = true);

	/*!
	* \brief Populates this object from a XML string.
	*
	* \param xml_string The XML content as a string
	* \param validate If true, validates constraints on value. Default is true.
	*/
	void fromXmlString(const std::string& xml_string, bool validate = true);

	/*!
	* \brief Serializes this object to an XML file.
	*
	* \param filename The path to the output XML file
	* \param validate If true, validates constraints on value. Default is true.
	*/
	void toXmlFile(const std::string& filename, bool validate = true) const;

	/*!
	* \brief Serializes this object to an XML string.
	*
	* \param validate If true, validates constraints on value. Default is true.
	* \return A string containing the XML representation of this object
	*/
	std::string toXmlString(bool validate = true) const;

	/*!
	* \brief Sets the value of the ID attribute.
	*
	* A Unique Identifier for this component.
	*
	* \param value The value to set
	* \param validate If true, validates constraints on value. Default is true.
	*/
	void setID(const Inscoper::NBO::LSID_TypePtr& value, bool validate = true);

	/*!
	* \brief Returns the value of the ID attribute.
	*
	* A Unique Identifier for this component.
	*
	* \return The value of the attribute
	*/
	LSID_TypePtr getID() const;

	/*!
	* \brief Resets the ID attribute to an unset state.
	*
	* A Unique Identifier for this component.
	*/
	void resetID();

	/*!
	* \brief Checks whether the optional ID attribute is present.
	*
	* A Unique Identifier for this component.
	*
	* \return true if the optional attribute has been set, false otherwise
	*/
	bool hasID() const;

	/*!
	* \brief Sets the value of the HILO attribute.
	*
	* This field capture whether (True) or not (False) TIRF illumination for this Experiment was set up at or below the critical angle (63˚; true TIRF) or with oblique illumination (i.e., Highly Inclined and Laminated Optical - HILO).
	*
	* \param value The value to set
	* \param validate If true, validates constraints on value. Default is true.
	*/
	void setHILO(const bool& value, bool validate = true);

	/*!
	* \brief Returns the value of the HILO attribute.
	*
	* This field capture whether (True) or not (False) TIRF illumination for this Experiment was set up at or below the critical angle (63˚; true TIRF) or with oblique illumination (i.e., Highly Inclined and Laminated Optical - HILO).
	*
	* \return The value of the attribute
	*/
	bool getHILO() const;

	/*!
	* \brief Resets the HILO attribute to an unset state.
	*
	* This field capture whether (True) or not (False) TIRF illumination for this Experiment was set up at or below the critical angle (63˚; true TIRF) or with oblique illumination (i.e., Highly Inclined and Laminated Optical - HILO).
	*/
	void resetHILO();

	/*!
	* \brief Checks whether the HILO attribute is present.
	*
	* This field capture whether (True) or not (False) TIRF illumination for this Experiment was set up at or below the critical angle (63˚; true TIRF) or with oblique illumination (i.e., Highly Inclined and Laminated Optical - HILO).
	*
	* \return true if the attribute has been set, false otherwise
	*/
	bool hasHILO() const;

	/*!
	* \brief Sets the value of the TIRFAngle attribute.
	*
	* This field captures the incidence Angle used in this case.
	*
	* \param value The value to set
	* \param validate If true, validates constraints on value. Default is true.
	*/
	void setTIRFAngle(const float& value, bool validate = true);

	/*!
	* \brief Returns the value of the TIRFAngle attribute.
	*
	* This field captures the incidence Angle used in this case.
	*
	* \return The value of the attribute
	*/
	float getTIRFAngle() const;

	/*!
	* \brief Resets the TIRFAngle attribute to an unset state.
	*
	* This field captures the incidence Angle used in this case.
	*/
	void resetTIRFAngle();

	/*!
	* \brief Checks whether the TIRFAngle attribute is present.
	*
	* This field captures the incidence Angle used in this case.
	*
	* \return true if the attribute has been set, false otherwise
	*/
	bool hasTIRFAngle() const;

	/*!
	* \brief Sets the list of TIRFHardwareModuleRef elements.
	*
	* No description available in the XSD standard.
	*
	* \param value The new list of TIRFHardwareModuleRef elements
	* \param validate If true, validates constraints on value. Default is true.
	*/
	void setTIRFHardwareModuleRef_List(const std::vector<Inscoper::NBO::TIRFHardwareModuleRefPtr>& value, bool validate = true);

	/*!
	* \brief Returns the list of TIRFHardwareModuleRef elements.
	*
	* No description available in the XSD standard.
	*
	* \return The list of TIRFHardwareModuleRef elements
	*/
	std::vector<Inscoper::NBO::TIRFHardwareModuleRefPtr> getTIRFHardwareModuleRef_List() const;

	/*!
	* \brief Adds a new TIRFHardwareModuleRef element to this object.
	*
	* No description available in the XSD standard.
	*
	* \param value The element to add
	* \param validate If true, validates constraints on value. Default is true.
	*/
	void addToTIRFHardwareModuleRef_List(const Inscoper::NBO::TIRFHardwareModuleRefPtr& value, bool validate = true);

	/*!
	* \brief Clear the list of TIRFHardwareModuleRef.
	*
	* No description available in the XSD standard.
	*/
	void clearTIRFHardwareModuleRef_List();

	/*!
	* \brief Sets the value of the TIRFLightPath element.
	*
	* No description available in the XSD standard.
	*
	* \param value The value to set
	* \param validate If true, validates constraints on value. Default is true.
	*/
	void setTIRFLightPath(const std::shared_ptr<Inscoper::NBO::TIRFLightPath>& value, bool validate = true);

	/*!
	* \brief Returns the value of the TIRFLightPath element.
	*
	* No description available in the XSD standard.
	*
	* \return The value of the element
	*/
	std::shared_ptr<Inscoper::NBO::TIRFLightPath> getTIRFLightPath() const;

	/*!
	* \brief Resets the TIRFLightPath element to an unset state.
	*
	* No description available in the XSD standard.
	*/
	void resetTIRFLightPath();

	/*!
	* \brief Checks whether the optional TIRFLightPath element is present.
	*
	* No description available in the XSD standard.
	*
	* \return true if the optional attribute has been set, false otherwise
	*/
	bool hasTIRFLightPath() const;

	/*!
	* \brief Sets the value of the Description element.
	*
	* No description available in the XSD standard.
	*
	* \param value The value to set
	* \param validate If true, validates constraints on value. Default is true.
	*/
	void setDescription(const Inscoper::NBO::DescriptionPtr& value, bool validate = true);

	/*!
	* \brief Returns the value of the Description element.
	*
	* No description available in the XSD standard.
	*
	* \return The value of the element
	*/
	Inscoper::NBO::DescriptionPtr getDescription() const;

	/*!
	* \brief Resets the Description element to an unset state.
	*
	* No description available in the XSD standard.
	*/
	void resetDescription();

	/*!
	* \brief Checks whether the optional Description element is present.
	*
	* No description available in the XSD standard.
	*
	* \return true if the optional attribute has been set, false otherwise
	*/
	bool hasDescription() const;


private:
	class Impl;
	std::unique_ptr<Impl> pImpl;

	LSID_TypePtr ID = nullptr; // Required attribute
    std::optional<bool> HILO; // Optional attribute
    std::optional<float> TIRFAngle; // Optional attribute
    std::vector<Inscoper::NBO::TIRFHardwareModuleRefPtr> TIRFHardwareModuleRef_List;
    std::shared_ptr<Inscoper::NBO::TIRFLightPath> TIRFLightPath = nullptr;
    Inscoper::NBO::DescriptionPtr Description = nullptr;
};

/*! Shared pointer for TIRFSettings*/
typedef std::shared_ptr<TIRFSettings> TIRFSettingsPtr;

} // namespace Inscoper::NBO

#endif // TIRFSETTINGS_HPP_INCLUDED