#ifndef __IKONKE_ENDPOINT_CONFIG_H___
#define __IKONKE_ENDPOINT_CONFIG_H___

#include "types.h"
/**
 *  @brief Defined for basic cluster attributes
 */

#define 	SUPPORT_MAX_EP					6

#define 	Support_Endpoint_Array			{1 ,2 ,3 ,4 }
#define 	Support_Endpoint_Num			4
// Array of profile ids
#define 	FIXED_PROFILE_IDS 				{ 260, 260, 260, 260 }

// Array of device ids
#define 	FIXED_DEVICE_IDS 				{ HA_DEV_ONOFF_LIGHT_SWITCH, HA_DEV_ONOFF_LIGHT_SWITCH, HA_DEV_ONOFF_LIGHT_SWITCH, HA_DEV_ONOFF_LIGHT_SWITCH }


typedef struct{
	u8 	zclVersion;
	u8	appVersion;
	u8	stackVersion;
	u8	hwVersion;
	u8	manuName[24];
	u8	modelId[24];
	u8	swBuildId[24];
	u8	powerSource;
	u8	deviceEnable;
}zcl_basicAttr_t;

/**
 *  @brief Defined for identify cluster attributes
 */
typedef struct{
	u16	identifyTime;
}zcl_identifyAttr_t;

/**
 *  @brief Defined for group cluster attributes
 */
typedef struct{
	u8	nameSupport;
}zcl_groupAttr_t;

/**
 *  @brief Defined for scene cluster attributes
 */
typedef struct{
	u8	 sceneCount;
	u8	 currentScene;
	u8	 nameSupport;
	bool sceneValid;
	u16	 currentGroup;
}zcl_sceneAttr_t;

/**
 *  @brief Defined for on/off cluster attributes
 */
typedef struct{
	u16	 onTime;
	u16	 offWaitTime;
	u8	 startUpOnOff;
	bool onOff;
	bool globalSceneControl;
}zcl_onOffAttr_t;

/**
 *  @brief Defined for level cluster attributes
 */
typedef struct{
	u16	remainingTime;
	u8	curLevel;
	u8	startUpCurrentLevel;
}zcl_levelAttr_t;

/**
 *  @brief Defined for color control cluster attributes
 */
typedef struct{
	u8	colorMode;
	u8	options;
	u8	enhancedColorMode;
	u8	numOfPrimaries;
	u16 colorCapabilities;
#if COLOR_RGB_SUPPORT
	u8	currentHue;
	u8	currentSaturation;
	u8	colorLoopActive;
	u8	colorLoopDirection;
	u16	colorLoopTime;
	u16 colorLoopStartEnhancedHue;
	u16 colorLoopStoredEnhancedHue;
#elif COLOR_CCT_SUPPORT
	u16 colorTemperatureMireds;
	u16 colorTempPhysicalMinMireds;
	u16 colorTempPhysicalMaxMireds;
	u16 startUpColorTemperatureMireds;
#endif
}zcl_lightColorCtrlAttr_t;


extern const uint8_t fixedEndpoints[SUPPORT_MAX_EP] ;
extern const uint16_t fixedProfileIds[SUPPORT_MAX_EP];
extern const uint16_t fixedDeviceIds[SUPPORT_MAX_EP];
/* Attributes */
extern zcl_basicAttr_t g_zcl_basicAttrs;
extern zcl_identifyAttr_t g_zcl_identifyAttrs[];
extern zcl_groupAttr_t g_zcl_groupAttrs[];
extern zcl_sceneAttr_t g_zcl_sceneAttrs[];
extern zcl_onOffAttr_t g_zcl_onOffAttrs[];
#ifdef ZCL_LEVEL_CTRL
extern zcl_levelAttr_t g_zcl_levelAttrs;
extern zcl_lightColorCtrlAttr_t g_zcl_colorCtrlAttrs;
#define zcl_levelAttrGet(ep)		&g_zcl_levelAttrs
#define zcl_colorAttrGet(ep)		&g_zcl_colorCtrlAttrs
#endif

#define zcl_sceneAttrGet(ep)		&g_zcl_sceneAttrs[ep-1]
#define zcl_onoffAttrGet(ep)		&g_zcl_onOffAttrs[ep-1]

#define zcl_BasicAttrGet()			&g_zcl_basicAttrs

void 	SimpleDesc_Init(uint8_t endpint);
nv_sts_t zcl_onOffAttr_get(void);
nv_sts_t zcl_onOffAttr_save(void);
#endif

