/*
 * Copyright (c) 2018 Samsung Electronics Co., Ltd All Rights Reserved
 *
 * Licensed under the Apache License, Version 2.0 (the License);
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an AS IS BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef __TIZEN_APPFW_WATCHFACE_EDITABLE_H__
#define __TIZEN_APPFW_WATCHFACE_EDITABLE_H__

#include <tizen.h>
#include <glib.h>
#include <bundle.h>

#include <watchface-complication.h>

#ifdef __cplusplus
extern "C" {
#endif

/**
 * @file watchface-editable.h
 * @brief This file contains APIs and enumerations for Watchface editable.
 */

/**
 * @addtogroup WATCHFACE_COMPLICATION_EDITABLE_MODULE
 * @{
 */

/**
 * @brief The editable handle.
 * @since_tizen 5.0
 */
typedef void *watchface_editable_h;

/**
 * @brief The container handle for editable.
 * @since_tizen 5.0
 */
typedef void *watchface_editable_container_h;

/**
 * @brief The editable highlight info handle.
 * @since_tizen 5.0
 */
typedef void *watchface_editable_highlight_h;

/**
 * @brief Enumeration for Editable state.
 * @since_tizen 5.0
 */
typedef enum _editable_edit_state {
  WATCHFACE_EDITABLE_EDIT_STATE_COMPLETE, /**< Complete */
  WATCHFACE_EDITABLE_EDIT_STATE_ONGOING, /**< Ongoing */
  WATCHFACE_EDITABLE_EDIT_STATE_CANCEL /**< Cancel */
} watchface_editable_edit_state_e;

/**
 * @brief Enumeration for Editable shape type.
 * @since_tizen 5.0
 */
typedef enum _editable_shape_type {
  WATCHFACE_EDITABLE_SHAPE_TYPE_CIRCLE, /**< Circle */
  WATCHFACE_EDITABLE_SHAPE_TYPE_RECT /**< Rectangle */
} watchface_editable_shape_type_e;

/**
 * @brief Called when an editable requests an edit.
 * @since_tizen 5.0
 * @param[in] handle The editable handle
 *            The @a handle can be used only in the callback.
 * @param[in] selected_idx Index
 * @param[in] state Editable state
 * @param[in] user_data The user data passed from the callback function
 * @see watchface_editable_edit_state_e
 */
typedef void (*watchface_editable_update_requested_cb)(
			const watchface_editable_h handle,
			int selected_idx,
			const watchface_editable_edit_state_e state,
			void *user_data);
/**
 * @brief Called when the editor is ready to edit.
 * @since_tizen 5.0
 * @remarks The @a handle should not be released.
 * @remarks The @a handle can be used only in the callback.
 * @param[in] handle The editable container handle
 * @param[in] editor_appid The name of editor
 *            The @a editor_appid can be used only in the callback. To use outside, make a copy.
 * @param[in] user_data The user data passed from the callback function
 * @see watchface_editable_add_edit_ready_cb()
 */
typedef void (*watchface_editable_edit_ready_cb)(
			watchface_editable_container_h handle,
			const char *editor_appid,
			void *user_data);

/**
 * @brief The candidates list handle.
 * @since_tizen 5.0
 */
typedef struct complication_candidates_list_ *complication_candidates_list_h;

/**
 * @brief Creates candidates list.
 * @details The candidates list created by this function will be shown on the
 *          editor app's candidates list.
 * @since_tizen 5.0
 * @remarks Created candidates list should be destroyed after used.
 * @param[in] handle The candidates list handle
 * @return #WATCHFACE_COMPLICATION_ERROR_NONE on success,
 *         otherwise an error code (see #watchface_complication_error_e) on failure
 * @retval #WATCHFACE_COMPLICATION_ERROR_NONE Successful
 * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
 * @retval #WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
 * @retval #WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY Out of memory
 * @see watchface_editable_candidates_list_add()
 * @see watchface_editable_candidates_list_destroy()
 * @see watchface_editable_add_design_element()
 * @par Sample code:
 * @code
#include <watchface-complication.h>
{
	complication_candidates_list_h handle;

	int ret = watchface_editable_candidates_list_create(&handle);
	if (ret != WATCHFACE_COMPLICATION_ERROR_NONE)
		return;
}
 * @endcode
 */
