#ifndef STAGELABEL_HPP_INCLUDED
#define STAGELABEL_HPP_INCLUDED

#include <iostream>
#include <memory>
#include <optional>
#include <set>
#include <string>
#include <vector>
#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 StageLabel.
*
* The StageLabel is used to specify the Name and Position for a Stage position in the Microscope's reference frame.
*/
class NBO_EXPORT StageLabel : public NBOBaseClass {

public:
	
	StageLabel();
	~StageLabel();

	/*!
	* \brief Cast a NBOBaseClass to a StageLabel.
	*
	* \param base The base class to cast
	* \return The casted element, or nullptr if the cast fails
	*/
	static std::shared_ptr<StageLabel> 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 Name attribute.
	*
	* A User-defined Name for this Stage Label.
	*
	* \param value The value to set
	* \param validate If true, validates constraints on value. Default is true.
	*/
	void setName(const std::string& value, bool validate = true);

	/*!
	* \brief Returns the value of the Name attribute.
	*
	* A User-defined Name for this Stage Label.
	*
	* \return The value of the attribute
	*/
	std::string getName() const;

	/*!
	* \brief Resets the Name attribute to an unset state.
	*
	* A User-defined Name for this Stage Label.
	*/
	void resetName();

	/*!
	* \brief Checks whether the Name attribute is present.
	*
	* A User-defined Name for this Stage Label.
	*
	* \return true if the attribute has been set, false otherwise
	*/
	bool hasName() const;

	/*!
	* \brief Returns the allowed values for this attribut.
	*
	* A User-defined Name for this Stage Label.
	*
	* \return The list of allowed values
	*/
	static const std::set<std::string>& getNameAllowedValues();

	/*!
	* \brief Sets the value of the X attribute.
	*
	* The X position of this StageLabel.
	*
	* \param value The value to set
	* \param validate If true, validates constraints on value. Default is true.
	*/
	void setX(const float& value, bool validate = true);

	/*!
	* \brief Returns the value of the X attribute.
	*
	* The X position of this StageLabel.
	*
	* \return The value of the attribute
	*/
	float getX() const;

	/*!
	* \brief Resets the X attribute to an unset state.
	*
	* The X position of this StageLabel.
	*/
	void resetX();

	/*!
	* \brief Checks whether the X attribute is present.
	*
	* The X position of this StageLabel.
	*
	* \return true if the attribute has been set, false otherwise
	*/
	bool hasX() const;

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

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

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

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

	/*!
	* \brief Sets the value of the Y attribute.
	*
	* The Y position of this StageLabel.
	*
	* \param value The value to set
	* \param validate If true, validates constraints on value. Default is true.
	*/
	void setY(const float& value, bool validate = true);

	/*!
	* \brief Returns the value of the Y attribute.
	*
	* The Y position of this StageLabel.
	*
	* \return The value of the attribute
	*/
	float getY() const;

	/*!
	* \brief Resets the Y attribute to an unset state.
	*
	* The Y position of this StageLabel.
	*/
	void resetY();

	/*!
	* \brief Checks whether the Y attribute is present.
	*
	* The Y position of this StageLabel.
	*
	* \return true if the attribute has been set, false otherwise
	*/
	bool hasY() const;

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

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

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

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

	/*!
	* \brief Sets the value of the Z attribute.
	*
	* The Z position of this StageLabel.
	*
	* \param value The value to set
	* \param validate If true, validates constraints on value. Default is true.
	*/
	void setZ(const float& value, bool validate = true);

	/*!
	* \brief Returns the value of the Z attribute.
	*
	* The Z position of this StageLabel.
	*
	* \return The value of the attribute
	*/
	float getZ() const;

	/*!
	* \brief Resets the Z attribute to an unset state.
	*
	* The Z position of this StageLabel.
	*/
	void resetZ();

	/*!
	* \brief Checks whether the Z attribute is present.
	*
	* The Z position of this StageLabel.
	*
	* \return true if the attribute has been set, false otherwise
	*/
	bool hasZ() const;

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

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

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

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


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

    std::optional<std::string> Name; // Required attribute
    static const std::set<std::string> NameAllowedValues;
    std::optional<float> X; // Optional attribute
	UnitsLength_TypePtr XUnits = nullptr; // Optional attribute
    std::optional<float> Y; // Optional attribute
	UnitsLength_TypePtr YUnits = nullptr; // Optional attribute
    std::optional<float> Z; // Optional attribute
	UnitsLength_TypePtr ZUnits = nullptr; // Optional attribute
};

/*! Shared pointer for StageLabel*/
typedef std::shared_ptr<StageLabel> StageLabelPtr;

} // namespace Inscoper::NBO

#endif // STAGELABEL_HPP_INCLUDED