#ifndef STRUCTUREDANNOTATIONS_CHOICE_HPP_INCLUDED
#define STRUCTUREDANNOTATIONS_CHOICE_HPP_INCLUDED

#include <iostream>
#include <memory>
#include <optional>
#include <set>
#include <string>
#include <variant>
#include <vector>
#include <NBO/NBO/BooleanAnnotation.h>
#include <NBO/NBO/CommentAnnotation.h>
#include <NBO/NBO/DoubleAnnotation.h>
#include <NBO/NBO/FileAnnotation.h>
#include <NBO/NBO/ListAnnotation.h>
#include <NBO/NBO/LongAnnotation.h>
#include <NBO/NBO/MapAnnotation.h>
#include <NBO/NBO/TagAnnotation.h>
#include <NBO/NBO/TermAnnotation.h>
#include <NBO/NBO/TimestampAnnotation.h>
#include <NBO/NBO/XMLAnnotation.h>
#include <NBO/NBO/ENBOType.h>
#include <NBO/NBOGlobal.h>
#include <NBO/Shared/Base/NBOBaseClass.h>


namespace Inscoper::NBO {

/*!
* \brief Represents the XML choice in element StructuredAnnotations.
*/
class NBO_EXPORT StructuredAnnotations_Choice : public NBOBaseClass {

public:
	using StructuredAnnotations_Choice_Variant = std::variant<
		Inscoper::NBO::LongAnnotationPtr,
		Inscoper::NBO::TimestampAnnotationPtr,
		Inscoper::NBO::DoubleAnnotationPtr,
		Inscoper::NBO::TagAnnotationPtr,
		Inscoper::NBO::MapAnnotationPtr,
		Inscoper::NBO::TermAnnotationPtr,
		Inscoper::NBO::XMLAnnotationPtr,
		Inscoper::NBO::FileAnnotationPtr,
		Inscoper::NBO::BooleanAnnotationPtr,
		Inscoper::NBO::CommentAnnotationPtr,
		Inscoper::NBO::ListAnnotationPtr
	>;

	using StructuredAnnotations_Choice_VariantPtr = std::shared_ptr<StructuredAnnotations_Choice_Variant>;

	StructuredAnnotations_Choice();
	~StructuredAnnotations_Choice();

	/*!
	* \brief Cast a NBOBaseClass to a StructuredAnnotations_Choice.
	*
	* \param base The base class to cast
	* \return The casted element, or nullptr if the cast fails
	*/
	static std::shared_ptr<StructuredAnnotations_Choice> 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 Adds a new XMLAnnotation element to this object.
	*
	* \param value The element to add
	*/
	void addXMLAnnotation(Inscoper::NBO::XMLAnnotationPtr value);

	/*!
	* \brief Checks whether this object contains at least one XMLAnnotation element.
	*
	* \return true if a XMLAnnotation element is present, false otherwise
	*/
	bool containsXMLAnnotation() const;

	/*!
	* \brief Adds a new FileAnnotation element to this object.
	*
	* \param value The element to add
	*/
	void addFileAnnotation(Inscoper::NBO::FileAnnotationPtr value);

	/*!
	* \brief Checks whether this object contains at least one FileAnnotation element.
	*
	* \return true if a FileAnnotation element is present, false otherwise
	*/
	bool containsFileAnnotation() const;

	/*!
	* \brief Adds a new ListAnnotation element to this object.
	*
	* \param value The element to add
	*/
	void addListAnnotation(Inscoper::NBO::ListAnnotationPtr value);

	/*!
	* \brief Checks whether this object contains at least one ListAnnotation element.
	*
	* \return true if a ListAnnotation element is present, false otherwise
	*/
	bool containsListAnnotation() const;

	/*!
	* \brief Adds a new LongAnnotation element to this object.
	*
	* \param value The element to add
	*/
	void addLongAnnotation(Inscoper::NBO::LongAnnotationPtr value);

	/*!
	* \brief Checks whether this object contains at least one LongAnnotation element.
	*
	* \return true if a LongAnnotation element is present, false otherwise
	*/
	bool containsLongAnnotation() const;

	/*!
	* \brief Adds a new DoubleAnnotation element to this object.
	*
	* \param value The element to add
	*/
	void addDoubleAnnotation(Inscoper::NBO::DoubleAnnotationPtr value);

	/*!
	* \brief Checks whether this object contains at least one DoubleAnnotation element.
	*
	* \return true if a DoubleAnnotation element is present, false otherwise
	*/
	bool containsDoubleAnnotation() const;

	/*!
	* \brief Adds a new CommentAnnotation element to this object.
	*
	* \param value The element to add
	*/
	void addCommentAnnotation(Inscoper::NBO::CommentAnnotationPtr value);

	/*!
	* \brief Checks whether this object contains at least one CommentAnnotation element.
	*
	* \return true if a CommentAnnotation element is present, false otherwise
	*/
	bool containsCommentAnnotation() const;

	/*!
	* \brief Adds a new BooleanAnnotation element to this object.
	*
	* \param value The element to add
	*/
	void addBooleanAnnotation(Inscoper::NBO::BooleanAnnotationPtr value);

	/*!
	* \brief Checks whether this object contains at least one BooleanAnnotation element.
	*
	* \return true if a BooleanAnnotation element is present, false otherwise
	*/
	bool containsBooleanAnnotation() const;

	/*!
	* \brief Adds a new TimestampAnnotation element to this object.
	*
	* \param value The element to add
	*/
	void addTimestampAnnotation(Inscoper::NBO::TimestampAnnotationPtr value);

	/*!
	* \brief Checks whether this object contains at least one TimestampAnnotation element.
	*
	* \return true if a TimestampAnnotation element is present, false otherwise
	*/
	bool containsTimestampAnnotation() const;

	/*!
	* \brief Adds a new TagAnnotation element to this object.
	*
	* \param value The element to add
	*/
	void addTagAnnotation(Inscoper::NBO::TagAnnotationPtr value);

	/*!
	* \brief Checks whether this object contains at least one TagAnnotation element.
	*
	* \return true if a TagAnnotation element is present, false otherwise
	*/
	bool containsTagAnnotation() const;

	/*!
	* \brief Adds a new TermAnnotation element to this object.
	*
	* \param value The element to add
	*/
	void addTermAnnotation(Inscoper::NBO::TermAnnotationPtr value);

	/*!
	* \brief Checks whether this object contains at least one TermAnnotation element.
	*
	* \return true if a TermAnnotation element is present, false otherwise
	*/
	bool containsTermAnnotation() const;

	/*!
	* \brief Adds a new MapAnnotation element to this object.
	*
	* \param value The element to add
	*/
	void addMapAnnotation(Inscoper::NBO::MapAnnotationPtr value);

	/*!
	* \brief Checks whether this object contains at least one MapAnnotation element.
	*
	* \return true if a MapAnnotation element is present, false otherwise
	*/
	bool containsMapAnnotation() const;



private:
	std::vector<StructuredAnnotations_Choice_VariantPtr> choice_List;

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

/*! Shared pointer for StructuredAnnotations_Choice*/
typedef std::shared_ptr<Inscoper::NBO::StructuredAnnotations_Choice> StructuredAnnotations_ChoicePtr;

} // namespace Inscoper::NBO

#endif // STRUCTUREDANNOTATIONS_CHOICE_HPP_INCLUDED