int watchface_editable_candidates_list_create(
			complication_candidates_list_h *handle);

/**
 * @brief Adds candidate data to the candidates list.
 * @since_tizen 5.0
 * @remarks Created candidate data will be freed when
 *          watchface_editable_candidates_list_destroy() API is called.
 * @param[in] handle The candidates list handle
 * @param[in] candidate The candidate data
 * @return #WATCHFACE_COMPLICATION_ERROR_NONE on success,
 *         otherwise an error code (see #watchface_complication_error_e) on failure
 * @retval #WATCHFACE_COMPLICATION_ERROR_NONE Successful
 * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
 * @retval #WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
 * @retval #WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY Out of memory
 * @see watchface_editable_candidates_list_create()
 * @see watchface_editable_candidates_list_destroy()
 * @see watchface_editable_add_design_element()
 * @par Sample code:
 * @code
#include <watchface-complication.h>
void _watchface_editable_edit_ready_cb(editable_container_h handle,
		const char *editor_appid, void *user_data)
{
	complication_candidates_list_h list_handle;
	watchface_editable_highlight_h hi;
	bundle *candidate1;
	bundle *candidate2;
	int ret;

	ret = watchface_editable_candidates_list_create(&list_handle);
	if (ret != WATCHFACE_COMPLICATION_ERROR_NONE)
		return;

	candidate1 = bundle_create();
	bundle_add_str(candidate1, "TEST_COLOR", "RED");
	watchface_editable_candidates_list_add(list_handle, candidate1);
	bundle_free(candidate1);

	candidate2 = bundle_create();
	bundle_add_str(candidate2, "TEST_COLOR", "YELLOW");
	watchface_editable_candidates_list_add(list_handle, candidate2);
	bundle_free(candidate2);

	watchface_editable_highlight_create(&hi, WATCHFACE_EDITABLE_SHAPE_TYPE_CIRCLE);
	watchface_editable_highlight_set_geometry(hi, 50, 50, 100, 100);
	ret = watchface_editable_add_design_element(handle, COLOR_EDIT, cur_idx,
			list_handle, hi, "Color");

	watchface_editable_highlight_destroy(hi);
	watchface_editable_candidates_list_destroy(list_handle);
}
 * @endcode
 */
int watchface_editable_candidates_list_add(
			complication_candidates_list_h handle, bundle *candidate);

/**
 * @brief Destroys candidates list.
 * @since_tizen 5.0
 * @param[in] handle The complication allowed list handle
 * @return #WATCHFACE_COMPLICATION_ERROR_NONE on success,
 *         otherwise an error code (see #watchface_complication_error_e) on failure
 * @retval #WATCHFACE_COMPLICATION_ERROR_NONE Successful
 * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
 * @retval #WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
 * @see watchface_editable_candidates_list_add()
 * @see watchface_editable_candidates_list_create()
 * @see watchface_editable_add_design_element()
 * @par Sample code:
 * @code
#include <watchface-complication.h>
void _watchface_editable_edit_ready_cb(editable_container_h handle,
		const char *editor_appid, void *user_data)
{
	complication_candidates_list_h list_handle;
	bundle *candidate1;
	bundle *candidate2;
	int ret;

	ret = watchface_editable_candidates_list_create(&list_handle);
	if (ret != WATCHFACE_COMPLICATION_ERROR_NONE)
		return;

	candidate1 = bundle_create();
	bundle_add_str(candidate1, "TEST_COLOR", "RED");
	watchface_editable_candidates_list_add(list_handle, candidate1);
	bundle_free(candidate1);

	candidate2 = bundle_create();
	bundle_add_str(candidate2, "TEST_COLOR", "YELLOW");
	watchface_editable_candidates_list_add(list_handle, candidate2);
	bundle_free(candidate2);

	watchface_editable_highlight_create(&hi, WATCHFACE_EDITABLE_SHAPE_TYPE_CIRCLE);
	watchface_editable_highlight_set_geometry(hi, 50, 50, 100, 100);

	ret = watchface_editable_add_design_element(handle, COLOR_EDIT, cur_idx,
			list_handle, hi, "Color");

	watchface_editable_highlight_destroy(hi);
	watchface_editable_candidates_list_destroy(list_handle);
}
 * @endcode
 */
