#ifndef FILTERCUBE_HPP_INCLUDED
#define FILTERCUBE_HPP_INCLUDED

#include <iostream>
#include <memory>
#include <optional>
#include <set>
#include <string>
#include <vector>
#include <NBO/NBO/EmissionFilterRef.h>
#include <NBO/NBO/ExcitationFilterRef.h>
#include <NBO/NBO/OpticsHolder_Type.h>
#include <NBO/NBO/StandardDichroicRef.h>
#include <NBO/NBO/ENBOType.h>
#include <NBO/NBOGlobal.h>
#include <NBO/Shared/Base/NBOBaseClass.h>


namespace Inscoper::NBO {

/*!
* \brief Represents the XML element FilterCube.
*
* A Filter Cube is a removable cube-shaped unit that containing the filters and mirror used in epi-fluorescence microscopy to separate fluorescence excitation and emission light. It usually holds a matched set of fluorescence filters, which might include an Excitation filter and Emission filter but always includes a Dichroic mirror. A Filter Cube might be pre-assebled by the Manufacturer and pruchased as a whole or it might be custom assembled on site depending on the needs of the user.
*/
class NBO_EXPORT FilterCube : public OpticsHolder_Type {

public:
	
	FilterCube();
	~FilterCube();

	/*!
	* \brief Cast a NBOBaseClass to a FilterCube.
	*
	* \param base The base class to cast
	* \return The casted element, or nullptr if the cast fails
	*/
	static std::shared_ptr<FilterCube> 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 OpticsHolderPosition attribute.
	*
	* When relevant, this field records the position of this Filter Cube in a Optics Holder.
	*
	* \param value The value to set
	* \param validate If true, validates constraints on value. Default is true.
	*/
	void setOpticsHolderPosition(const std::string& value, bool validate = true);

	/*!
	* \brief Returns the value of the OpticsHolderPosition attribute.
	*
	* When relevant, this field records the position of this Filter Cube in a Optics Holder.
	*
	* \return The value of the attribute
	*/
	std::string getOpticsHolderPosition() const;

	/*!
	* \brief Resets the OpticsHolderPosition attribute to an unset state.
	*
	* When relevant, this field records the position of this Filter Cube in a Optics Holder.
	*/
	void resetOpticsHolderPosition();

	/*!
	* \brief Checks whether the OpticsHolderPosition attribute is present.
	*
	* When relevant, this field records the position of this Filter Cube in a Optics Holder.
	*
	* \return true if the attribute has been set, false otherwise
	*/
	bool hasOpticsHolderPosition() const;

	/*!
	* \brief Returns the allowed values for this attribut.
	*
	* When relevant, this field records the position of this Filter Cube in a Optics Holder.
	*
	* \return The list of allowed values
	*/
	static const std::set<std::string>& getOpticsHolderPositionAllowedValues();

	/*!
	* \brief Sets the value of the ExcitationFilterRef 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 setExcitationFilterRef(const Inscoper::NBO::ExcitationFilterRefPtr& value, bool validate = true);

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

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

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

	/*!
	* \brief Sets the value of the StandardDichroicRef element.
	*
	* This field refers to an available Dichroic Mirror, which is part of this Filter Cube.
	*
	* \param value The value to set
	* \param validate If true, validates constraints on value. Default is true.
	*/
	void setStandardDichroicRef(const Inscoper::NBO::StandardDichroicRefPtr& value, bool validate = true);

	/*!
	* \brief Returns the value of the StandardDichroicRef element.
	*
	* This field refers to an available Dichroic Mirror, which is part of this Filter Cube.
	*
	* \return The value of the element
	*/
	Inscoper::NBO::StandardDichroicRefPtr getStandardDichroicRef() const;

	/*!
	* \brief Resets the StandardDichroicRef element to an unset state.
	*
	* This field refers to an available Dichroic Mirror, which is part of this Filter Cube.
	*/
	void resetStandardDichroicRef();

	/*!
	* \brief Checks whether the optional StandardDichroicRef element is present.
	*
	* This field refers to an available Dichroic Mirror, which is part of this Filter Cube.
	*
	* \return true if the optional attribute has been set, false otherwise
	*/
	bool hasStandardDichroicRef() const;

	/*!
	* \brief Sets the value of the EmissionFilterRef 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 setEmissionFilterRef(const Inscoper::NBO::EmissionFilterRefPtr& value, bool validate = true);

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

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

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


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

    std::optional<std::string> OpticsHolderPosition; // Optional attribute
    static const std::set<std::string> OpticsHolderPositionAllowedValues;
    Inscoper::NBO::ExcitationFilterRefPtr ExcitationFilterRef = nullptr;
    Inscoper::NBO::StandardDichroicRefPtr StandardDichroicRef = nullptr;
    Inscoper::NBO::EmissionFilterRefPtr EmissionFilterRef = nullptr;
};

/*! Shared pointer for FilterCube*/
typedef std::shared_ptr<FilterCube> FilterCubePtr;

} // namespace Inscoper::NBO

#endif // FILTERCUBE_HPP_INCLUDED