/* * Mirai. Copyright (C) 2024 Vyn * This file is licensed under version 3 of the GNU General Public License (GPL-3.0-only) * The license can be found in the LICENSE file or at https://www.gnu.org/licenses/gpl-3.0.txt */ #ifndef MIRAI_BASE_RESOURCE_H #define MIRAI_BASE_RESOURCE_H #include "TaskItem.h" #include "mirai-core/DateTime.h" #include "mirai-core/Day.h" #include "mirai-core/Event.h" #include #include #include #include namespace mirai { class BaseResource { public: struct AddTaskData { std::string text; Tags tags; }; BaseResource(std::string name) : name_(name) {}; BaseResource(BaseResource &) = delete; BaseResource(BaseResource &&) = delete; virtual ~BaseResource() = default; virtual void save() = 0; virtual void load() = 0; void setName(std::string name) { this->name_ = name; } const std::string &getName() const { return name_; } void addDay(const DayData &dayData); Day *day(const Date &date); std::vector> *days(); TaskItem *getTaskById(int taskId); Event *getEventById(int eventId); void deleteTask(const TaskItem &task); void setDirty(bool shouldBeDirty); bool isDirty() const; int id() const { return id_; } private: static int nextId_; int id_ = nextId_++; std::string name_; std::vector> days_; bool isDirty_ = false; }; } // namespace mirai #endif