/*
    SPDX-FileCopyrightText: 2015 Martin Gräßlin <mgraesslin@kde.org>
    SPDX-FileCopyrightText: 2015 Marco Martin <mart@kde.org>

    SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
*/
#pragma once

#include "kwin_export.h"

#include "core/region.h"

#include <memory>
#include <optional>

#include <QColor>
#include <QObject>

struct wl_resource;

namespace KWin
{
class Display;
class ContrastManagerInterfacePrivate;
class ContrastInterfacePrivate;

/**
 * @brief Represents the Global for org_kde_kwin_contrast_manager interface.
 *
 * This class creates ContrastInterfaces and attaches them to SurfaceInterfaces.
 *
 * @see ContrastInterface
 * @see SurfaceInterface
 */
class KWIN_EXPORT ContrastManagerInterface : public QObject
{
    Q_OBJECT

public:
    explicit ContrastManagerInterface(Display *display, QObject *parent = nullptr);
    ~ContrastManagerInterface() override;

    void remove();

private:
    std::unique_ptr<ContrastManagerInterfacePrivate> d;
};

/**
 * @brief Represents the Resource for the org_kde_kwin_contrast interface.
 *
 * Instances of this class are only generated by the ContrastManagerInterface.
 * The ContrastInterface gets attached to a SurfaceInterface and can be assessed
 * from there using @link SurfaceInterface::contrast() @endlink. Please note that
 * the ContrastInterface is only available on the SurfaceInterface after it has been
 * committed.
 *
 * @see ContrastManagerInterface
 * @see SurfaceInterface
 */
class KWIN_EXPORT ContrastInterface : public QObject
{
    Q_OBJECT
public:
    ~ContrastInterface() override;

    Region region() const;
    qreal contrast() const;
    qreal intensity() const;
    qreal saturation() const;
    QColor frost() const;

private:
    explicit ContrastInterface(wl_resource *resource);
    friend class ContrastManagerInterfacePrivate;

    std::unique_ptr<ContrastInterfacePrivate> d;
};

}
