#ifndef EXPERIMENTERGROUP_HPP_INCLUDED
#define EXPERIMENTERGROUP_HPP_INCLUDED

#include <iostream>
#include <memory>
#include <optional>
#include <set>
#include <string>
#include <vector>
#include <NBO/NBO/AnnotationRef.h>
#include <NBO/NBO/ExperimenterGroupID_Type.h>
#include <NBO/NBO/ExperimenterRef.h>
#include <NBO/NBO/Leader.h>
#include <NBO/NBO/ENBOType.h>
#include <NBO/NBOGlobal.h>
#include <NBO/Shared/Base/NBOBaseClass.h>


namespace Inscoper::NBO {

/*!
* \brief Represents the XML element ExperimenterGroup.
*
* The ExperimenterGroupID is required. Information should ideally be specified for at least one Leader as a contact for the group. The Leaders are themselves Experimenters.
*/
class NBO_EXPORT ExperimenterGroup : public NBOBaseClass {

public:
	/*!
	* \brief Represents the XML element Description.
	*
	* No description available in the XSD standard.
	*/
	class NBO_EXPORT InlineDescription : public NBOBaseClass {
	
	public:
		
		InlineDescription();
		~InlineDescription();
	
		/*!
		* \brief Cast a NBOBaseClass to a InlineDescription.
		*
		* \param base The base class to cast
		* \return The casted element, or nullptr if the cast fails
		*/
		static std::shared_ptr<InlineDescription> 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 Assigns a new value to this object (= operator operator).
		*
		* \param v The value to set
		*/
		InlineDescription& operator=(const std::string& v);
	
		/*!
		* \brief Returns the value of this object  (generic conversion operator overload).
		*
		* \return The value of the object
		*/
		operator std::string() const;
	
		/*!
		* \brief Assigns a new value to this object.
		*
		* \param v The value to set
		* \param validate If true, validates constraints on value. Default is true.
		*/
		void set(const std::string& v, bool validate = true);
	
		/*!
		* \brief Returns the value of this object.
		*
		* \return The value of the object
		*/
		std::string get() const;
	
		/*!
		* \brief Returns the allowed values for this object.
		*
		* \return The list of allowed values
		*/
		static const std::set<std::string>& getAllowedValues();
	
		/*!
		* \brief Returns the pattern for this object.
		*
		* \return The pattern
		*/
		static const std::string& getPattern();
	
	private:
		std::string value;
	
		static const std::set<std::string> allowedValues;
		static const std::string validationPattern;
		friend std::ostream& operator<<(std::ostream& os, const InlineDescription& u);
	
	
	private:
		class Impl;
		std::unique_ptr<Impl> pImpl;
	};
	
	/*! Shared pointer for InlineDescription*/
	typedef std::shared_ptr<InlineDescription> InlineDescriptionPtr;
	
	
	ExperimenterGroup();
	~ExperimenterGroup();

	/*!
	* \brief Cast a NBOBaseClass to a ExperimenterGroup.
	*
	* \param base The base class to cast
	* \return The casted element, or nullptr if the cast fails
	*/
	static std::shared_ptr<ExperimenterGroup> 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.
	*
	* 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 setName(const std::string& value, bool validate = true);

	/*!
	* \brief Returns the value of the Name attribute.
	*
	* No description available in the XSD standard.
	*
	* \return The value of the attribute
	*/
	std::string getName() const;

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

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

	/*!
	* \brief Returns the allowed values for this attribut.
	*
	* No description available in the XSD standard.
	*
	* \return The list of allowed values
	*/
	static const std::set<std::string>& getNameAllowedValues();

	/*!
	* \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::ExperimenterGroupID_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
	*/
	ExperimenterGroupID_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;

	/*!
	* \brief Sets the value of the Description element.
	*
	* A description for the group. [plain-text multi-line string] 
	*
	* \param value The value to set
	* \param validate If true, validates constraints on value. Default is true.
	*/
	void setDescription(const Inscoper::NBO::ExperimenterGroup::InlineDescriptionPtr& value, bool validate = true);

	/*!
	* \brief Returns the value of the Description element.
	*
	* A description for the group. [plain-text multi-line string] 
	*
	* \return The value of the element
	*/
	Inscoper::NBO::ExperimenterGroup::InlineDescriptionPtr getDescription() const;

	/*!
	* \brief Resets the Description element to an unset state.
	*
	* A description for the group. [plain-text multi-line string] 
	*/
	void resetDescription();

