/**
 *
 * @copyright Copyright (c) 2018-2021, ownCloud GmbH
 * @license OCL
 * @author Christian Kamm mail@ckamm.de
 * @author Hannah von Reth hannah.vonreth@owncloud.com
 *
 * This code is covered by the ownCloud Commercial License.
 *
 * You should have received a copy of the ownCloud Commercial License
 * along with this program. If not, see <https://owncloud.com/licenses/owncloud-commercial/>.
 *
 */
#pragma once

#include <QObject>
#include <QScopedPointer>

#include "common/vfs.h"
#include "common/plugin.h"

namespace OCC {

class VfsWinPrivate;

class VfsWin : public Vfs
{
    Q_OBJECT
    Q_DECLARE_PRIVATE(VfsWin)
    const QScopedPointer<VfsWinPrivate> d_ptr;

public:
    explicit VfsWin(QObject *parent = nullptr);
    ~VfsWin();

    Mode mode() const override;
    QString fileSuffix() const override { return QString(); }

    void stop() override;
    void unregisterFolder() override;

    [[nodiscard]] bool socketApiPinStateActionsShown() const override { return false; }

    [[nodiscard]] Result<void, QString> createPlaceholder(const SyncFileItem &item) override;

    /// Returns true for files that aren't placeholders yet
    [[nodiscard]] bool needsMetadataUpdate(const SyncFileItem &item) override;

    [[nodiscard]] bool isDehydratedPlaceholder(const QString &filePath) override;
    [[nodiscard]] bool statTypeVirtualFile(csync_file_stat_t *stat, void *stat_data) override;

    // Pin states exist as file attributes on disk
    [[nodiscard]] bool setPinState(const QString &relFilePath, PinState state) override;
    [[nodiscard]] Optional<PinState> pinState(const QString &filePath) override;

    [[nodiscard]] AvailabilityResult availability(const QString &folderPath) override;

public slots:
    void fileStatusChanged(const QString &systemFileName, SyncFileStatus status) override;

protected:
    [[nodiscard]] Result<ConvertToPlaceholderResult, QString> updateMetadata(const SyncFileItem &item, const QString &filePath, const QString &replacesFile = {}) override;
    void startImpl(const VfsSetupParams &params) override;
};



} // namespace OCC
