#ifndef SKINS_H
#define SKINS_H
#ifdef __cplusplus
extern "C" {
#endif

#define MD5_STR_LEN          	(36)                        ///< 
#define MAX_KEY_NAME			(64)
#define MAX_KEY_PATH			(256)

#define SKIN_MODE_NAME			("ModuleSkin")
#define	RES_MODE_NAME			("ModuleRes")
#define RES_TBL_NAME        	"res"
#define SKIN_TBL_NAME			"skin"
#define SKIN_USER_DB            "user_db"

#define CREATE_SKIN_TBL_SQL      "CREATE TABLE IF NOT EXISTS %s"SKIN_TBL_NAME" ("  \
	"ID             INTEGER PRIMARY KEY AUTOINCREMENT," \
	"keyName        TEXT           NOT NULL," \
	"resType        INTEGER        NOT NULL," \
    "priority       INTEGER        NOT NULL," \
	"resID          INTEGER        NOT NULL," \
	"resReadme      TEXT           NOT NULL DEFAULT \'\');"

#define CREATE_RES_TBL_SQL      "CREATE TABLE IF NOT EXISTS %s"RES_TBL_NAME" ("  \
	"ID             INTEGER PRIMARY KEY AUTOINCREMENT," \
    "resVersion     TEXT           NOT NULL," \
	"localPath      TEXT           NOT NULL," \
	"serverURL      TEXT           NOT NULL," \
	"md5Chksum      TEXT           NOT NULL);"

typedef enum
{
	VOICE_RES		= 1,
	IMAGE_RES,
	TEXT_RES,
} SKINS_RES_TYPE;

typedef struct
{
	SKINS_RES_TYPE			resType;
	const char				*pResVer;
	const char				*pKeyName;
	const char				*pLocalPath;
	const char				*pMD5Chksum;
} SKIN_RES_INFO, *PSKIN_RES_INFO;

int SkinInit(void);
char* GetSkinsResource(char *pKeyName, int *pResType, int *pVersion, char **pComeFrom);
int SkinUpgrade(char *pUpdFilePath);
void SkinIsVerifyRes(int isVerify);
unsigned int SkinsDefaultSize(void);
PSKIN_RES_INFO SkinsItemById(int iId);

#ifdef __cplusplus
}
#endif                    
#endif
