// SPDX-FileCopyrightText: 2024 KylinSoft Co., Ltd.
//
// SPDX-License-Identifier: GPL-1.0-or-later

#pragma once

#include <QtWaylandClient/private/qwayland-ukui-effect-v1.h>

#include <QPair>
#include <QList>
#include <QVector4D>

namespace QtWaylandClient
{

class QWaylandAnimationCurveV1;
class QWaylandFadeEffectV1;
class QWaylandSlideEffectV1;

class QWaylandUkuiEffectV1 : public QtWayland::ukui_effect_v1
{
public:
    QWaylandUkuiEffectV1(struct ::wl_registry *registry, uint32_t id, uint32_t availableVersion);
    ~QWaylandUkuiEffectV1() override;

    QWaylandAnimationCurveV1 *createAnimationCurve(uint32_t x1, uint32_t y1, uint32_t x2, uint32_t y2);
    QWaylandFadeEffectV1 *createFadeEffect(struct ::wl_surface *surface, uint32_t stage);
    QWaylandSlideEffectV1 *createSlideEffect(struct ::wl_surface *surface, uint32_t stage);

protected:
    void ukui_effect_v1_builtin_animation_curves(struct ::animation_curve_v1 *animation, uint32_t x1, uint32_t y1, uint32_t x2, uint32_t y2) override;
    void ukui_effect_v1_done() override;

private:
    QList<QPair<QVector4D, QWaylandAnimationCurveV1 *>> m_animationCurves;
    bool m_done = false;
};

class QWaylandAnimationCurveV1 : public QtWayland::animation_curve_v1
{
public:
    QWaylandAnimationCurveV1(::animation_curve_v1 *curve);
    ~QWaylandAnimationCurveV1() override;
};

class QWaylandFadeEffectV1 : public QtWayland::fade_effect_v1
{
public:
    QWaylandFadeEffectV1(::fade_effect_v1 *effect);
    ~QWaylandFadeEffectV1() override;
};

class QWaylandSlideEffectV1 : public QtWayland::slide_effect_v1
{
public:
    QWaylandSlideEffectV1(::slide_effect_v1 *effect);
    ~QWaylandSlideEffectV1() override;
};


} // namespace QtWaylandClient