int watchface_editable_candidates_list_destroy(
			complication_candidates_list_h handle);

/**
 * @brief Adds the design element to the editable container handle.
 * @details The design element will be displayed on the editor app's editables list.
 * @since_tizen 5.0
 * @remarks If watch application developer want to draw it's own style highlight,
 *         put NULL value for highlight parameter and draw highlight in
 *         watchface_editable_update_requested_cb(). Otherwise system editor will
 *         draw highlight.
 * @param[in] handle The editable container
 * @param[in] editable_id Editable id
 * @param[in] cur_data_idx The index of the currently set data
 * @param[in] list_handle List of candidate data
 * @param[in] highlight Highlight information. It could be NULL
 * @param[in] editable_name Name of editable
 * @return #WATCHFACE_COMPLICATION_ERROR_NONE if success, other value if failure
 * @retval #WATCHFACE_COMPLICATION_ERROR_NONE Success
 * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
 * @retval #WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
 * @retval #WATCHFACE_COMPLICATION_ERROR_EXIST_ID The given @a editable_id already exists
 * @retval #WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY Out of memory
 * @see watchface_editable_edit_ready_cb()
 * @see watchface_editable_candidates_list_add()
 * @see watchface_editable_candidates_list_create()
 * @see watchface_editable_request_edit()
 * @see watchface_editable_update_requested_cb()
 * @see watchface_editable_highlight_set_geometry()
 * @see watchface_editable_highlight_create()
 * @see watchface_editable_highlight_destroy()
 * @par Sample code:
 * @code
#include <watchface-editable.h>
void _watchface_editable_edit_ready_cb(watchface_editable_container_h handle,
		const char *editor_appid, void *user_data)
{
	complication_candidates_list_h list_handle;
	watchface_editable_highlight_h hi;
	bundle *candidate1;
	bundle *candidate2;
	int ret;

	ret = watchface_editable_candidates_list_create(&list_handle);
	if (ret != WATCHFACE_COMPLICATION_ERROR_NONE)
		return;

	candidate1 = bundle_create();
	bundle_add_str(candidate1, "TEST_COLOR", "RED");
	watchface_editable_candidates_list_add(list_handle, candidate1);
	bundle_free(candidate1);

	candidate2 = bundle_create();
	bundle_add_str(candidate2, "TEST_COLOR", "YELLOW");
	watchface_editable_candidates_list_add(list_handle, candidate2);
	bundle_free(candidate2);

	watchface_editable_highlight_create(&hi, WATCHFACE_EDITABLE_SHAPE_TYPE_CIRCLE);
	watchface_editable_highlight_set_geometry(hi, 50, 50, 100, 100);

	ret = watchface_editable_add_design_element(handle, COLOR_EDIT, cur_idx,
			list_handle, hi, "Color");

	watchface_editable_highlight_destroy(hi);
	watchface_editable_candidates_list_destroy(list_handle);
}
 * @endcode
 */
int watchface_editable_add_design_element(watchface_editable_container_h handle,
			int editable_id, int cur_data_idx,
			complication_candidates_list_h list_handle,
			watchface_editable_highlight_h highlight, const char *editable_name);

/**
 * @brief Adds a complication to the editable container handle.
 * @since_tizen 5.0
 * @remarks If watch application developer want to draw it's own style highlight,
 *         put NULL value for highlight parameter and draw highlight in
 *         watchface_editable_update_requested_cb(). Otherwise system editor will
 *         draw highlight.
 * @param[in] handle The editable container handle
 * @param[in] editable_id Editable id
 * @param[in] comp Complication handle
 * @param[in] highlight Highlight information. It could be NULL
 * @return #WATCHFACE_COMPLICATION_ERROR_NONE if success, other value if failure
 * @retval #WATCHFACE_COMPLICATION_ERROR_NONE Success
 * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
 * @retval #WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
 * @retval #WATCHFACE_COMPLICATION_ERROR_EXIST_ID The given @a editable_id already exists
 * @par Sample code:
 * @code
#include <watchface-editable.h>
void _watchface_editable_edit_ready_cb(watchface_editable_container_h handle,
			const char *editor_appid, void *user_data)
{
	int comp_id = 1;
	watchface_editable_highlight_h hi;

	watchface_editable_highlight_create(&hi, WATCHFACE_EDITABLE_SHAPE_TYPE_CIRCLE);
	watchface_editable_highlight_set_geometry(hi, 50, 50, 100, 100);

	// add the created complication
	watchface_editable_add_complication(handle, comp_id, comp, hi);
	watchface_editable_highlight_destroy(hi);
}
 * @endcode
 */
