/**
 * \file    Mimic_Category.cpp
 * \author  Silvan Murer
 * \date    13 October 2022
 *
 * \brief   Category class of genSDK GF implementation, based on Mimic_Node
 */

#include "features/Mimic_Category.hpp"

#include "features/Mimic_Boolean.hpp"
#include "features/Mimic_Category.hpp"
#include "features/Mimic_Command.hpp"
#include "features/Mimic_Enumeration.hpp"
#include "features/Mimic_Float.hpp"
#include "features/Mimic_Integer.hpp"
#include "features/Mimic_String.hpp"

#include "H_NodeMap.hpp"

#include "Mimic_Exception.hpp"

#define GENICAM_NO_AUTO_IMPLIB
#include "GenICam.h"

#include "spdlog/spdlog.h"
#ifdef _WIN32
#include "spdlog/sinks/msvc_sink.h"
#else
#include "spdlog/sinks/stdout_color_sinks.h"
#endif

using namespace GenApi;

namespace mimic {

Mimic_Category::Mimic_Category() : Mimic_Node() {
	type = Type_e::CATEGORY;
};
Mimic_Category::Mimic_Category(INode* node) : Mimic_Node(node) { 
	type = Type_e::CATEGORY;
};
Mimic_Category::~Mimic_Category() { };

std::variant<int64_t, double, bool, std::string> Mimic_Category::getVariant(std::string name)
{
    throw Mimic_Access_Exception(std::string("Category node ") + node->GetName().c_str() + " is not readable!", -660);
};
void Mimic_Category::setVariant(std::string name, std::variant<int64_t, double, bool, std::string> value)
{
	throw Mimic_Access_Exception(std::string("Category node ") + node->GetName().c_str() + " is not writable!", -660);
}

std::vector<std::shared_ptr<Mimic_Node>> Mimic_Category::getFeatures()
{
	std::vector<std::shared_ptr<Mimic_Node>> gfNodeList = std::vector<std::shared_ptr<Mimic_Node>>();
	FeatureList_t featureList;
	dynamic_cast<ICategory*>(node)->GetFeatures(featureList);
	for (auto feature : featureList) {
		gfNodeList.push_back(H_NodeMap::createGFNodePtr(feature->GetNode()));
	}
	return gfNodeList;
}

} /* namespace genSDK */
