/****************************************************************************
 * This file is part of the project AqHome.
 * AqHome (c) by 2025 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 AQHOME_REACT_PRGRULE_H
#define AQHOME_REACT_PRGRULE_H


#include "aqhome-react/server.h"

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


typedef struct AQHREACT_PRGRULE AQHREACT_PRGRULE;
GWEN_LIST_FUNCTION_DEFS(AQHREACT_PRGRULE, AQHREACT_PrgRule)

AQHREACT_PRGRULE *AQHREACT_PrgRule_new(void);
void AQHREACT_PrgRule_free(AQHREACT_PRGRULE *prgRule);

double AQHREACT_PrgRule_GetValue(const AQHREACT_PRGRULE *prgRule);

int AQHREACT_PrgRule_Matches(const AQHREACT_PRGRULE *prgRule, int min, int hour, int dayOfMonth, int month, int dayOfWeek);

AQHREACT_PRGRULE *AQHREACT_PrgRule_List_FindMatchingRule(AQHREACT_PRGRULE_LIST *prgRuleList,
                                                         int min, int hour, int dayOfMonth, int month, int dayOfWeek);


AQHREACT_PRGRULE_LIST *AQHREACT_PrgRule_ReadRules(const char *s);


#endif

