/*
    SPDX-FileCopyrightText: 2013 David Faure <faure@kde.org>

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

#pragma once

#include "akonadicore_export.h"
#include "collection.h"
#include "specialcollections.h"
#include <KCompositeJob>

#include <memory>

namespace Akonadi
{
class SpecialCollectionsDiscoveryJobPrivate;

/*!
 * \brief A job to discover all SpecialCollections.
 *
 * The collections get registered into SpecialCollections.
 *
 * This class is not meant to be used directly but as a base class for type
 * specific special collection request jobs.
 *
 * \author David Faure <faure@kde.org>
 * \since 4.11
 *
 * \class Akonadi::SpecialCollectionsDiscoveryJob
 * \inheaderfile Akonadi/SpecialCollectionsDiscoveryJob
 * \inmodule AkonadiCore
 */
class AKONADICORE_EXPORT SpecialCollectionsDiscoveryJob : public KCompositeJob
{
    Q_OBJECT

public:
    /*!
     * Destroys the special collections request job.
     */
    ~SpecialCollectionsDiscoveryJob() override;

    void start() override;

protected:
    /*!
     * Creates a new special collections request job.
     *
     * \a collections The SpecialCollections object that shall be used.
     * \a parent The parent object.
     */
    explicit SpecialCollectionsDiscoveryJob(SpecialCollections *collections, const QStringList &mimeTypes, QObject *parent = nullptr);

    /* reimpl */
    void slotResult(KJob *job) override;

private:
    std::unique_ptr<SpecialCollectionsDiscoveryJobPrivate> const d;
};

} // namespace Akonadi
