#pragma once

#include <string>
#include <vector>

#include "nlohmann/json.hpp"

using stMotorPositionValue = struct _stMotorPositionValue
{
	int MotorPositionValueId;
	int PackageInfoId;
	std::string ModuleName;
	std::string MotorName;
	std::string PositionName;
	double CalculatedValue;
	double OffsetValue;
	double SpeedCutOffValue;

	NLOHMANN_DEFINE_TYPE_INTRUSIVE(_stMotorPositionValue, MotorPositionValueId, ModuleName, MotorName, PositionName, CalculatedValue, OffsetValue, SpeedCutOffValue)

};

using stModuleMotor = struct _stModuleMotor {
	std::string ModuleName;
	std::vector<stMotorPositionValue> MotorPositionValues;

	NLOHMANN_DEFINE_TYPE_INTRUSIVE(_stModuleMotor, ModuleName, MotorPositionValues)

};

using stRuntimeMotorPosition = struct _stRuntimeMotorPosition
{
	std::string PackageName;
	std::vector<stModuleMotor> Modules;

	NLOHMANN_DEFINE_TYPE_INTRUSIVE(_stRuntimeMotorPosition, PackageName, Modules)

};

class CMotorPositionParser
{
public:
	bool Deserialize(const std::string& strFileName, stRuntimeMotorPosition& myOption);
	bool Serialize(const std::string& strFilename, const stRuntimeMotorPosition& _myOption);
};

