#ifndef __MOTO_LIST_H__
#define __MOTO_LIST_H__

#include "lan_str_table.h"

#define MAINMENU_ICON_WIDTH_UNCHECK   100
#define MAINMENU_ICON_HEIGHT_UNCHECK  100
#define MAINMENU_ICON_WIDTH_CHECK     110
#define MAINMENU_ICON_HEIGHT_CHECK    110

#define ICON_RING_Y     30
#define ICON_RING_1_X   0
#define ICON_RING_2_X   105
#define ICON_RING_3_X   210

#define ICON_IMG_Y      35+40
#define ICON_IMG_1_X    5+20+20
#define ICON_IMG_2_X    110+30+20+20+10
#define ICON_IMG_3_X    215+60+20+20+20

#define COMMON_PER_PAGE_NUM			3
#define COMMON_PAGE_ITEM_NUM		3
#define LAST_PAGE_ITEM_NUM			1
#define WIN_SIZE_WIDTH_PCT			100
#define WIN_SIZE_HEIGHT_PCT			100
#define RADIUS_RECT					0

typedef enum _ENUM_MAINMENU_ITEM_ID_
{
    MAINMENU_ITEM_ID_THEME,
    MAINMENU_ITEM_ID_LIGHT,
    MAINMENU_ITEM_ID_BLUETOOTH,
    MAINMENU_ITEM_ID_OTHER,
    MAINMENU_ITEM_ID_INFORMATION,
    MAINMENU_ITEM_ID_PRESSURE,
    MAINMENU_ITEM_ID_FAULT_CODE,
    MAINMENU_ITEM_ID_THEME_SELECT,
    MAINMENU_ITEM_ID_THEME_BG,
    MAINMENU_ITEM_ID_OTHER_TIME,
    MAINMENU_ITEM_ID_OTHER_LANGUAGE,
    MAINMENU_ITEM_ID_OTHER_UINT,
//    MAINMENU_ITEM_ID_LIST_RETURN,
    MAINMENU_ITEM_ID_MAX,
} ENUM_MAINMENU_ITEM_ID;

typedef struct
{
    bool      flag;
    uint8_t  win_id;
    uint32_t  index;   //scroll y offset
}PAGE_HISTORY_RECORD_T;

#define HISTORY_WIN_LEVEL 5

typedef struct
{
    PAGE_HISTORY_RECORD_T page_record[HISTORY_WIN_LEVEL];
    uint8_t hu01_cur_page_record;
    uint8_t hu01_cur_btn_record;
    uint8_t intercom_page_record;
    uint8_t intercom_cur_btn_record;
    uint8_t ws01_cur_page_record;
    uint8_t ws01_cur_btn_record;
    ENUM_MAINMENU_ITEM_ID cur_checked_menu_item;
}Local_UiCommon_t;


typedef enum
{
    MAINMENU_ICON_ID_THEME,
    MAINMENU_ICON_ID_LIGHT,
    MAINMENU_ICON_ID_BLUETOOTH,
    MAINMENU_ICON_ID_OTHER,
    MAINMENU_ICON_ID_INFORMATION,
    MAINMENU_ICON_ID_PRESSURE,
    MAINMENU_ICON_ID_FAULT_CODE,
    MAINMENU_ICON_ID_RETURN,
    MAINMENU_ICON_ID_MAX,
} MAINMENU_ICON_ID_ENUM;

//typedef enum _ENUM_EQUIPMENT_ID_ {
//    EQUIPMENT_ID_THEME = 0,
//    EQUIPMENT_ID_LIGHT,
//    EQUIPMENT_ID_BLUETOOTH,
//    EQUIPMENT_ID_OTHER,
//    EQUIPMENT_ID_INFORMATION,
//    EQUIPMENT_ID_PRESSURE,
//    EQUIPMENT_ID_FAULT_CODE,
//    EQUIPMENT_ID_MAX,
//}ENUM_EQUIPMENT_ID;



typedef enum
{
    MAINMENU_TILE_ZERO = 0,
    MAINMENU_TILE_ONE,
    MAINMENU_TILE_TWO,
    MAINMENU_TILE_END,
}MAINMENU_TILE_T;

typedef struct
{
    lv_obj_t *window_obj;
    uint8_t col_id;
    uint8_t row_id;
    lv_dir_t dir;
    void (*Init)();

}mainmenu_tile_t;
//
//
//typedef struct _lv_equipment_list_t{
//    const ENUM_EQUIPMENT_ID equipment_id;
//    const LAN_STR_ID str;
//    bool selected;
//    bool is_display;
//}lv_equipment_list_t;

typedef struct _lv_mainmenu_icon_t
{
    ENUM_MAINMENU_ITEM_ID mainmenu_item_id;
    LAN_STR_ID str_id;
    MAINMENU_ICON_ID_ENUM mainmenu_icon_id;
    btn_event_func event_handler;
} lv_mainmenu_win_t;

// void init_tile_common(lv_obj_t *mainmenu_btn_win, uint8_t page_num, uint8_t cur_tile_item,char *list_title[]);
// void init_tile_common(lv_obj_t *mainmenu_btn_win, uint8_t page_num, uint8_t cur_tile_item,LAN_STR_ID list_str[]);
void init_tile_common(lv_obj_t *mainmenu_btn_win, uint32_t str_arr[], uint8_t page_num, uint8_t cur_tile_item);
static void key_event_handler(lv_event_t *e);
uint32_t mainmenu_item_process(uint32_t dis_item_arr[MAINMENU_TILE_END][COMMON_PER_PAGE_NUM],
                           uint32_t *page_num, uint32_t *last_item_pos);

void position_in_array(uint32_t res_arr[MAINMENU_TILE_END][COMMON_PER_PAGE_NUM], uint32_t res[2]);
//ENUM_MAINMENU_ITEM_ID get_mainmenu_item_id_by_strid(ENUM_RES_STR_ID str_id);

extern void theme_create();
extern void light_create();
extern void bluetooth_create();
extern void other_create();
extern void information_create();
extern void pressure_create();
extern void fault_code_create();
extern void demo_return();


#endif
