#ifndef MASKINGPLATE_HPP_INCLUDED
#define MASKINGPLATE_HPP_INCLUDED

#include <iostream>
#include <memory>
#include <optional>
#include <set>
#include <string>
#include <vector>
#include <NBO/NBO/MaskingPlateFunction_Type.h>
#include <NBO/NBO/OpticalAperture_Type.h>
#include <NBO/NBO/UnitsLength_Type.h>
#include <NBO/NBO/ENBOType.h>
#include <NBO/NBOGlobal.h>
#include <NBO/Shared/Base/NBOBaseClass.h>


namespace Inscoper::NBO {

/*!
* \brief Represents the XML element MaskingPlate.
*
* This element describes an opaque Masking Plate positioned in the light path to block specific components of the light beam.
*/
class NBO_EXPORT MaskingPlate : public OpticalAperture_Type {

public:
	
	MaskingPlate();
	~MaskingPlate();

	/*!
	* \brief Cast a NBOBaseClass to a MaskingPlate.
	*
	* \param base The base class to cast
	* \return The casted element, or nullptr if the cast fails
	*/
	static std::shared_ptr<MaskingPlate> 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 Function attribute.
	*
	* This field describes the Function of this Spatial Mask.
	*
	* \param value The value to set
	* \param validate If true, validates constraints on value. Default is true.
	*/
	void setFunction(const Inscoper::NBO::MaskingPlateFunction_TypePtr& value, bool validate = true);

	/*!
	* \brief Returns the value of the Function attribute.
	*
	* This field describes the Function of this Spatial Mask.
	*
	* \return The value of the attribute
	*/
	MaskingPlateFunction_TypePtr getFunction() const;

	/*!
	* \brief Resets the Function attribute to an unset state.
	*
	* This field describes the Function of this Spatial Mask.
	*/
	void resetFunction();

	/*!
	* \brief Checks whether the optional Function attribute is present.
	*
	* This field describes the Function of this Spatial Mask.
	*
	* \return true if the optional attribute has been set, false otherwise
	*/
	bool hasFunction() const;

	/*!
	* \brief Sets the value of the Excitation attribute.
	*
	* This field records whether this Spatial Mask is placed in the Excitation (True) or the Emission (False) light path.
	*
	* \param value The value to set
	* \param validate If true, validates constraints on value. Default is true.
	*/
	void setExcitation(const bool& value, bool validate = true);

	/*!
	* \brief Returns the value of the Excitation attribute.
	*
	* This field records whether this Spatial Mask is placed in the Excitation (True) or the Emission (False) light path.
	*
	* \return The value of the attribute
	*/
	bool getExcitation() const;

	/*!
	* \brief Resets the Excitation attribute to an unset state.
	*
	* This field records whether this Spatial Mask is placed in the Excitation (True) or the Emission (False) light path.
	*/
	void resetExcitation();

	/*!
	* \brief Checks whether the Excitation attribute is present.
	*
	* This field records whether this Spatial Mask is placed in the Excitation (True) or the Emission (False) light path.
	*
	* \return true if the attribute has been set, false otherwise
	*/
	bool hasExcitation() const;

	/*!
	* \brief Sets the value of the ApertureSize attribute.
	*
	* This field captures the maximum physical Width of individual Apertures present in this Spatial Mask.
	*
	* \param value The value to set
	* \param validate If true, validates constraints on value. Default is true.
	*/
	void setApertureSize(const float& value, bool validate = true);

	/*!
	* \brief Returns the value of the ApertureSize attribute.
	*
	* This field captures the maximum physical Width of individual Apertures present in this Spatial Mask.
	*
	* \return The value of the attribute
	*/
	float getApertureSize() const;

	/*!
	* \brief Resets the ApertureSize attribute to an unset state.
	*
	* This field captures the maximum physical Width of individual Apertures present in this Spatial Mask.
	*/
	void resetApertureSize();

	/*!
	* \brief Checks whether the ApertureSize attribute is present.
	*
	* This field captures the maximum physical Width of individual Apertures present in this Spatial Mask.
	*
	* \return true if the attribute has been set, false otherwise
	*/
	bool hasApertureSize() const;

	/*!
	* \brief Sets the value of the ApertureSizeUnit attribute.
	*
	* 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 setApertureSizeUnit(const Inscoper::NBO::UnitsLength_TypePtr& value, bool validate = true);

	/*!
	* \brief Returns the value of the ApertureSizeUnit attribute.
	*
	* No description available in the XSD standard.
	*
	* \return The value of the attribute
	*/
	UnitsLength_TypePtr getApertureSizeUnit() const;

