#ifndef __KK_SCENE_H__
#define __KK_SCENE_H__

#include "kk_tsl_common.h"
#include "sqlite3.h"
#include "kk_log.h"

typedef struct kk_scene_action_detail{
    char deviceCode[DEVICE_CODE_MAXLEN];
	char propertyName[DEVICE_PROPERTY_NAME_MAX];
	char propertyValue[DEVICE_PROPERTY_VALUE_MAX];
	int epNum;
	int delay;
} kk_scene_action_detail_t;

typedef struct kk_scene_action_info_ex{
	kk_scene_action_detail_t info;
	struct kk_scene_action_info_ex * next;
} kk_scene_action_info_ex_t;

typedef struct kk_scene_action{
    char gwdeviceCode[DEVICE_CODE_MAXLEN];
	char sceneId[16];
	kk_scene_action_info_ex_t *actionInfo;
	struct kk_scene_action * next;
} kk_scene_action_t;


typedef struct {	
	char productCode[PRODUCT_CODE_MAXLEN];
	char deviceCode[DEVICE_CODE_MAXLEN];
	char fatherdeviceCode[DEVICE_CODE_MAXLEN];	
	char propertyName[32];
	char propertyValue[32];
} kk_scene_action_info_t;

typedef struct kk_action_list{	
	time_t starttime;
	kk_scene_action_info_t *action;
	struct kk_action_list *next;
} kk_scene_action_delay_t;

typedef struct kk_embedscene_list{	
	time_t starttime;	
	char  executeSceneId[32];
	struct kk_embedscene_list *next;
} kk_scene_embed_delay_t;


typedef struct kk_scene_timer_list{	
	time_t starttime;
	char sceneId[32];
	int repeatday;
	struct kk_scene_timer_list *next;
} kk_scene_timer_list_t;
typedef struct {
    void *mutex;
    sqlite3 *pDb;
	void *s_scene_thread;
} kk_scene_ctx_t;


int kk_scene_init(void);

#endif

