10fbfc30aSopenharmony_ci/*
20fbfc30aSopenharmony_ci * Copyright (c) 2023 Huawei Device Co., Ltd.
30fbfc30aSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
40fbfc30aSopenharmony_ci * you may not use this file except in compliance with the License.
50fbfc30aSopenharmony_ci * You may obtain a copy of the License at
60fbfc30aSopenharmony_ci *
70fbfc30aSopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
80fbfc30aSopenharmony_ci *
90fbfc30aSopenharmony_ci * Unless required by applicable law or agreed to in writing, software
100fbfc30aSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
110fbfc30aSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
120fbfc30aSopenharmony_ci * See the License for the specific language governing permissions and
130fbfc30aSopenharmony_ci * limitations under the License.
140fbfc30aSopenharmony_ci */
150fbfc30aSopenharmony_ci
160fbfc30aSopenharmony_ci#ifndef NATIVE_CALENDAR_H
170fbfc30aSopenharmony_ci#define NATIVE_CALENDAR_H
180fbfc30aSopenharmony_ci#include <vector>
190fbfc30aSopenharmony_ci#include "calendar_define.h"
200fbfc30aSopenharmony_ci#include "event_filter.h"
210fbfc30aSopenharmony_ci#include "uri.h"
220fbfc30aSopenharmony_ciusing Uri = OHOS::Uri;
230fbfc30aSopenharmony_cinamespace OHOS::CalendarApi::Native {
240fbfc30aSopenharmony_ciclass Calendar final {
250fbfc30aSopenharmony_cipublic:
260fbfc30aSopenharmony_ci    Calendar(int id);
270fbfc30aSopenharmony_ci    Calendar(CalendarAccount account, int id);
280fbfc30aSopenharmony_ci    Calendar(Calendar&& other) : m_account(std::move(other.m_account)), m_id(other.m_id)
290fbfc30aSopenharmony_ci    {
300fbfc30aSopenharmony_ci    }
310fbfc30aSopenharmony_ci    Calendar(const Calendar& other) : m_account(other.m_account), m_id(other.m_id)
320fbfc30aSopenharmony_ci    {
330fbfc30aSopenharmony_ci    }
340fbfc30aSopenharmony_ci
350fbfc30aSopenharmony_ci    Calendar() = delete;
360fbfc30aSopenharmony_ci    ~Calendar() = default;
370fbfc30aSopenharmony_ci    int AddEvent(const Event& event);
380fbfc30aSopenharmony_ci    int AddEvents(const std::vector<Event>& events);
390fbfc30aSopenharmony_ci    bool DeleteEvent(int id);
400fbfc30aSopenharmony_ci    int DeleteEvents(const std::vector<int>& id);
410fbfc30aSopenharmony_ci    void DeleteAllEvents();
420fbfc30aSopenharmony_ci    bool UpdateEvent(const Event& event);
430fbfc30aSopenharmony_ci    int UpdateEvents(const std::vector<Event>& events);
440fbfc30aSopenharmony_ci    CalendarConfig GetConfig();
450fbfc30aSopenharmony_ci    bool SetConfig(const CalendarConfig& config);
460fbfc30aSopenharmony_ci    std::vector<Event> GetEvents(std::shared_ptr<EventFilter> filter, const std::vector<string>& eventKey);
470fbfc30aSopenharmony_ci    std::vector<Attendee> GetAttendeesByEventId(int id);
480fbfc30aSopenharmony_ci    std::optional<std::vector<int>> GetRemindersByEventId(int id);
490fbfc30aSopenharmony_ci    void InsertReminders(int eventId, vector<int> reminders);
500fbfc30aSopenharmony_ci    int AddEventInfo(const Event& event, int channelId);
510fbfc30aSopenharmony_ci    CalendarAccount GetAccount() const
520fbfc30aSopenharmony_ci    {
530fbfc30aSopenharmony_ci        return m_account;
540fbfc30aSopenharmony_ci    }
550fbfc30aSopenharmony_ci    int GetId() const
560fbfc30aSopenharmony_ci    {
570fbfc30aSopenharmony_ci        return m_id;
580fbfc30aSopenharmony_ci    }
590fbfc30aSopenharmony_ciprivate:
600fbfc30aSopenharmony_ci    CalendarAccount m_account;
610fbfc30aSopenharmony_ci    CalendarConfig m_config;
620fbfc30aSopenharmony_ci    int m_id;
630fbfc30aSopenharmony_ci    std::unique_ptr<Uri> m_eventUri;
640fbfc30aSopenharmony_ci    std::unique_ptr<Uri> m_attendeeUri;
650fbfc30aSopenharmony_ci    std::unique_ptr<Uri> m_calendarUri;
660fbfc30aSopenharmony_ci    std::unique_ptr<Uri> m_reminderUrl;
670fbfc30aSopenharmony_ci};
680fbfc30aSopenharmony_ci}  // namespace OHOS::Calendar
690fbfc30aSopenharmony_ci#endif  //  NATIVE_CALENDAR_H