/* * Copyright (c) 2022 Huawei Device Co., Ltd. * 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 CALENDAR_DEFINE_H #define CALENDAR_DEFINE_H #include #include #include #include #include using std::string; using std::string_view; using std::vector; using std::optional; using std::variant; namespace OHOS::CalendarApi { struct CalendarAccount { std::string name; // readonly std::string type; optional displayName; }; enum EventType { Normal = 0, Important = 1 }; struct Location { optional location; optional longitude; optional latitude; bool operator==(const Location& other) const { return location == other.location && longitude == other.longitude && latitude == other.latitude; } }; struct Attendee { string name; string email; bool operator==(const Attendee& other) const { return name == other.name && email == other.email; } }; enum RecurrenceType { YEARLY = 0, MONTHLY = 1, WEEKLY = 2, DAILY = 3, }; struct RecurrenceRule { RecurrenceType recurrenceFrequency; optional enable; optional expire; }; struct EventService { string type; string uri; optional description; }; struct Event { optional id; EventType type; optional location; optional title; int64_t startTime; int64_t endTime; optional isAllDay; vector attendees; optional timeZone; optional> reminderTime; optional recurrenceRule; optional description; optional service; }; struct CalendarConfig { optional enableReminder; variant color; bool operator==(const CalendarConfig& other) const { return enableReminder == other.enableReminder && color == other.color; } }; } // namespace OHOS::CalendarApi #endif