#ifndef QT_WAYLAND_IVI_APPLICATION
#define QT_WAYLAND_IVI_APPLICATION

#include "wayland-ivi-application-client-protocol.h"
#include <QByteArray>
#include <QString>

struct wl_registry;

QT_BEGIN_NAMESPACE
QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC("-Wmissing-field-initializers")

namespace QtWayland {
    class  ivi_surface
    {
    public:
        ivi_surface(struct ::wl_registry *registry, int id, int version);
        ivi_surface(struct ::ivi_surface *object);
        ivi_surface();

        virtual ~ivi_surface();

        void init(struct ::wl_registry *registry, int id, int version);
        void init(struct ::ivi_surface *object);

        struct ::ivi_surface *object() { return m_ivi_surface; }
        const struct ::ivi_surface *object() const { return m_ivi_surface; }
        static ivi_surface *fromObject(struct ::ivi_surface *object);

        bool isInitialized() const;

        static const struct ::wl_interface *interface();

        void destroy();

    protected:
        virtual void ivi_surface_configure(int32_t width, int32_t height);

    private:
        void init_listener();
        static const struct ivi_surface_listener m_ivi_surface_listener;
        static void handle_configure(
            void *data,
            struct ::ivi_surface *object,
            int32_t width,
            int32_t height);
        struct ::ivi_surface *m_ivi_surface;
    };

    class  ivi_application
    {
    public:
        ivi_application(struct ::wl_registry *registry, int id, int version);
        ivi_application(struct ::ivi_application *object);
        ivi_application();

        virtual ~ivi_application();

        void init(struct ::wl_registry *registry, int id, int version);
        void init(struct ::ivi_application *object);

        struct ::ivi_application *object() { return m_ivi_application; }
        const struct ::ivi_application *object() const { return m_ivi_application; }
        static ivi_application *fromObject(struct ::ivi_application *object);

        bool isInitialized() const;

        static const struct ::wl_interface *interface();

        enum error {
            error_role = 0, // given wl_surface has another role
            error_ivi_id = 1 // given ivi_id is assigned to another wl_surface
        };

        struct ::ivi_surface *surface_create(uint32_t ivi_id, struct ::wl_surface *surface);

    private:
        struct ::ivi_application *m_ivi_application;
    };
}

QT_WARNING_POP
QT_END_NAMESPACE

#endif
