// SPDX-FileCopyrightText: 2025 Prayag Jain <prayagjain2@gmail.com>
//
// SPDX-License-Identifier: GPL-3.0-or-later

#pragma once
#include "libdrawywidgets_private_export.h"
#include <QCursor>

#include "properties/property.hpp"
class ApplicationContext;

// INTERFACE
class LIBDRAWYWIDGETS_TESTS_EXPORT Tool
{
public:
    explicit Tool(ApplicationContext *m_context);
    virtual ~Tool();

    [[nodiscard]] const QCursor &cursor() const;

    virtual void mousePressed(ApplicationContext *context);
    virtual void mouseMoved(ApplicationContext *context);
    virtual void mouseReleased(ApplicationContext *context);
    virtual void keyPressed(ApplicationContext *context);
    virtual void keyReleased(ApplicationContext *context);
    virtual void mouseDoubleClick(ApplicationContext *context);
    virtual void mouseTripleClick(ApplicationContext *context);
    virtual void leave(ApplicationContext *context);
    virtual void tablet(ApplicationContext *context);

    virtual void cleanup();

    enum class Type : int8_t {
        Selection = 0,
        Freeform,
        PolygonDrawing,
        Eraser,
        Move,
        Rectangle,
        Ellipse,
        Line,
        Arrow,
        Text,
        Diamond,
        Image,
        Custom,
    };

    virtual Type type() const = 0;
    virtual QString icon() const = 0;
    [[nodiscard]] virtual bool useCustomIcon() const;

    virtual QList<Property::Type> properties() const;
    virtual QList<Property::Type> allProperties() const final;

protected:
    QCursor m_cursor{};
    QList<Property::Type> m_properties;
    ApplicationContext *const m_context;
};
