/*
   SPDX-FileCopyrightText: 2012-2020 Laurent Montel <montel@kde.org>

   SPDX-License-Identifier: GPL-2.0-or-later
*/

#ifndef ABSTRACTADDRESSBOOK_H
#define ABSTRACTADDRESSBOOK_H

#include <AkonadiCore/Collection>
#include "abstractbase.h"
#include "libimportwizard_export.h"

namespace KContacts {
class Addressee;
class ContactGroup;
}

class KJob;
namespace LibImportWizard {
class LIBIMPORTWIZARD_EXPORT AbstractAddressBook : public LibImportWizard::AbstractBase
{
    Q_OBJECT
public:
    AbstractAddressBook();
    ~AbstractAddressBook() override;

protected:
    void createGroup(const KContacts::ContactGroup &group);
    void createContact(const KContacts::Addressee &address);

    void addImportInfo(const QString &log) override;
    void addImportError(const QString &log) override;

    void addAddressBookImportInfo(const QString &log);
    void addAddressBookImportError(const QString &log);
    void cleanUp();
    void addImportContactNote(KContacts::Addressee &address, const QString &applicationName);

private:
    void slotStoreDone(KJob *job);
    bool selectAddressBook();
    Akonadi::Collection mCollection;
};
}
#endif // ABSTRACTADDRESSBOOK_H