int watchface_editable_add_complication(watchface_editable_container_h handle,
			int editable_id, complication_h comp,
			watchface_editable_highlight_h highlight);

/**
 * @brief Requests editor to edit.
 * @since_tizen 5.0
 * @privlevel public
 * @privilege http://tizen.org/privilege/datasharing
 * @param[in] handle The editable container handle
 * @param[in] cb The callback function
 * @param[in] user_data The user data to pass to the callback function
 * @return #WATCHFACE_COMPLICATION_ERROR_NONE if success, other value if failure
 * @retval #WATCHFACE_COMPLICATION_ERROR_NONE Success
 * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
 * @retval #WATCHFACE_COMPLICATION_ERROR_PERMISSION_DENIED Permission denied
 * @retval #WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
 * @retval #WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY Out of memory
 * @retval #WATCHFACE_COMPLICATION_ERROR_IO_ERROR I/O Error
 * @see watchface_editable_update_requested_cb()
 * @see watchface_editable_highlight_set_geometry()
 * @see watchface_editable_highlight_create()
 * @see watchface_editable_highlight_destroy()
 * @par Sample code:
 * @code
#include <watchface-editable.h>
void _watchface_editable_edit_ready_cb(watchface_editable_container_h handle,
			const char *editor_appid, void *user_data)
{
	int comp_id = 1;
	int design_element_id = 2;
	bundle *design_element;
	complication_candidates_list_h candidates_list = NULL;
	watchface_editable_highlight_h hi;

	watchface_editable_highlight_create(&hi, WATCHFACE_EDITABLE_SHAPE_TYPE_CIRCLE);
	watchface_editable_highlight_set_geometry(hi, 50, 50, 100, 100);

	// create, add complication
	watchface_editable_add_complication(handle, comp_id, comp, hi);

	// create, add design element
	// make a candidatelist
	watchface_editable_candidates_list_create(&candidates_list);
	design_element = bundle_create();
	bundle_add_str(design_element, "TEST_COLOR", "Blue");

	// set editable geometry information for design element
	watchface_editable_highlight_set_geometry(hi, 100, 50, 100, 100);

	watchface_editable_candidates_list_add(candidates_list, design_element);
	watchface_editable_add_design_element(handle, design_element_id, 0,
		candidatelist, hi, "Color");

	watchface_editable_candidates_list_destroy(candidates_list);
	watchface_editable_highlight_destroy(hi);

	watchface_editable_request_edit(handle, _watchface_editable_update_requested_cb, user_data);
}
 * @endcode
 */
int watchface_editable_request_edit(watchface_editable_container_h handle,
			watchface_editable_update_requested_cb cb,
			void *user_data);

/**
 * @brief Adds the callback function to request edit.
 * @since_tizen 5.0
 * @param[in] cb The callback function
 * @param[in] user_data The user data to pass to the callback function
 * @return #WATCHFACE_COMPLICATION_ERROR_NONE if success, other value if failure
 * @retval #WATCHFACE_COMPLICATION_ERROR_NONE Success
 * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
 * @retval #WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
 * @retval #WATCHFACE_COMPLICATION_ERROR_IO_ERROR I/O Error
 * @retval #WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY Out of memory
 * @see watchface_editable_edit_ready_cb()
 * @par Sample code:
 * @code
#include <watchface-editable.h>
{
	watchface_editable_add_edit_ready_cb(_watchface_editable_edit_ready_cb, NULL);
}
 * @endcode
 */
int watchface_editable_add_edit_ready_cb(watchface_editable_edit_ready_cb cb,
			void *user_data);

