#ifndef OPTICALASSEMBLY_TYPE_HPP_INCLUDED
#define OPTICALASSEMBLY_TYPE_HPP_INCLUDED

#include <iostream>
#include <memory>
#include <optional>
#include <set>
#include <string>
#include <vector>
#include <NBO/NBO/AnnotationRef.h>
#include <NBO/NBO/ApertureRef.h>
#include <NBO/NBO/Denomination_Type.h>
#include <NBO/NBO/FilterRef_Type.h>
#include <NBO/NBO/LSID_Type.h>
#include <NBO/NBO/LensRef.h>
#include <NBO/NBO/ManufacturerSpec_Type.h>
#include <NBO/NBO/MirroringDeviceRef.h>
#include <NBO/NBO/PolarizationOpticsRef.h>
#include <NBO/NBO/PrismRef.h>
#include <NBO/NBO/ENBOType.h>
#include <NBO/NBOGlobal.h>
#include <NBO/Shared/Base/NBOBaseClass.h>


namespace Inscoper::NBO {

/*!
* \brief Represents the XML complex type OpticalAssembly.
*
* This is a device that might include one or more Lenses, other Optics and Optics Holders. Optical Devices might be custom built or they might also be available as pre-assembled units. Such devices might be embedded within the Microscope Stand or exist as independent units. Examples include the Condenser and the Microscope Tube.
*/
class NBO_EXPORT OpticalAssembly_Type : public ManufacturerSpec_Type {

public:
	
	OpticalAssembly_Type();
	~OpticalAssembly_Type();

	/*!
	* \brief Cast a NBOBaseClass to a OpticalAssembly_Type.
	*
	* \param base The base class to cast
	* \return The casted element, or nullptr if the cast fails
	*/
	static std::shared_ptr<OpticalAssembly_Type> fromBase(NBOBaseClassPtr base);

	/*!
	* \brief Returns the class type name.
	*
	* \return The class type name
	*/
	virtual 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.
	*
	* A Unique Identifier for this component.
	*
	* \param value The value to set
	* \param validate If true, validates constraints on value. Default is true.
	*/
	void setID(const Inscoper::NBO::LSID_TypePtr& value, bool validate = true);

	/*!
	* \brief Returns the value of the ID attribute.
	*
	* A Unique Identifier for this component.
	*
	* \return The value of the attribute
	*/
	LSID_TypePtr getID() const;

	/*!
	* \brief Resets the ID attribute to an unset state.
	*
	* A Unique Identifier for this component.
	*/
	void resetID();

	/*!
	* \brief Checks whether the optional ID attribute is present.
	*
	* A Unique Identifier for this component.
	*
	* \return true if the optional attribute has been set, false otherwise
	*/
	bool hasID() const;

	/*!
	* \brief Sets the value of the Name attribute.
	*
	* A User-defined Name for this component.
	*
	* \param value The value to set
	* \param validate If true, validates constraints on value. Default is true.
	*/
	void setName(const Inscoper::NBO::Denomination_TypePtr& value, bool validate = true);

	/*!
	* \brief Returns the value of the Name attribute.
	*
	* A User-defined Name for this component.
	*
	* \return The value of the attribute
	*/
	Denomination_TypePtr getName() const;

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

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

	/*!
	* \brief Sets the list of FilterRef elements.
	*
	* This refers to an available Filter, which is part of this Optical Assembly.
	*
	* \param value The new list of FilterRef elements
	* \param validate If true, validates constraints on value. Default is true.
	*/
	void setFilterRef_List(const std::vector<Inscoper::NBO::FilterRef_TypePtr>& value, bool validate = true);

	/*!
	* \brief Returns the list of FilterRef elements.
	*
	* This refers to an available Filter, which is part of this Optical Assembly.
	*
	* \return The list of FilterRef elements
	*/
	std::vector<Inscoper::NBO::FilterRef_TypePtr> getFilterRef_List() const;

	/*!
	* \brief Adds a new FilterRef element to this object.
	*
	* This refers to an available Filter, which is part of this Optical Assembly.
	*
	* \param value The element to add
	* \param validate If true, validates constraints on value. Default is true.
	*/
	void addToFilterRef_List(const Inscoper::NBO::FilterRef_TypePtr& value, bool validate = true);

	/*!
	* \brief Clear the list of FilterRef.
	*
	* This refers to an available Filter, which is part of this Optical Assembly.
	*/
	void clearFilterRef_List();

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

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

	/*!
	* \brief Adds a new LensRef 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 addToLensRef_List(const Inscoper::NBO::LensRefPtr& value, bool validate = true);

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

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

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

	/*!
	* \brief Adds a new MirroringDeviceRef 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 addToMirroringDeviceRef_List(const Inscoper::NBO::MirroringDeviceRefPtr& value, bool validate = true);

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

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

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

	/*!
	* \brief Adds a new ApertureRef 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 addToApertureRef_List(const Inscoper::NBO::ApertureRefPtr& value, bool validate = true);

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

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

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

	/*!
	* \brief Adds a new PolarizationOpticsRef 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 addToPolarizationOpticsRef_List(const Inscoper::NBO::PolarizationOpticsRefPtr& value, bool validate = true);

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

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

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

	/*!
	* \brief Adds a new PrismRef 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 addToPrismRef_List(const Inscoper::NBO::PrismRefPtr& value, bool validate = true);

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

	/*!
	* \brief Sets the value of the AnnotationRef element.
	*
	* 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 setAnnotationRef(const Inscoper::NBO::AnnotationRefPtr& value, bool validate = true);

	/*!
	* \brief Returns the value of the AnnotationRef element.
	*
	* No description available in the XSD standard.
	*
	* \return The value of the element
	*/
	Inscoper::NBO::AnnotationRefPtr getAnnotationRef() const;

	/*!
	* \brief Resets the AnnotationRef element to an unset state.
	*
	* No description available in the XSD standard.
	*/
	void resetAnnotationRef();

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


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

	LSID_TypePtr ID = nullptr; // Required attribute
	Denomination_TypePtr Name = nullptr; // Optional attribute
    std::vector<Inscoper::NBO::FilterRef_TypePtr> FilterRef_List;
    std::vector<Inscoper::NBO::LensRefPtr> LensRef_List;
    std::vector<Inscoper::NBO::MirroringDeviceRefPtr> MirroringDeviceRef_List;
    std::vector<Inscoper::NBO::ApertureRefPtr> ApertureRef_List;
    std::vector<Inscoper::NBO::PolarizationOpticsRefPtr> PolarizationOpticsRef_List;
    std::vector<Inscoper::NBO::PrismRefPtr> PrismRef_List;
    Inscoper::NBO::AnnotationRefPtr AnnotationRef = nullptr;
};

/*! Shared pointer for OpticalAssembly_Type*/
typedef std::shared_ptr<OpticalAssembly_Type> OpticalAssembly_TypePtr;

} // namespace Inscoper::NBO

#endif // OPTICALASSEMBLY_TYPE_HPP_INCLUDED