// OperationsTime.h: interface for the COperationsTime class.
//
//////////////////////////////////////////////////////////////////////

#pragma once

#include "Uptime.h"
#include "Downtime.h"

#include "DllDefines.h"

class MCCTRDLLCLASS COperationsTime
{
public:
    //  default constructor
    COperationsTime();

    //  default destructor
    virtual ~COperationsTime();

    //  read all equipment substate time span from file
    void ReadTimeSpanFromFile();

    //  set uptime and downtime equipment state
    void SetEquipState(int iEvt, int iState);

    //  get total uptime and down equipment state
    LONGLONG GetTotalTime();

    //  get Uptime in counts
    LONGLONG GetUptime();

    //  get engineering time in counts
    LONGLONG GetEngineeringTime();

    //  get manufacturing time in counts
    LONGLONG GetManufacturingTime();

    //  get productive time in counts
    LONGLONG GetProductiveTime();

    //  get standby time in counts
    LONGLONG GetStandbyTime();

    //  get downtime in counts
    LONGLONG GetDowntime();

    //  get unscheduled downtime in counts
    LONGLONG GetUnscheduledDowntime();

    //  get scheduled downtime in counts
    LONGLONG GetScheduledDowntime();

    //  get equipment substate time
    LONGLONG GetEquipSubStateTime(int iEvt);

    //  save equipment substate time periodically to file
    void SaveTimeInfo();

    //  check is equipment Substate timer started
    bool IsTimerStarted(int iEvt);

private:
    CUptime m_uptime;     // uptime
    CDowntime m_downtime; // down time
};
