/*
Copyright 2014 Canonical Ltd.

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License, version 3
as published by the Free Software Foundation.

This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public
License along with this program.  If not, see
<http://www.gnu.org/licenses/>.
*/

#ifndef POSTAL_CLIENT_H
#define POSTAL_CLIENT_H

#include <QObject>
#include <QString>

class QDBusPendingCallWatcher;

class PostalClient : public QObject
{
    Q_OBJECT

    enum ClearPersistentMode {
        ClearPersistentList_List, // 24.04-1.1 and up
        ClearPersistent_MultiArgs, // 20.04 and older
        ClearPersistent_List, // 24.04-1.0 only (broken interim state)
    };
public:
    PostalClient(QString appId);

    void clearPersistent(const QStringList &tags);
    void setCount(int count);

private:
    void call_clearPersistentList_list(const QStringList &tags);
    void call_clearPersistent_multiArgs(const QStringList &tags);
    void call_clearPersistent_list(const QStringList &tags);

private slots:
    void setCountFinished(QDBusPendingCallWatcher *watcher);
    void clearPersistentList_list_finished(QDBusPendingCallWatcher *watcher, const QStringList & tags);
    void clearPersistent_multiArgs_finished(QDBusPendingCallWatcher *watcher, const QStringList & tags);
    void clearPersistent_list_finished(QDBusPendingCallWatcher *watcher);

private:
    QString m_appId;
    QString m_pkgName;
    ClearPersistentMode m_clearPersistentMode = ClearPersistentList_List;
};
#endif // POSTAL_CLIENT.H
