975db0a3da8b61bb9631b4801bc9492673884f5a
[framework/pim/calendar-service.git] / include / calendar_types2.h
1 /*
2  * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  * Licensed under the Apache License, Version 2.0 (the License);
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an AS IS BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 #ifndef __TIZEN_SOCIAL_CALENDAR_TYPES_H__
18 #define __TIZEN_SOCIAL_CALENDAR_TYPES_H__
19
20 #include <stdint.h>
21 #include <tizen.h>
22 #include <calendar_errors.h>
23
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27
28 #ifndef API
29 #define API __attribute__ ((visibility("default")))
30 #endif
31
32 #define _CALENDAR_HANDLE(A) typedef struct __##A* A;
33
34 #define _CALENDAR_BEGIN_VIEW() \
35                 typedef struct{ \
36                         const char* _uri;
37 #define _CALENDAR_PROPERTY_INT(property_id_name)        unsigned int property_id_name;
38 #define _CALENDAR_PROPERTY_STR(property_id_name)        unsigned int property_id_name;
39 #define _CALENDAR_PROPERTY_DOUBLE(property_id_name)     unsigned int property_id_name;
40 #define _CALENDAR_PROPERTY_LLI(property_id_name)        unsigned int property_id_name;
41 #define _CALENDAR_PROPERTY_CALTIME(property_id_name)    unsigned int property_id_name;
42 #define _CALENDAR_PROPERTY_CHILD_MULTIPLE(property_id_name) unsigned int property_id_name;
43 #define _CALENDAR_END_VIEW(name) } name##_property_ids; \
44     extern API const name##_property_ids name;
45
46 #define _CALENDAR_BEGIN_READ_ONLY_VIEW() \
47         typedef struct{ \
48             const char* _uri;
49 #define _CALENDAR_PROPERTY_PROJECTION_INT(property_id_name)        unsigned int property_id_name;
50 #define _CALENDAR_PROPERTY_PROJECTION_STR(property_id_name)        unsigned int property_id_name;
51 #define _CALENDAR_PROPERTY_PROJECTION_DOUBLE(property_id_name)     unsigned int property_id_name;
52 #define _CALENDAR_PROPERTY_PROJECTION_LLI(property_id_name)        unsigned int property_id_name;
53 #define _CALENDAR_PROPERTY_PROJECTION_CALTIME(property_id_name)    unsigned int property_id_name;
54 #define _CALENDAR_PROPERTY_FILTER_INT(property_id_name)        unsigned int property_id_name;
55 #define _CALENDAR_PROPERTY_FILTER_STR(property_id_name)        unsigned int property_id_name;
56 #define _CALENDAR_PROPERTY_FILTER_DOUBLE(property_id_name)     unsigned int property_id_name;
57 #define _CALENDAR_PROPERTY_FILTER_LLI(property_id_name)        unsigned int property_id_name;
58 #define _CALENDAR_PROPERTY_FILTER_CALTIME(property_id_name)    unsigned int property_id_name;
59 #define _CALENDAR_END_READ_ONLY_VIEW(name) } name##_property_ids; \
60     extern API const name##_property_ids name;
61
62 _CALENDAR_HANDLE( calendar_record_h )
63 _CALENDAR_HANDLE( calendar_filter_h )
64 _CALENDAR_HANDLE( calendar_list_h )
65 _CALENDAR_HANDLE( calendar_query_h )
66
67 /**
68  * @addtogroup CAPI_SOCIAL_CALENDAR_SVC_DATABASE_MODULE
69  * @{
70  */
71
72 /**
73  * @brief The callback function to get the result of batch operation.
74  *
75  * @param[in]   error                   Error code for batch operation
76  * @param[in]   user_data               The user data passed from the batch operation
77  *
78  * @return  @c true to continue with the next iteration of the loop or @c false to break out of the loop.
79  *
80  * @pre calendar_db_update_records() will invoke this callback.
81  *
82  * @see calendar_db_update_records()
83  */
84 typedef void (*calendar_db_result_cb)( int error, void *user_data);
85
86 /**
87  * @brief The callback function to get the result of batch operation.
88  *
89  * @param[in]   error           Error code for batch operation
90  * @param[in]   record_id_array The record IDs for batch operation
91  * @param[in]   count           The number of record ID array
92  * @param[in]   user_data       The user data passed from the batch operation
93  *
94  * @return  @c true to continue with the next iteration of the loop or @c false to break out of the loop.
95  *
96  * @pre calendar_db_insert_records() will invoke this callback.
97  *
98  * @see calendar_db_insert_records()
99  */
100 typedef void (*calendar_db_insert_result_cb)( int error, int* record_id_array, int count, void *user_data);
101
102 /**
103  * @brief       Called when designated view changes.
104  *
105  * @param[in]   view_uri        The view uri
106  * @param[in]   user_data       The user data passed from the callback registration function
107  *
108  * @see calendar_db_add_changed_cb()
109  */
110 typedef void (*calendar_db_changed_cb)(const char* view_uri, void* user_data);
111
112 /**
113  * @brief       Called when alarm is alerted.
114  *
115  * @param[in]   consta char *param
116  * @param[in]   user_data       The user data passed from the callback registration function
117  *
118  * @see calendar_db_add_changed_cb()
119  */
120 typedef void (*calendar_reminder_cb)(const char *param, void* user_data);
121
122 /**
123  * @brief Definition for calendar connect flag
124  */
125 #define CALENDAR_CONNECT_FLAG_NONE         0x00000000
126 #define CALENDAR_CONNECT_FLAG_RETRY        0x00000001
127
128 /**
129  * @brief Definition for default event calendar book database ID
130  */
131 #define DEFAULT_EVENT_CALENDAR_BOOK_ID           1
132
133 /**
134  * @brief Definition for default to-do calendar book database ID
135  */
136 #define DEFAULT_TODO_CALENDAR_BOOK_ID            2
137
138 /**
139  * @brief Definition for default birthday calendar book database ID
140  */
141 #define DEFAULT_BIRTHDAY_CALENDAR_BOOK_ID        3
142
143 /**
144  * @brief Definition for no due date of a to-do
145  */
146 #define CALENDAR_TODO_NO_DUE_DATE   INT64_MAX
147
148 /**
149  * @brief Definition for no start date of a to-do
150  */
151 #define CALENDAR_TODO_NO_START_DATE (-INT64_MAX)
152
153 /**
154  * @brief Definition for no until of a record
155  */
156 #define CALENDAR_RECORD_NO_UNTIL    INT64_MAX
157
158 /**
159  * @brief Definition for no coordinate(latitude/longitude) of a record
160  */
161 #define CALENDAR_RECORD_NO_COORDINATE 1000
162
163 /**
164  * @}
165  */
166
167 /**
168  * @addtogroup CAPI_SOCIAL_CALENDAR_SVC_FILTER_MODULE
169  * @{
170  */
171
172 /**
173  * @brief Definition for all calendar book
174  */
175 #define CALENDAR_BOOK_FILTER_ALL                    -1
176
177 /**
178  * @brief Enumerations of filter match type for string
179  */
180 typedef enum
181 {
182         CALENDAR_MATCH_EXACTLY,                 /**< . */
183         CALENDAR_MATCH_FULLSTRING,              /**< . */
184         CALENDAR_MATCH_CONTAINS,                /**< . */
185         CALENDAR_MATCH_STARTSWITH,              /**< . */
186         CALENDAR_MATCH_ENDSWITH,                /**< . */
187         CALENDAR_MATCH_EXISTS           /**< . */
188 } calendar_match_str_flag_e;
189
190 /**
191  * @brief Enumerations of filter match type for integer
192  */
193 typedef enum
194 {
195         CALENDAR_MATCH_EQUAL,                                   /**< . */
196         CALENDAR_MATCH_GREATER_THAN,                    /**< . */
197         CALENDAR_MATCH_GREATER_THAN_OR_EQUAL,   /**< . */
198         CALENDAR_MATCH_LESS_THAN,                               /**< . */
199         CALENDAR_MATCH_LESS_THAN_OR_EQUAL,              /**< . */
200         CALENDAR_MATCH_NOT_EQUAL,               /**< this flag can yield poor performance */
201         CALENDAR_MATCH_NONE                                             /**< . */
202 } calendar_match_int_flag_e;
203
204 /**
205  * @brief Enumerations of filter combine type
206  */
207 typedef enum {
208         CALENDAR_FILTER_OPERATOR_AND,   /**< . */
209         CALENDAR_FILTER_OPERATOR_OR             /**< . */
210 } calendar_filter_operator_e;
211
212 /**
213  * @}
214  */
215
216 /**
217  * @addtogroup CAPI_SOCIAL_CALENDAR_SVC_RECORD_MODULE
218  * @{
219  */
220
221 /**
222  * @brief Enumerations for calendar book type. "OR"ing supported.
223  */
224 typedef enum
225 {
226     CALENDAR_BOOK_TYPE_NONE          = 0,       /**< Calendar book type default */
227     CALENDAR_BOOK_TYPE_EVENT         = 1<<0,        /**< Event calendar book type */
228     CALENDAR_BOOK_TYPE_TODO          = 1<<1     /**< To-do Calendar book type */
229 } calendar_book_type_e;
230
231 /**
232  * @brief Enumerations for calendar sensitivity type.
233  */
234 typedef enum
235 {
236     CALENDAR_SENSITIVITY_PUBLIC          = 0,   /**< Public Sensitivity */
237     CALENDAR_SENSITIVITY_PRIVATE,                               /**< Private Sensitivity */
238     CALENDAR_SENSITIVITY_CONFIDENTIAL                   /**< Confidential Sensitivity */
239 } calendar_sensitivity_e;
240
241 /**
242  * @brief Enumerations of attendee status.
243  */
244 typedef enum
245 {
246         CALENDAR_ATTENDEE_STATUS_PENDING        = 0,    /**< Pending status */
247         CALENDAR_ATTENDEE_STATUS_ACCEPTED,                      /**< Accepted status */
248         CALENDAR_ATTENDEE_STATUS_DECLINED,                      /**< Decliend status */
249         CALENDAR_ATTENDEE_STATUS_TENTATIVE,                     /**< Tentative status */
250         CALENDAR_ATTENDEE_STATUS_DELEGATED,                     /**< Delegated status */
251         CALENDAR_ATTENDEE_STATUS_COMPLETED,                     /**< Completed status */
252         CALENDAR_ATTENDEE_STATUS_IN_PROCESS,                    /**< In process status */
253         CALENDAR_ATTENDEE_STATUS_MAX,
254 }calendar_attendee_status_e;
255
256 /**
257  * @brief Enumerations of attendee role.
258  */
259 typedef enum
260 {
261         CALENDAR_ATTENDEE_ROLE_REQ_PARTICIPANT  = 0,    /**< Participation is required */
262         CALENDAR_ATTENDEE_ROLE_OPT_PARTICIPANT,                 /**< Accepted status */
263         CALENDAR_ATTENDEE_ROLE_NON_PARTICIPANT,                 /**< Non-Participant */
264         CALENDAR_ATTENDEE_ROLE_CHAIR,                                   /**< Chairperson */
265         CALENDAR_ATTENDEE_ROLE_MAX,
266 }calendar_attendee_role_e;
267
268 /**
269  * @brief  Alarm time unit type of event such as minutes, hours, days, or etc.
270  */
271 typedef enum
272 {
273     CALENDAR_ALARM_NONE = -1,                  /**< No reminder set */
274     CALENDAR_ALARM_TIME_UNIT_SPECIFIC = 1,     /**< specific in sec */
275     CALENDAR_ALARM_TIME_UNIT_MINUTE = 60,      /**< Alarm time unit in minutes */
276     CALENDAR_ALARM_TIME_UNIT_HOUR = 3600,      /**< Alarm time unit in hours */
277     CALENDAR_ALARM_TIME_UNIT_DAY = 86400,      /**< Alarm time unit in days */
278     CALENDAR_ALARM_TIME_UNIT_WEEK = 604800,    /**< Alarm time unit in weeks */
279     CALENDAR_ALARM_TIME_UNIT_MONTH = 18144000, /**< Alarm time unit in months */
280 } calendar_alarm_time_unit_type_e;
281
282 /**
283  * @brief Enumerations of the frequency of event recurrence.
284  */
285 typedef enum
286 {
287     CALENDAR_RECURRENCE_NONE,           /**< No recurrence event */
288     CALENDAR_RECURRENCE_DAILY,          /**< A Event occurs every day */
289     CALENDAR_RECURRENCE_WEEKLY,         /**< A Event occurs on the same day of every week \n According to week flag, the event will recurrence every days of week */
290     CALENDAR_RECURRENCE_MONTHLY,        /**< A Event occurs on the same day of every month */
291     CALENDAR_RECURRENCE_YEARLY         /**< A Event occurs on the same day of every year */
292 } calendar_recurrence_frequency_e;
293
294 /**
295  * @brief Enumerations of status for event.
296  */
297 typedef enum
298 {
299     CALENDAR_EVENT_STATUS_NONE          = 0x01,         /**< None */
300     CALENDAR_EVENT_STATUS_TENTATIVE     = 0x02,         /**< The event is tentative */
301     CALENDAR_EVENT_STATUS_CONFIRMED     = 0x04,         /**< The event is confirmed */
302     CALENDAR_EVENT_STATUS_CANCELLED     = 0x08          /**< The event is cancelled */
303 }calendar_event_status_e;
304
305 /**
306  * @brief Enumerations of busy status for event.
307  */
308 typedef enum
309 {
310     CALENDAR_EVENT_BUSY_STATUS_FREE = 0,                /**< The free status */
311     CALENDAR_EVENT_BUSY_STATUS_BUSY,                    /**< The busy status */
312     CALENDAR_EVENT_BUSY_STATUS_UNAVAILABLE,             /**< The unavailable status */
313     CALENDAR_EVENT_BUSY_STATUS_TENTATIVE                /**< The tentative status */
314 }calendar_event_busy_status_e;
315 /**
316  * @brief Calendar event item priority
317  */
318 typedef enum
319 {
320     CALENDAR_EVENT_PRIORITY_LOW          = 0,   /**< Low priority */
321     CALENDAR_EVENT_PRIORITY_NORMAL,                             /**< Normal priority */
322     CALENDAR_EVENT_PRIORITY_HIGH                                /**< High priority */
323 } calendar_event_priority_e;
324
325 /**
326  * @brief Calendar to-do item priority
327  */
328 typedef enum
329 {
330         CALENDAR_TODO_PRIORITY_NONE                     = 0x01, /**< Priority none */
331     CALENDAR_TODO_PRIORITY_LOW          = 0x08, /**< Low priority */
332     CALENDAR_TODO_PRIORITY_NORMAL               = 0x04, /**< Normal priority */
333     CALENDAR_TODO_PRIORITY_HIGH                 = 0x02, /**< High priority */
334 } calendar_todo_priority_e;
335
336 /**
337  * @brief Enumerations of status for to-do.
338  */
339 typedef enum
340 {
341     CALENDAR_TODO_STATUS_NONE                   = 0x0100,       /**< None */
342     CALENDAR_TODO_STATUS_NEEDS_ACTION   = 0x0200,       /**< Needs action status */
343     CALENDAR_TODO_STATUS_COMPLETED              = 0x0400,       /**< Completed status */
344     CALENDAR_TODO_STATUS_IN_PROCESS             = 0x0800,       /**< Work in process status */
345     CALENDAR_TODO_STATUS_CANCELED               = 0x1000        /**< Canceled status */
346 } calendar_todo_status_e;
347
348 typedef enum
349 {
350         CALENDAR_TIME_UTIME = 0,                        /**< . */
351         CALENDAR_TIME_LOCALTIME,                        /**< . */
352 } calendar_time_type_e;
353
354 typedef enum
355 {
356         CALENDAR_RANGE_UNTIL,           /**< . */
357         CALENDAR_RANGE_COUNT,           /**< . */
358         CALENDAR_RANGE_NONE,            /**< . */
359 } calendar_range_type_e;
360
361 typedef enum
362 {
363     CALENDAR_SYSTEM_NONE,                                       /**< . */
364     CALENDAR_SYSTEM_GREGORIAN,                          /**< . */
365     CALENDAR_SYSTEM_EAST_ASIAN_LUNISOLAR,       /**< . */
366 } calendar_system_type_e;
367
368 typedef enum
369 {
370     CALENDAR_MEETING_STATUS_NOTMEETING = 0,     /**< . */
371     CALENDAR_MEETING_STATUS_MEETING,            /**< . */
372     CALENDAR_MEETING_STATUS_RECEIVED,           /**< . */
373     CALENDAR_MEETING_STATUS_CANCELED,           /**< . */
374 } calendar_meeting_status_e;
375
376 /**
377  * @brief Enumerations of weekday of month(Same value as UCalendarDaysOfWeek in ICU).
378  */
379 typedef enum
380 {
381         CALENDAR_SUNDAY = 1,
382         CALENDAR_MONDAY,
383         CALENDAR_TUESDAY,
384         CALENDAR_WEDNESDAY,
385         CALENDAR_THURSDAY,
386         CALENDAR_FRIDAY,
387         CALENDAR_SATURDAY,
388 }calendar_days_of_week_e;
389
390 // deprecated
391 #define CALENDAR_EVENT_MODIFIED_STATUS_INSERTED 0
392 #define CALENDAR_EVENT_MODIFIED_STATUS_UPDATED  1
393 #define CALENDAR_EVENT_MODIFIED_STATUS_DELETED  2
394 /**
395  * @brief Enumerations of modified status for record.
396  */
397 typedef enum
398 {
399     CALENDAR_RECORD_MODIFIED_STATUS_INSERTED = 0,    /**< The record is inserted */
400     CALENDAR_RECORD_MODIFIED_STATUS_UPDATED,            /**< The record is updated */
401     CALENDAR_RECORD_MODIFIED_STATUS_DELETED          /**< The record is deleted */
402 }calendar_record_modified_status_e;
403
404 /**
405  * @brief The structure of time
406  */
407 typedef struct
408 {
409     calendar_time_type_e type;
410     union {
411         long long int utime;
412         struct {
413             int year;
414             int month;
415             int mday;
416         }date;
417     }time;
418 }calendar_time_s;
419
420 /**
421  * @brief Enumerations of type for record.
422  */
423 typedef enum
424 {
425     CALENDAR_RECORD_TYPE_NONE = 0,          /**< . */
426     CALENDAR_RECORD_TYPE_CALENDAR_BOOK,     /**< . */
427     CALENDAR_RECORD_TYPE_EVENT,             /**< . */
428     CALENDAR_RECORD_TYPE_TODO,              /**< . */
429 }calendar_record_type_e;
430
431 /**
432  * @}
433  */
434
435 #ifdef __cplusplus
436 }
437 #endif
438
439 #endif //__TIZEN_SOCIAL_CALENDAR_TYPES_H__