/****************************************************************************
 * This file is part of the project AqHome.
 * AqHome (c) by 2024 Martin Preuss, all rights reserved.
 *
 * The license for this file can be found in the file COPYING which you
 * should have received along with this file.
 ****************************************************************************/

#ifndef AQHOMEREACT_U_TIMEPROGRAM_P_H
#define AQHOMEREACT_U_TIMEPROGRAM_P_H


#include "./u_timeprogram.h"

#include "aqhome-react/types/unit.h"
#include "aqhome-react/types/prgrule.h"

#include <gwenhywfar/list.h>
#include <gwenhywfar/timestamp.h>

#include <time.h>




typedef struct MODULE_TIMER_ACTION MODULE_TIMER_ACTION;
typedef struct AQHREACT_UNIT_TIMEPROGRAM AQHREACT_UNIT_TIMEPROGRAM;

GWEN_LIST_FUNCTION_DEFS(MODULE_TIMER_ACTION, ModuleTimerAction)



struct MODULE_TIMER_ACTION {
  GWEN_LIST_ELEMENT(MODULE_TIMER_ACTION)

  int64_t triggerTime;
  double value;
};



struct AQHREACT_UNIT_TIMEPROGRAM {
  AQHREACT_PRGRULE_LIST *ruleList;
  MODULE_TIMER_ACTION_LIST *actionList;

  int lastActionHour;
  GWEN_TIMESTAMP *nextAddTime;
  time_t lastCheckTime;
  time_t lastCreateTime;

};


#endif


