#ifndef CALIBRATIONSTANDARDSLIDE_HPP_INCLUDED
#define CALIBRATIONSTANDARDSLIDE_HPP_INCLUDED

#include <iostream>
#include <memory>
#include <optional>
#include <set>
#include <string>
#include <vector>
#include <NBO/NBO/CalibrationMeasure_Type.h>
#include <NBO/NBO/CalibrationSlideType_Type.h>
#include <NBO/NBO/OpticalCalibrationStandard_Type.h>
#include <NBO/NBO/Reference_Type.h>
#include <NBO/NBO/ImageID_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 CalibrationStandardSlide.
*
* This element describes a Standard Calibration Slide (also referred to as Standard Test Slide) used for assessing the Optical properties of the Microscope that was used to acquire this experimental Image. These Slides can be used to measure multiple different Optical properties including resolution, chromatic registration, magnification, distance, and different kinds of optical distorsions.
*/
class NBO_EXPORT CalibrationStandardSlide : public OpticalCalibrationStandard_Type {

public:
	/*!
	* \brief Represents the XML element PatternImageRef.
	*
	* This is an empty element that refers to an Image depcting the pattern etched on this Calibration Slide.
	*/
	class NBO_EXPORT InlinePatternImageRef : public Reference_Type {
	
	public:
		
		InlinePatternImageRef();
		~InlinePatternImageRef();
	
		/*!
		* \brief Cast a NBOBaseClass to a InlinePatternImageRef.
		*
		* \param base The base class to cast
		* \return The casted element, or nullptr if the cast fails
		*/
		static std::shared_ptr<InlinePatternImageRef> 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.
		*
		* 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 setID(const Inscoper::NBO::ImageID_TypePtr& value, bool validate = true);
	
		/*!
		* \brief Returns the value of the ID attribute.
		*
		* No description available in the XSD standard.
		*
		* \return The value of the attribute
		*/
		ImageID_TypePtr getID() const;
	
		/*!
		* \brief Resets the ID attribute to an unset state.
		*
		* No description available in the XSD standard.
		*/
		void resetID();
	
		/*!
		* \brief Checks whether the optional ID attribute is present.
		*
		* No description available in the XSD standard.
		*
		* \return true if the optional attribute has been set, false otherwise
		*/
		bool hasID() const;
	
	
	private:
		class Impl;
		std::unique_ptr<Impl> pImpl;
	
		ImageID_TypePtr ID = nullptr; // Optional attribute
	};
	
	/*! Shared pointer for InlinePatternImageRef*/
	typedef std::shared_ptr<InlinePatternImageRef> InlinePatternImageRefPtr;
	
	
	CalibrationStandardSlide();
	~CalibrationStandardSlide();

	/*!
	* \brief Cast a NBOBaseClass to a CalibrationStandardSlide.
	*
	* \param base The base class to cast
	* \return The casted element, or nullptr if the cast fails
	*/
	static std::shared_ptr<CalibrationStandardSlide> 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 Type attribute.
	*
	* The type of calibration slide used in this case. Examples include slides produced by Argolight, Geller MicroAnalytical Laboratory, PSFCheck, Zeiss and others.
	*
	* \param value The value to set
	* \param validate If true, validates constraints on value. Default is true.
	*/
	void setType(const Inscoper::NBO::CalibrationSlideType_TypePtr& value, bool validate = true);

	/*!
	* \brief Returns the value of the Type attribute.
	*
	* The type of calibration slide used in this case. Examples include slides produced by Argolight, Geller MicroAnalytical Laboratory, PSFCheck, Zeiss and others.
	*
	* \return The value of the attribute
	*/
	CalibrationSlideType_TypePtr getType() const;

	/*!
	* \brief Resets the Type attribute to an unset state.
	*
	* The type of calibration slide used in this case. Examples include slides produced by Argolight, Geller MicroAnalytical Laboratory, PSFCheck, Zeiss and others.
	*/
	void resetType();

	/*!
	* \brief Checks whether the optional Type attribute is present.
	*
	* The type of calibration slide used in this case. Examples include slides produced by Argolight, Geller MicroAnalytical Laboratory, PSFCheck, Zeiss and others.
	*
	* \return true if the optional attribute has been set, false otherwise
	*/
	bool hasType() const;

	/*!
	* \brief Sets the value of the CalibrationMeasure attribute.
	*
	* This field captures the Optical characteristic this Slide is intended to calibrate, examples include Co-registration Accuracy, Detector linearity, Distance, Magnification, Optical distorsion, Resolution, or Multi.
	*
	* \param value The value to set
	* \param validate If true, validates constraints on value. Default is true.
	*/
	void setCalibrationMeasure(const Inscoper::NBO::CalibrationMeasure_TypePtr& value, bool validate = true);

