#ifndef EMAILMANAGER_H
#define EMAILMANAGER_H

#include <QObject>
#include <QDateTime>
#include <QVector>
#include "core/mailitem.h"

class EmailManager : public QObject
{
    Q_OBJECT
public:
    explicit EmailManager(QObject *parent = nullptr);
    ~EmailManager() override = default;

    // Returns a MailItem by id, or null if not found
    Q_INVOKABLE MailItem getMailItemById(qint64 id) const;

    // Returns the storage directory for .eml files
    Q_INVOKABLE QString getStorageDirectory() const;

    // Returns the HTML content of an email by its ID
    Q_INVOKABLE QString getEmailHtmlById(qint64 id) const;

    // Converts an .eml file to HTML string
    QString convertEmlToHtml(const QString& emlFilePath) const;

    // Sends an email with the given parameters
    // Returns true if the email was successfully queued for sending
    Q_INVOKABLE bool sendEmail(const QString& to, const QString& subject, const QString& body);

private:
    // We'll use the DAO directly
    // TODO: We might need access to synchronizer or request processor in the future
};

#endif // EMAILMANAGER_H