#pragma once

#include "../databasemanager.h"
#include <QVector>
#include <optional>
#include "common_structs.h"

class CategoryDao
{
public:
    static bool insert(Category& cat);
    static bool update(const Category& cat);
    static bool remove(qint64 id);
    static std::optional<Category> findById(qint64 id);
    static QVector<Category> findByAccount(qint64 accountId);
    static QVector<Category> findGlobal();
    static QVector<Category> findAll();
    static QVector<Category> findChildren(qint64 parentId);
    static bool assignToMail(qint64 mailId, qint64 categoryId);
    static bool removeFromMail(qint64 mailId, qint64 categoryId);
    static QVector<qint64> categoriesForMail(qint64 mailId);  // Returns category IDs
    static bool reorder(const QVector<qint64>& ids);
};