b593444cd959eacf2dd45110a8863a93b800ba50
[framework/web/wrt-plugins-tizen.git] / src / Calendar / CalendarEvent.h
1 //
2 // Tizen Web Device API
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 //
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
8 //
9 // http://www.apache.org/licenses/LICENSE-2.0
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 //
17
18
19 #ifndef _ABSTRACT_LAYER_CALENDAR_EVENT_H_
20 #define _ABSTRACT_LAYER_CALENDAR_EVENT_H_
21
22 #include <ctime>
23 #include <string>
24 #include <vector>
25 #include <dpl/shared_ptr.h>
26
27 #include "EventAlarm.h"
28 #include "EventAttendee.h"
29 #include "EventRecurrenceRule.h"
30
31 namespace DeviceAPI {
32 namespace Calendar {
33
34 #define UNDEFINED_CALENDAR_ID -1
35 #define UNDEFINED_ITEM_ID -1
36 #define UNDEFINED_GEO -1
37 #define UNDEFINED_ID "-1"
38
39 typedef std::vector<std::string> AttributeList;
40 typedef DPL::SharedPtr<AttributeList> AttributeListPtr;
41
42 /* This object represents a single calendar event */
43 class CalendarEvent
44 {
45   public:
46     typedef enum
47     {
48         TENTATIVE_STATUS,
49         CONFIRMED_STATUS,
50         CANCELLED_STATUS,
51         NEEDS_ACTION_STATUS,
52         IN_PROCESS_STATUS,
53         COMPLETED_STATUS,
54         UNDEFINED_STATUS
55     } EventStatus;
56
57     typedef enum
58     {
59         PUBLIC_VISIBILITY,
60         PRIVATE_VISIBILITY,
61         CONFIDENTIAL_VISIBILITY,
62         UNDEFINED_VISIBILITY
63     } EventVisibility;
64
65     typedef enum
66     {
67         BUSY_FB,
68         BUSY_UNAVAILABLE_FB,
69         FREE_FB,
70         BUSY_TENTATIVE_FB,
71         UNDEFINED_AVAILABILITY
72     } EventAvailability;
73
74     typedef enum
75     {
76         LOW_PRIORITY,
77         MEDIUM_PRIORITY,
78         HIGH_PRIORITY,
79         UNDEFINED_PRIORITY
80     } TaskPriority;
81
82     typedef enum
83     {
84         ICALENDAR_20,
85         VCALENDAR_10,
86         UNDEFINED_FORMAT
87     } VObjectFormat;
88
89     typedef enum
90     {
91         EVENT_TYPE = 0,
92         TASK_TYPE,
93         UNDEFINED_TYPE
94     } CalendarType;
95
96
97     CalendarEvent();
98     CalendarEvent(const CalendarEvent &original); // copy constructor for clone operation
99     virtual ~CalendarEvent();
100
101     int getId() const;
102     void setId(int value);
103     void resetId();
104     bool getIdIsSet() const;
105
106     int getParentId() const;
107     void setParentId(int value);
108
109     int getCalendarId() const;
110     void setCalendarId(int value);
111
112     std::string getDescription() const;
113     void setDescription(const std::string &value);
114
115     std::string getSubject() const;
116     void setSubject(const std::string &value);
117
118     long long int getStartTime() const;
119     void setStartTime(long long int value);
120
121     long long int getEndTime() const;
122     void setEndTime(long long int value);
123
124     std::string getLocation() const;
125     void setLocation(const std::string &value);
126
127     EventRecurrenceRulePtr getRecurrenceRule() const;
128     void setRecurrenceRule(EventRecurrenceRulePtr value);
129
130     EventStatus getStatus() const;
131     void setStatus(EventStatus value);
132
133     EventAlarmListPtr getAlarms() const;
134     void setAlarms(const EventAlarmListPtr value);
135
136     StringArrayPtr getCategories() const;
137     void setCategories(const StringArrayPtr value);
138
139     void display() const;
140     bool validate() const;
141
142     bool getIsAllDay() const;
143     void setIsAllDay(bool value);
144
145     long long int getLastModifiedDate() const;
146     void setLastModifiedDate(long long int value);
147
148     std::string getOrganizer() const;
149     void setOrganizer(const std::string &value);
150
151     EventVisibility getVisibility() const;
152     void setVisibility(EventVisibility value);
153
154     EventAvailability getAvailability() const;
155     void setAvailability(EventAvailability value);
156
157     std::string getUId() const;
158     void setUId(const std::string &value);
159
160     long long int getRecurrenceId() const;
161     void setRecurrenceId(long long int value);
162
163     EventAttendeeListPtr getAttendees() const;
164     void setAttendees(const EventAttendeeListPtr value);
165
166     bool getIsDetached() const;
167     void setIsDetached(bool value);
168
169     void setAttributesOfInterest(AttributeListPtr value);
170     AttributeListPtr getAttributesOfInterest() const;
171
172     double getLatitude() const;
173     void setLatitude(double value);
174
175     double getLongitude() const;
176     void setLongitude(double value);
177
178     void setTimeZone(std::string value);
179     std::string getTimeZone() const;
180
181     TaskPriority getPriority() const;
182     void setPriority(TaskPriority value);
183
184     long long int getCreatedDate() const;
185     void setCreatedDate(long long int value);
186
187     long long int getCompletedDate() const;
188     void setCompletedDate(long long int value);
189
190     int getProgress() const;
191     void setProgress(int value);
192
193     CalendarType getCalendarType() const;
194     void setCalendarType(CalendarType type);
195
196   protected:
197     int m_id;
198     int m_parentId; // the parent id if it's detached.
199     int m_calendarId;
200     std::string m_description;
201     std::string m_subject;
202     long long int m_startTime;
203     long long int m_endTime;
204     std::string m_location;
205     EventRecurrenceRulePtr m_recurrence;
206     EventStatus m_status;
207     EventAlarmListPtr m_alarms;
208     StringArrayPtr m_categories;
209     bool m_isAllDay;
210     std::string m_organizer;
211     long long int m_lastModifiedDate;
212     EventVisibility m_visibility;
213     EventAvailability m_availability;
214     std::string m_uid; // uid is same with id.
215     long long int m_recurrenceId;
216     EventAttendeeListPtr m_attendees;
217     bool m_isDetached;
218     AttributeListPtr m_attributesOfInterest;
219     double m_latitude;
220     double m_longitude;
221     std::string m_timeZone;
222     TaskPriority m_priority;
223     long long int m_createdDate;
224     long long int m_completedDate;
225     int m_progress;
226     CalendarType m_calendarType;
227 };
228
229 typedef DPL::SharedPtr<CalendarEvent> CalendarEventPtr;
230 typedef std::vector<CalendarEventPtr> CalendarEventList;
231 typedef DPL::SharedPtr<CalendarEventList> CalendarEventListPtr;
232
233 }
234 }
235
236 #endif /* _ABSTRACT_LAYER_CALENDAR_EVENT_H_ */
237