/**
 * @brief Removes the callback function to request edit.
 * @since_tizen 5.0
 * @param[in] cb The callback function
 * @return #WATCHFACE_COMPLICATION_ERROR_NONE if success, other value if failure
 * @retval #WATCHFACE_COMPLICATION_ERROR_NONE Success
 * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
 * @retval #WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
 * @see watchface_editable_edit_ready_cb()
 * @par Sample code:
 * @code
#include <watchface-editable.h>
{
	watchface_editable_remove_edit_ready_cb(_watchface_edit_ready_cb);
}
 * @endcode
 */
int watchface_editable_remove_edit_ready_cb(watchface_editable_edit_ready_cb cb);

/**
 * @brief Gets the name of the editable.
 * @since_tizen 5.0
 * @remarks The @a editable_name should be freed using free().
 * @param[in] handle The editable handle
 * @param[out] editable_name Name of editable
 * @return #WATCHFACE_COMPLICATION_ERROR_NONE if success, other value if failure
 * @retval #WATCHFACE_COMPLICATION_ERROR_NONE Success
 * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
 * @retval #WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
 * @retval #WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY Out of memory
 * @retval #WATCHFACE_COMPLICATION_ERROR_NO_DATA No data
 * @par Sample code:
 * @code
#include <watchface-editable.h>
_watchface_editable_update_requested_cb(const watchface_editable_h handle,
		int selected_idx, const watchface_editable_edit_state_e state,
		void *user_data)
{
	int ret;
	char *name;

	ret = watchface_editable_get_editable_name(handle, &name);
	if (ret != WATCHFACE_COMPLICATION_ERROR_NONE || name == NULL)
		return;

	free(name);
}
 * @endcode
 */
int watchface_editable_get_editable_name(const watchface_editable_h handle,
			char **editable_name);

/**
 * @brief Sets the name in editable.
 * @since_tizen 5.0
 * @param[in] handle The editable handle
 * @param[in] editable_name Name of editable
 * @return #WATCHFACE_COMPLICATION_ERROR_NONE if success, other value if failure
 * @retval #WATCHFACE_COMPLICATION_ERROR_NONE Success
 * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
 * @retval #WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
 * @par Sample code:
 * @code
#include <watchface-editable.h>
_watchface_editable_update_requested_cb(const watchface_editable_h handle,
		int selected_idx, const watchface_editable_edit_state_e state,
		void *user_data)
{
	int ret;
	const char *name = "Editor";

	ret = watchface_editable_set_editable_name(ed, name);
	if (ret != WATCHFACE_COMPLICATION_ERROR_NONE)
		return;
}
 * @endcode
 */
int watchface_editable_set_editable_name(const watchface_editable_h handle,
			const char *editable_name);

/**
 * @brief Retrieves the n-th data of editable.
 * @since_tizen 5.0
 * @remarks The @a nth_data should be freed using bundle_free().
 * @param[in] handle The editable handle
 * @param[in] n Index
 * @param[in] nth_data Bundle data
 * @return #WATCHFACE_COMPLICATION_ERROR_NONE if success, other value if failure
 * @retval #WATCHFACE_COMPLICATION_ERROR_NONE Success
 * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
 * @retval #WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
 * @retval #WATCHFACE_COMPLICATION_ERROR_NO_DATA No data
 * @retval #WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY Out of memory
 * @par Sample code:
 * @code
#include <watchface-editable.h>
_watchface_editable_update_requested_cb(const watchface_editable_h handle,
		int selected_idx, const watchface_editable_edit_state_e state,
		void *user_data)
{
	int ret;
	int n = 1;
	bundle *data;

	ret = watchface_editable_get_nth_data(handle, n, &data);
	if (ret != WATCHFACE_COMPLICATION_ERROR_NONE || data == NULL);
		return;

	bundle_free(data);
}
 * @endcode
 */
int watchface_editable_get_nth_data(const watchface_editable_h handle, int n,
			bundle **nth_data);

/**
 * @brief Retrieves the current data in editable.
 * @since_tizen 5.0
 * @remarks The @a cur_data should be freed using bundle_free().
 * @param[in] handle The editable handle
 * @param[out] cur_data Current data of bundle type
 * @return #WATCHFACE_COMPLICATION_ERROR_NONE if success, other value if failure
 * @retval #WATCHFACE_COMPLICATION_ERROR_NONE Success
 * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
 * @retval #WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
 * @retval #WATCHFACE_COMPLICATION_ERROR_NO_DATA No data
 * @retval #WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY Out of memory
 * @par Sample code:
 * @code
#include <watchface-editable.h>
_watchface_editable_update_requested_cb(const watchface_editable_h handle,
		int selected_idx, const watchface_editable_edit_state_e state,
		void *user_data)
{
	int ret;
	bundle *data;

	ret = watchface_editable_get_current_data(handle, &data);
	if (ret != WATCHFACE_COMPLICATION_ERROR_NONE || data == NULL);
		return;

	bundle_free(data);
}
 * @endcode
 */