	/*!
	* \brief Resets the ApertureSizeUnit attribute to an unset state.
	*
	* No description available in the XSD standard.
	*/
	void resetApertureSizeUnit();

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

	/*!
	* \brief Sets the value of the ApertureNr_ attribute.
	*
	* This field captures the Number of individual apertures present in this Spatial Mask.
	*
	* \param value The value to set
	* \param validate If true, validates constraints on value. Default is true.
	*/
	void setApertureNr_(const int& value, bool validate = true);

	/*!
	* \brief Returns the value of the ApertureNr_ attribute.
	*
	* This field captures the Number of individual apertures present in this Spatial Mask.
	*
	* \return The value of the attribute
	*/
	int getApertureNr_() const;

	/*!
	* \brief Resets the ApertureNr_ attribute to an unset state.
	*
	* This field captures the Number of individual apertures present in this Spatial Mask.
	*/
	void resetApertureNr_();

	/*!
	* \brief Checks whether the ApertureNr_ attribute is present.
	*
	* This field captures the Number of individual apertures present in this Spatial Mask.
	*
	* \return true if the attribute has been set, false otherwise
	*/
	bool hasApertureNr_() const;

	/*!
	* \brief Sets the value of the ApertureShape attribute.
	*
	* This field captures the Shape of individual apertures present in this Spatial Mask.
	*
	* \param value The value to set
	* \param validate If true, validates constraints on value. Default is true.
	*/
	void setApertureShape(const std::string& value, bool validate = true);

	/*!
	* \brief Returns the value of the ApertureShape attribute.
	*
	* This field captures the Shape of individual apertures present in this Spatial Mask.
	*
	* \return The value of the attribute
	*/
	std::string getApertureShape() const;

	/*!
	* \brief Resets the ApertureShape attribute to an unset state.
	*
	* This field captures the Shape of individual apertures present in this Spatial Mask.
	*/
	void resetApertureShape();

	/*!
	* \brief Checks whether the ApertureShape attribute is present.
	*
	* This field captures the Shape of individual apertures present in this Spatial Mask.
	*
	* \return true if the attribute has been set, false otherwise
	*/
	bool hasApertureShape() const;

	/*!
	* \brief Returns the allowed values for this attribut.
	*
	* This field captures the Shape of individual apertures present in this Spatial Mask.
	*
	* \return The list of allowed values
	*/
	static const std::set<std::string>& getApertureShapeAllowedValues();

	/*!
	* \brief Sets the value of the Material attribute.
	*
	* This field captures the Material with which this Spatial Mask is constructed.
	*
	* \param value The value to set
	* \param validate If true, validates constraints on value. Default is true.
	*/
	void setMaterial(const std::string& value, bool validate = true);

	/*!
	* \brief Returns the value of the Material attribute.
	*
	* This field captures the Material with which this Spatial Mask is constructed.
	*
	* \return The value of the attribute
	*/
	std::string getMaterial() const;

	/*!
	* \brief Resets the Material attribute to an unset state.
	*
	* This field captures the Material with which this Spatial Mask is constructed.
	*/
	void resetMaterial();

	/*!
	* \brief Checks whether the Material attribute is present.
	*
	* This field captures the Material with which this Spatial Mask is constructed.
	*
	* \return true if the attribute has been set, false otherwise
	*/
	bool hasMaterial() const;

	/*!
	* \brief Returns the allowed values for this attribut.
	*
	* This field captures the Material with which this Spatial Mask is constructed.
	*
	* \return The list of allowed values
	*/
	static const std::set<std::string>& getMaterialAllowedValues();


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

	MaskingPlateFunction_TypePtr Function = nullptr; // Required attribute
    std::optional<bool> Excitation; // Required attribute
    std::optional<float> ApertureSize; // Required attribute
	UnitsLength_TypePtr ApertureSizeUnit = nullptr; // Optional attribute
    std::optional<int> ApertureNr_; // Required attribute
    std::optional<std::string> ApertureShape; // Optional attribute
    static const std::set<std::string> ApertureShapeAllowedValues;
    std::optional<std::string> Material; // Optional attribute
    static const std::set<std::string> MaterialAllowedValues;
};

/*! Shared pointer for MaskingPlate*/
typedef std::shared_ptr<MaskingPlate> MaskingPlatePtr;

} // namespace Inscoper::NBO

#endif // MASKINGPLATE_HPP_INCLUDED