	/*!
	* \brief Returns the value of the CalibrationMeasure attribute.
	*
	* This field captures the Optical characteristic this Slide is intended to calibrate, examples include Co-registration Accuracy, Detector linearity, Distance, Magnification, Optical distorsion, Resolution, or Multi.
	*
	* \return The value of the attribute
	*/
	CalibrationMeasure_TypePtr getCalibrationMeasure() const;

	/*!
	* \brief Resets the CalibrationMeasure attribute to an unset state.
	*
	* This field captures the Optical characteristic this Slide is intended to calibrate, examples include Co-registration Accuracy, Detector linearity, Distance, Magnification, Optical distorsion, Resolution, or Multi.
	*/
	void resetCalibrationMeasure();

	/*!
	* \brief Checks whether the optional CalibrationMeasure attribute is present.
	*
	* This field captures the Optical characteristic this Slide is intended to calibrate, examples include Co-registration Accuracy, Detector linearity, Distance, Magnification, Optical distorsion, Resolution, or Multi.
	*
	* \return true if the optional attribute has been set, false otherwise
	*/
	bool hasCalibrationMeasure() const;

	/*!
	* \brief Sets the value of the ImagedArea attribute.
	*
	* This field describes the specific region or sets or regions of the Calibration Slide that have been used for this Optical Calibration procedure.
	*
	* \param value The value to set
	* \param validate If true, validates constraints on value. Default is true.
	*/
	void setImagedArea(const std::string& value, bool validate = true);

	/*!
	* \brief Returns the value of the ImagedArea attribute.
	*
	* This field describes the specific region or sets or regions of the Calibration Slide that have been used for this Optical Calibration procedure.
	*
	* \return The value of the attribute
	*/
	std::string getImagedArea() const;

	/*!
	* \brief Resets the ImagedArea attribute to an unset state.
	*
	* This field describes the specific region or sets or regions of the Calibration Slide that have been used for this Optical Calibration procedure.
	*/
	void resetImagedArea();

	/*!
	* \brief Checks whether the ImagedArea attribute is present.
	*
	* This field describes the specific region or sets or regions of the Calibration Slide that have been used for this Optical Calibration procedure.
	*
	* \return true if the attribute has been set, false otherwise
	*/
	bool hasImagedArea() const;

	/*!
	* \brief Returns the allowed values for this attribut.
	*
	* This field describes the specific region or sets or regions of the Calibration Slide that have been used for this Optical Calibration procedure.
	*
	* \return The list of allowed values
	*/
	static const std::set<std::string>& getImagedAreaAllowedValues();

	/*!
	* \brief Sets the value of the PatternImageRef element.
	*
	* This is an empty element that refers to an Image depcting the pattern etched on this Calibration Slide.
	*
	* \param value The value to set
	* \param validate If true, validates constraints on value. Default is true.
	*/
	void setPatternImageRef(const Inscoper::NBO::CalibrationStandardSlide::InlinePatternImageRefPtr& value, bool validate = true);

	/*!
	* \brief Returns the value of the PatternImageRef element.
	*
	* This is an empty element that refers to an Image depcting the pattern etched on this Calibration Slide.
	*
	* \return The value of the element
	*/
	Inscoper::NBO::CalibrationStandardSlide::InlinePatternImageRefPtr getPatternImageRef() const
;
	/*!
	* \brief Resets the PatternImageRef element to an unset state.
	*
	* This is an empty element that refers to an Image depcting the pattern etched on this Calibration Slide.
	*/
	void resetPatternImageRef();

	/*!
	* \brief Checks whether the optional PatternImageRef element is present.
	*
	* This is an empty element that refers to an Image depcting the pattern etched on this Calibration Slide.
	*
	* \return true if the optional attribute has been set, false otherwise
	*/
	bool hasPatternImageRef() const;


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

	CalibrationSlideType_TypePtr Type = nullptr; // Required attribute
	CalibrationMeasure_TypePtr CalibrationMeasure = nullptr; // Required attribute
    std::optional<std::string> ImagedArea; // Optional attribute
    static const std::set<std::string> ImagedAreaAllowedValues;
    Inscoper::NBO::CalibrationStandardSlide::InlinePatternImageRefPtr PatternImageRef = nullptr;
};

/*! Shared pointer for CalibrationStandardSlide*/
typedef std::shared_ptr<CalibrationStandardSlide> CalibrationStandardSlidePtr;

} // namespace Inscoper::NBO

#endif // CALIBRATIONSTANDARDSLIDE_HPP_INCLUDED