int watchface_editable_get_current_data(const watchface_editable_h handle,
			bundle **cur_data);

/**
 * @brief Gets the index of the current data.
 * @since_tizen 5.0
 * @param[in] handle The editable handle
 * @param[in] idx Index
 * @return #WATCHFACE_COMPLICATION_ERROR_NONE if success, other value if failure
 * @retval #WATCHFACE_COMPLICATION_ERROR_NONE Success
 * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
 * @retval #WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
 * @par Sample code:
 * @code
#include <watchface-editable.h>
_watchface_editable_update_requested_cb(const watchface_editable_h handle,
		int selected_idx, const watchface_editable_edit_state_e state,
		void *user_data)
{
	int ret;
	int cur_idx = 0;

	ret = watchface_editable_get_current_data_idx(handle, &cur_idx);
	if (ret != WATCHFACE_COMPLICATION_ERROR_NONE)
		return;
}
 * @endcode
 */
int watchface_editable_get_current_data_idx(const watchface_editable_h handle, int *idx);

/**
 * @brief Gets the id of editable.
 * @since_tizen 5.0
 * @param[in] handle The editable handle
 * @param[out] editable_id Id
 * @return #WATCHFACE_COMPLICATION_ERROR_NONE if success, other value if failure
 * @retval #WATCHFACE_COMPLICATION_ERROR_NONE Success
 * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
 * @retval #WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
 * @par Sample code:
 * @code
#include <watchface-editable.h>
_watchface_editable_update_requested_cb(const watchface_editable_h handle,
		int selected_idx, const watchface_editable_edit_state_e state,
		void *user_data)
{
	int ret;
	int ed_id = 0;

	ret = watchface_editable_get_editable_id(handle, &ed_id);
	if (ret != WATCHFACE_COMPLICATION_ERROR_NONE)
		return;
}
 * @endcode
 */
int watchface_editable_get_editable_id(const watchface_editable_h handle,
			int *editable_id);

/**
 * @brief Gets the editable information for the specified id.
 * @since_tizen 5.0
 * @remarks The @a current_data should be freed using bundle_free().
 * @param[in] editable_id Id of editable
 * @param[in] current_data Bundle data containing current information
 * @return #WATCHFACE_COMPLICATION_ERROR_NONE if success, other value if failure
 * @retval #WATCHFACE_COMPLICATION_ERROR_NONE Success
 * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
 * @retval #WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
 * @retval #WATCHFACE_COMPLICATION_ERROR_NO_DATA No data available
 * @retval #WATCHFACE_COMPLICATION_ERROR_DB Database error
 * @retval #WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY Out of memory
 * @par Sample code:
 * @code
#include <watchface-editable.h>
{
	int color_edit = 1;
	bundle *selected_data = NULL;

	watchface_editable_load_current_data(color_edit, &selected_data);
}
 * @endcode
 */
int watchface_editable_load_current_data(int editable_id,
			bundle **current_data);

/**
 * @brief Creates editable's highlight info handle.
 * @since_tizen 5.0
 * @remarks The @a handle should be freed using watchface_editable_highlight_destroy().
 * @param[out] handle The editable's highlight handle
 * @param[in] shape_type The editable's highlight shape type
 * @return #WATCHFACE_COMPLICATION_ERROR_NONE on success,
 *         otherwise an error code (see #watchface_complication_error_e) on failure
 * @retval #WATCHFACE_COMPLICATION_ERROR_NONE Successful
 * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
 * @retval #WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
 * @retval #WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY Out of memory
 * @see watchface_editable_highlight_set_geometry()
 * @see watchface_editable_highlight_get_geometry()
 * @see watchface_editable_highlight_set_shape_type()
 * @see watchface_editable_highlight_get_shape_type()
 * @see watchface_editable_highlight_destroy()
 * @see watchface_editable_get_highlight()
 * @par Sample code:
 * @code
#include <watchface-complication.h>
{
	watchface_editable_highlight_h handle;
	int ret = watchface_editable_highlight_create(&handle, WATCHFACE_EDITABLE_SHAPE_TYPE_CIRCLE);
}
 * @endcode
 */
