/**
 * @file gadget_bridge.h
 * @author Anatole SCHRAMM-HENRY
 * @brief Header file exposing the API used to communicate/interact with the GadgetBridge Android application
 *        over BLE.
 * @version 0.1
 * @date 2023-04-04
 * 
 * @copyright MIT
 * 
 */

#ifndef GADGET_BRIDGE_H
#define GADGET_BRIDGE_H

#include "wm_type_def.h"

typedef enum gadget_bridge_toast_type
{
    GADGET_BRIDGE_TOAST_TYPE_INFO = 0,
    GADGET_BRIDGE_TOAST_TYPE_WARN,
    GADGET_BRIDGE_TOAST_TYPE_ERROR,
} gadget_bridge_toast_type_e;

typedef enum gadget_bridge_music_control
{
    GADGET_BRIDGE_MUSIC_CONTROL_PLAY = 0,
    GADGET_BRIDGE_MUSIC_CONTROL_PAUSE,
    GADGET_BRIDGE_MUSIC_CONTROL_PLAYPAUSE,
    GADGET_BRIDGE_MUSIC_CONTROL_NEXT,
    GADGET_BRIDGE_MUSIC_CONTROL_PREVIOUS,
    GADGET_BRIDGE_MUSIC_CONTROL_VOLUMEUP,
    GADGET_BRIDGE_MUSIC_CONTROL_VOLUMEDOWN,
    GADGET_BRIDGE_MUSIC_CONTROL_FORWARD,
    GADGET_BRIDGE_MUSIC_CONTROL_REWIND,
} gadget_bridge_music_control_e;

typedef enum gadget_bridge_call_action
{
    GADGET_BRIDGE_CALL_ACTION_ACCEPT = 0,
    GADGET_BRIDGE_CALL_ACTION_END,
    GADGET_BRIDGE_CALL_ACTION_INCOMING,
    GADGET_BRIDGE_CALL_ACTION_OUTGOING,
    GADGET_BRIDGE_CALL_ACTION_REJECT,
    GADGET_BRIDGE_CALL_ACTION_START,
    GADGET_BRIDGE_CALL_ACTION_IGNORE,
} gadget_bridge_call_action_e;

typedef enum gadget_bridge_notification_action
{
    GADGET_BRIDGE_NOTIFICATION_ACTION_DISMISS = 0,
    GADGET_BRIDGE_NOTIFICATION_ACTION_DISMISS_ALL,
    GADGET_BRIDGE_NOTIFICATION_ACTION_OPEN,
    GADGET_BRIDGE_NOTIFICATION_ACTION_MUTE,
    GADGET_BRIDGE_NOTIFICATION_ACTION_REPLY,
} gadget_bridge_notification_action_e;

typedef enum gadget_bridge_http_request_method
{
    GADGET_BRIDGE_HTTP_REQUEST_GET = 0,
    GADGET_BRIDGE_HTTP_REQUEST_POST,
    GADGET_BRIDGE_HTTP_REQUEST_HEAD,
    GADGET_BRIDGE_HTTP_REQUEST_PUT,
    GADGET_BRIDGE_HTTP_REQUEST_PATCH,
    GADGET_BRIDGE_HTTP_REQUEST_DELETE,

} gadget_bridge_http_request_method_e;

typedef struct http_header
{
    const char *key;
    const char *value;
} http_header_t;

bool gadget_bridge_send_toast(gadget_bridge_toast_type_e toast_type, const char *message);

bool gadget_bridge_send_firmware_version(const char *fw1, const char *fw2);

bool gadget_bridge_send_battery_status(uint8_t battery_level_in_percent, float battery_level_in_mV, bool is_charging);

bool gadget_bridge_send_find_phone(bool find_phone);

bool gadget_bridge_send_music_control(gadget_bridge_music_control_e music_control);

bool gadget_bridge_handle_call(gadget_bridge_call_action_e call_action);

bool gadget_bridge_handle_notification(gadget_bridge_call_action_e notification_action, uint64_t handle, const char *phone_number, const char *message);

bool gadget_bridge_send_activity_data(uint16_t heart_rate_in_bpm, uint32_t step_count);

bool gadget_bridge_send_http_request(uint32_t id, const char *url, gadget_bridge_http_request_method_e http_request_method, const char *http_body, const http_header_t *http_headers);

#endif //GADGET_BRIDGE_H