	/*!
	* \brief Checks whether the optional Description element is present.
	*
	* A description for the group. [plain-text multi-line string] 
	*
	* \return true if the optional attribute has been set, false otherwise
	*/
	bool hasDescription() const;

	/*!
	* \brief Sets the list of ExperimenterRef elements.
	*
	* No description available in the XSD standard.
	*
	* \param value The new list of ExperimenterRef elements
	* \param validate If true, validates constraints on value. Default is true.
	*/
	void setExperimenterRef_List(const std::vector<Inscoper::NBO::ExperimenterRefPtr>& value, bool validate = true);

	/*!
	* \brief Returns the list of ExperimenterRef elements.
	*
	* No description available in the XSD standard.
	*
	* \return The list of ExperimenterRef elements
	*/
	std::vector<Inscoper::NBO::ExperimenterRefPtr> getExperimenterRef_List() const;

	/*!
	* \brief Adds a new ExperimenterRef element to this object.
	*
	* No description available in the XSD standard.
	*
	* \param value The element to add
	* \param validate If true, validates constraints on value. Default is true.
	*/
	void addToExperimenterRef_List(const Inscoper::NBO::ExperimenterRefPtr& value, bool validate = true);

	/*!
	* \brief Clear the list of ExperimenterRef.
	*
	* No description available in the XSD standard.
	*/
	void clearExperimenterRef_List();

	/*!
	* \brief Sets the list of Leader elements.
	*
	* No description available in the XSD standard.
	*
	* \param value The new list of Leader elements
	* \param validate If true, validates constraints on value. Default is true.
	*/
	void setLeader_List(const std::vector<Inscoper::NBO::LeaderPtr>& value, bool validate = true);

	/*!
	* \brief Returns the list of Leader elements.
	*
	* No description available in the XSD standard.
	*
	* \return The list of Leader elements
	*/
	std::vector<Inscoper::NBO::LeaderPtr> getLeader_List() const;

	/*!
	* \brief Adds a new Leader element to this object.
	*
	* No description available in the XSD standard.
	*
	* \param value The element to add
	* \param validate If true, validates constraints on value. Default is true.
	*/
	void addToLeader_List(const Inscoper::NBO::LeaderPtr& value, bool validate = true);

	/*!
	* \brief Clear the list of Leader.
	*
	* No description available in the XSD standard.
	*/
	void clearLeader_List();

	/*!
	* \brief Sets the list of AnnotationRef elements.
	*
	* No description available in the XSD standard.
	*
	* \param value The new list of AnnotationRef elements
	* \param validate If true, validates constraints on value. Default is true.
	*/
	void setAnnotationRef_List(const std::vector<Inscoper::NBO::AnnotationRefPtr>& value, bool validate = true);

	/*!
	* \brief Returns the list of AnnotationRef elements.
	*
	* No description available in the XSD standard.
	*
	* \return The list of AnnotationRef elements
	*/
	std::vector<Inscoper::NBO::AnnotationRefPtr> getAnnotationRef_List() const;

	/*!
	* \brief Adds a new AnnotationRef element to this object.
	*
	* No description available in the XSD standard.
	*
	* \param value The element to add
	* \param validate If true, validates constraints on value. Default is true.
	*/
	void addToAnnotationRef_List(const Inscoper::NBO::AnnotationRefPtr& value, bool validate = true);

	/*!
	* \brief Clear the list of AnnotationRef.
	*
	* No description available in the XSD standard.
	*/
	void clearAnnotationRef_List();


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

    std::optional<std::string> Name; // Optional attribute
    static const std::set<std::string> NameAllowedValues;
	ExperimenterGroupID_TypePtr ID = nullptr; // Required attribute
    Inscoper::NBO::ExperimenterGroup::InlineDescriptionPtr Description = nullptr;
    std::vector<Inscoper::NBO::ExperimenterRefPtr> ExperimenterRef_List;
    std::vector<Inscoper::NBO::LeaderPtr> Leader_List;
    std::vector<Inscoper::NBO::AnnotationRefPtr> AnnotationRef_List;
};

/*! Shared pointer for ExperimenterGroup*/
typedef std::shared_ptr<ExperimenterGroup> ExperimenterGroupPtr;

} // namespace Inscoper::NBO

#endif // EXPERIMENTERGROUP_HPP_INCLUDED