#ifndef CELLTYPE_TYPE_HPP_INCLUDED
#define CELLTYPE_TYPE_HPP_INCLUDED

#include <iostream>
#include <memory>
#include <optional>
#include <set>
#include <string>
#include <vector>
#include <NBO/NBO/PositiveInt_Type.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 cellType.
*
* The index of this Cell.
*/
class NBO_EXPORT cellType_Type : public NBOBaseClass {

public:
	
	cellType_Type();
	~cellType_Type();

	/*!
	* \brief Cast a NBOBaseClass to a cellType_Type.
	*
	* \param base The base class to cast
	* \return The casted element, or nullptr if the cast fails
	*/
	static std::shared_ptr<cellType_Type> 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 CellNr attribute.
	*
	* The index of this Cell.
	*
	* \param value The value to set
	* \param validate If true, validates constraints on value. Default is true.
	*/
	void setCellNr(const Inscoper::NBO::PositiveInt_TypePtr& value, bool validate = true);

	/*!
	* \brief Returns the value of the CellNr attribute.
	*
	* The index of this Cell.
	*
	* \return The value of the attribute
	*/
	PositiveInt_TypePtr getCellNr() const;

	/*!
	* \brief Resets the CellNr attribute to an unset state.
	*
	* The index of this Cell.
	*/
	void resetCellNr();

	/*!
	* \brief Checks whether the optional CellNr attribute is present.
	*
	* The index of this Cell.
	*
	* \return true if the optional attribute has been set, false otherwise
	*/
	bool hasCellNr() const;

	/*!
	* \brief Sets the value of the CellValue attribute.
	*
	* The Value of the metric contained in this Cell.
	*
	* \param value The value to set
	* \param validate If true, validates constraints on value. Default is true.
	*/
	void setCellValue(const float& value, bool validate = true);

	/*!
	* \brief Returns the value of the CellValue attribute.
	*
	* The Value of the metric contained in this Cell.
	*
	* \return The value of the attribute
	*/
	float getCellValue() const;

	/*!
	* \brief Resets the CellValue attribute to an unset state.
	*
	* The Value of the metric contained in this Cell.
	*/
	void resetCellValue();

	/*!
	* \brief Checks whether the CellValue attribute is present.
	*
	* The Value of the metric contained in this Cell.
	*
	* \return true if the attribute has been set, false otherwise
	*/
	bool hasCellValue() const;

	/*!
	* \brief Sets the value of the CellValueUnit 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 setCellValueUnit(const std::string& value, bool validate = true);

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

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

	/*!
	* \brief Checks whether the CellValueUnit attribute is present.
	*
	* No description available in the XSD standard.
	*
	* \return true if the attribute has been set, false otherwise
	*/
	bool hasCellValueUnit() 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>& getCellValueUnitAllowedValues();


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

	PositiveInt_TypePtr CellNr = nullptr; // Required attribute
    std::optional<float> CellValue; // Required attribute
    std::optional<std::string> CellValueUnit; // Optional attribute
    static const std::set<std::string> CellValueUnitAllowedValues;
};

/*! Shared pointer for cellType_Type*/
typedef std::shared_ptr<cellType_Type> cellType_TypePtr;

} // namespace Inscoper::NBO

#endif // CELLTYPE_TYPE_HPP_INCLUDED