#pragma once

#include <vector>
#include "DllDefines.h"

#include <ado2.h>
#include <structure.h>

class MCCTRDLLCLASS CMachineStateRS
{
public:
    // Field/Param Data
    int m_MachineStateId{ 0 };
    std::string m_Module_Name{ "" };
    int m_LightConfig_RedLightId{ 0 };
    int m_LightConfig_AmberLightId{ 0 };
    int m_LightConfig_GreenLightId{ 0 };
    int m_LightConfig_BlueLightId{ 0 };
    int m_LightConfig_WhiteLightId{ 0 };
    int m_LightConfig_BuzzerSoundId{ 0 };
    //
    long m_LightConfig_LightFlashOnTimeMs{ 0 };
    long m_LightConfig_LightFlashOffTimeMs{ 0 };
    long m_LightConfig_BuzzerPulseOnTimeMs{ 0 };
    long m_LightConfig_BuzzerPulseOffTimeMs{ 0 };

public:
    ~CMachineStateRS();

    std::string GetDefaultDBName(); // Default database name
    std::string GetDefaultSQL();    // Default SQL for Recordset


    //  Close Recordset and close database
    void Close();

    int InitLight(std::vector<LIGHT_CONFIG>& vecLightConfig);

private:
    bool Open(std::string sqlQuery);
    void GetAllFieldsValue();

    CADODatabase m_db;
    CADORecordset m_rs;
};