int watchface_editable_highlight_create(watchface_editable_highlight_h *handle,
		watchface_editable_shape_type_e shape_type);

/**
 * @brief Sets editable's highlight geometry info.
 * @since_tizen 5.0
 * @param[in] handle The editable's highlight handle
 * @param[out] x The editable geometry offset x
 * @param[out] y The editable geometry offset y
 * @param[out] w The editable geometry width
 * @param[out] h The editable geometry height
 * @return #WATCHFACE_COMPLICATION_ERROR_NONE on success,
 *         otherwise an error code (see #watchface_complication_error_e) on failure
 * @retval #WATCHFACE_COMPLICATION_ERROR_NONE Successful
 * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
 * @retval #WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
 * @retval #WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY Out of memory
 * @see watchface_editable_highlight_create()
 * @see watchface_editable_highlight_get_geometry()
 * @see watchface_editable_highlight_set_shape_type()
 * @see watchface_editable_highlight_get_shape_type()
 * @see watchface_editable_highlight_destroy()
 * @see watchface_editable_get_highlight()
 * @par Sample code:
 * @code
#include <watchface-complication.h>
{
	watchface_editable_highlight_h handle;

	int ret = watchface_editable_highlight_create(&handle, WATCHFACE_EDITABLE_SHAPE_TYPE_CIRCLE);
	ret = watchface_editable_highlight_set_geometry(handle, 50, 50, 100, 100);
}
 * @endcode
 */
int watchface_editable_highlight_set_geometry(
	watchface_editable_highlight_h handle, int x, int y, int w, int h);

/**
 * @brief Gets editable's highlight geometry info.
 * @since_tizen 5.0
 * @param[in] handle The editable's highlight handle
 * @param[out] x The editable geometry x
 * @param[out] y The editable geometry y
 * @param[out] w The editable geometry w
 * @param[out] h The editable geometry h
 * @return #WATCHFACE_COMPLICATION_ERROR_NONE on success,
 *         otherwise an error code (see #watchface_complication_error_e) on failure
 * @retval #WATCHFACE_COMPLICATION_ERROR_NONE Successful
 * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
 * @retval #WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
 * @retval #WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY Out of memory
 * @see watchface_editable_highlight_create()
 * @see watchface_editable_highlight_set_geometry()
 * @see watchface_editable_highlight_set_shape_type()
 * @see watchface_editable_highlight_get_shape_type()
 * @see watchface_editable_highlight_destroy()
 * @see watchface_editable_get_highlight()
 * @par Sample code:
 * @code
#include <watchface-complication.h>
{
	watchface_editable_highlight_h handle;
	int x, y, w, h;

	int ret = watchface_editable_get_highlight(ed, &handle);
	ret = watchface_editable_highlight_get_geometry(handle, &x, &y, &w, &h);
}
 * @endcode
 */
int watchface_editable_highlight_get_geometry(
	watchface_editable_highlight_h handle, int *x, int *y, int *w, int *h);

/**
 * @brief Sets editable's highlight shape type.
 * @since_tizen 5.0
 * @param[in] handle The editable's highlight handle
 * @param[in] shape The editable shape type
 * @return #WATCHFACE_COMPLICATION_ERROR_NONE on success,
 *         otherwise an error code (see #watchface_complication_error_e) on failure
 * @retval #WATCHFACE_COMPLICATION_ERROR_NONE Successful
 * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
 * @retval #WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
 * @retval #WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY Out of memory
 * @see watchface_editable_highlight_create()
 * @see watchface_editable_highlight_set_geometry()
 * @see watchface_editable_highlight_get_geometry()
 * @see watchface_editable_highlight_get_shape_type()
 * @see watchface_editable_highlight_destroy()
 * @see watchface_editable_get_highlight()
 * @par Sample code:
 * @code
#include <watchface-complication.h>
{
	watchface_editable_highlight_h handle;

	int ret = watchface_editable_highlight_create(&handle, WATCHFACE_EDITABLE_SHAPE_TYPE_CIRCLE);
	ret = watchface_editable_highlight_set_shape_type(handle, WATCHFACE_EDITABLE_SHAPE_TYPE_RECT);
}
 * @endcode
 */
