/*!
 * Event.h
 *
 * Copyright (c) 2016, NADAL Jean-Baptiste. All rights reserved.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 * MA 02110-1301 USA
 * 
 * @Author:  NADAL Jean-Baptiste
 * @Date: 19/05/2016
 *
 */

#ifndef _EVENT_H
#define _EVENT_H

/*------------------------------- INCLUDES ----------------------------------*/

#include <stdint.h>
#include <string>

#include <jsoncpp/json.h>

/*---------------------------------- Deps -----------------------------------*/

class Devices;

/*--------------------------------- CLASS ----------------------------------*/

class Event  {

public:
	Event (void);
	~Event (void);

	int load_from_json (Json::Value anElem);
	Json::Value to_json (void) const;

	int start (Devices *aDevices);
	int stop (Devices *aDevices);
	
	void dump (void);

	/* Getter */
	bool isActive (void) const;
	std::string getCapability (void) const;
	uint16_t getID (void) const;
	uint16_t getDeviceID (void) const;
	uint8_t getHour (void) const;
	uint8_t getMinute (void) const;
	uint16_t getRecurrence (void) const;
	uint16_t getDuration (void) const;
	std::string getAction (void) const;
	bool isInProgress (void) const;

	/* Setter */
	void  setInProgress (bool aState);

private:
	bool mActive;
	std::string mCapability;
	uint16_t mID;
	uint16_t mDeviceID;
	uint8_t mHour;
	uint8_t mMinute;
	uint16_t mRecurrence;
	uint16_t mDuration;
	std::string mAction;
	bool mInProgress;
};

#endif /* _EVENT_H */
