// Downtime.h: interface for the CDowntime class.
//
//////////////////////////////////////////////////////////////////////
#pragma once

#include "UnscheduledDowntime.h"
#include "ScheduledDowntime.h"

class CDowntime
{
public:
    //  default constructor
    CDowntime();

    //  default destructor
    virtual ~CDowntime();

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

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

    //  set unscheduled and scheduled equipment state
    void SetEquipState(int iEvt, int iState);

    //  get total unscheduled and scheduled equipment state time
    LONGLONG GetTotalTime();

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

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

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

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

private:
    CUnscheduledDowntime m_unscheduledDowntime; // unscheduled downtime
    CScheduledDowntime m_scheduledDowntime;     // scheduled downtime
};