int watchface_editable_highlight_set_shape_type(
	watchface_editable_highlight_h handle,
	watchface_editable_shape_type_e shape);

/**
 * @brief Gets editable's highlight shape type.
 * @since_tizen 5.0
 * @param[in] handle The editable's highlight handle
 * @param[out] shape The editable shape type
 * @return #WATCHFACE_COMPLICATION_ERROR_NONE on success,
 *         otherwise an error code (see #watchface_complication_error_e) on failure
 * @retval #WATCHFACE_COMPLICATION_ERROR_NONE Successful
 * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
 * @retval #WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
 * @retval #WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY Out of memory
 * @see watchface_editable_highlight_create()
 * @see watchface_editable_highlight_set_geometry()
 * @see watchface_editable_highlight_get_geometry()
 * @see watchface_editable_highlight_destroy()
 * @see watchface_editable_get_highlight()
 * @par Sample code:
 * @code
#include <watchface-complication.h>
{
	watchface_editable_highlight_h handle;
	watchface_editable_shape_type_e shape;

	int ret = watchface_editable_get_highlight(ed, &handle);
	ret = watchface_editable_highlight_get_shape_type(handle, &shape);
}
 * @endcode
 */
int watchface_editable_highlight_get_shape_type(
	watchface_editable_highlight_h handle,
	watchface_editable_shape_type_e* shape);

/**
 * @brief Destroys editable's highlight info.
 * @since_tizen 5.0
 * @param[in] handle The editable's highlight handle
 * @return #WATCHFACE_COMPLICATION_ERROR_NONE on success,
 *         otherwise an error code (see #watchface_complication_error_e) on failure
 * @retval #WATCHFACE_COMPLICATION_ERROR_NONE Successful
 * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
 * @retval #WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
 * @retval #WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY Out of memory
 * @see watchface_editable_highlight_create()
 * @see watchface_editable_highlight_set_geometry()
 * @see watchface_editable_highlight_set_shape_type()
 * @see watchface_editable_highlight_get_shape_type()
 * @see watchface_editable_get_highlight()
 * @par Sample code:
 * @code
#include <watchface-complication.h>
{
	watchface_editable_highlight_h handle;

	int ret = watchface_editable_highlight_create(&handle, WATCHFACE_EDITABLE_SHAPE_TYPE_CIRCLE);
	ret = watchface_editable_highlight_destroy(handle);
}
 * @endcode
 */
int watchface_editable_highlight_destroy(watchface_editable_highlight_h handle);

/**
 * @brief Gets editable's highlight handle.
 * @since_tizen 5.0
 * @remarks The @a highlight should be release usinig watchface_editable_highlight_destroy().
 * @param[in] handle The editable handle
 * @param[out] highlight The editable's highlight handle
 * @return #WATCHFACE_COMPLICATION_ERROR_NONE on success,
 *         otherwise an error code (see #watchface_complication_error_e) on failure
 * @retval #WATCHFACE_COMPLICATION_ERROR_NONE Successful
 * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
 * @retval #WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
 * @retval #WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY Out of memory
 * @see watchface_editable_highlight_create()
 * @see watchface_editable_highlight_set_geometry()
 * @see watchface_editable_highlight_get_geometry()
 * @see watchface_editable_highlight_set_shape_type()
 * @see watchface_editable_highlight_get_shape_type()
 * @see watchface_editable_highlight_destroy()
 * @par Sample code:
 * @code
#include <watchface-complication.h>
{
	watchface_editable_highlight_h handle;

	int ret = watchface_editable_get_highlight(ed, &handle);

	watchface_editable_highlight_destroy(handle);
}
 * @endcode
 */
int watchface_editable_get_highlight(const watchface_editable_h handle,
	watchface_editable_highlight_h* highlight);

/**
 * @}
 */

#ifdef __cplusplus
}
#endif

#endif  /* __TIZEN_APPFW_WATCHFACE_EDITABLE_H__ */
