#pragma once

#include "Input.h"
#include "Output.h"
#include "Motor.h"

#include "nlohmann\json.hpp"

constexpr auto MAX_MODULE = 32;
constexpr auto MAX_MODULE_INPUT = 11;
constexpr auto MAX_MODULE_OUTPUT = 15;
constexpr auto MAX_MODULE_MOTOR = 16;

using stModule = struct _stModule
{
	_stModule()
	{
		for (auto& mtr : Motor) {
			mtr = nullptr;
		}
	}

	_stModule(const std::string& _strName) : strName(_strName)
	{
	}

	bool HasMotors()
	{
		return Motor.size() > 0;
	}

	std::string strName;

	std::vector<CInputSetting> Input;

	std::vector<COutputSetting> Output;

	std::vector<std::unique_ptr<CMtrProfile>> Motor{};

};

// input and output module data structure for Maintenance page
struct stMaintIoModule
{
	std::string m_strModuleName;                  // store module name
	std::vector<std::string> m_strIoName; // MAX_MODULE_INPUT]; // store input name
};

// for multilanguage motor name and motor position name
// for Maintenance page
struct stMaintMotorModule
{
	std::string m_strModuleName;              // store module name
	std::string m_strMtrName[MAX_MOTOR];      // store motor name
	std::vector<std::string> m_vecMtrPos[MAX_MOTOR]; // store Motor Position Name
};

// user change accordingly to suit the machine requirement
struct stLotInfo
{
	std::string strLotStarted;
	std::string strLotName;
	long lLotQty;
	std::string strShiftID;
	std::string strOperatorID;
	std::string strLotStartTime;
	std::string strRecipeName;
	std::string strPackageName;
};

struct stRecipeInfo
{
	std::string strRecipeName;
	std::string strPackageName;
};

struct stPackageInfo
{
	std::string strPackageName;
	int nPackageID;
};

// Light Config
using LIGHT_CONFIG = struct _LIGHT_CONFIG {
	int iMcState{ 0 };
	int iRed{ 1 };
	int iAmber{ 1 };
	int iGreen{ 1 };
	int iBlue{ 0 };
	int iWhite{ 0 };
	int iBuzzer{ 0 };
	int iLightOnTime{ 500 };
	int iLightOffTime{ 500 };
	int iBuzzerOnTime{ 500 };
	int iBuzzerOffTime{ 500 };

	NLOHMANN_DEFINE_TYPE_INTRUSIVE(_LIGHT_CONFIG, iMcState, iRed, iAmber, iGreen, iBlue, iWhite, iBuzzer, iLightOnTime, iLightOffTime, iBuzzerOnTime, iBuzzerOffTime)
};

