#ifndef MIMESTORAGESERVICE_H
#define MIMESTORAGESERVICE_H

#include <QObject>
#include <QString>
#include <QDir>
#include <QFile>
#include "core/mailitem.h"

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

    QString saveEmlFile(const QString &accountId, const QString &folderId, const MailItem &mail);
    QString getEmlFilePath(const QString &fileId) const;
    QByteArray readEmlFile(const QString &fileId) const;
    bool deleteEmlFile(const QString &fileId);

    QStringList listAttachments(const QString &mailItemId) const;
    bool saveAttachment(const QString &mailItemId, const QString &fileName, const QByteArray &data);

private:
    QString storagePath() const;
    QString ensureDirectory(const QString &path) const;
};

#endif // MIMESTORAGESERVICE_H
