#pragma once

#include "Widget.hpp"

class ButtonWidget : public Widget {
public:
    explicit ButtonWidget(const WidgetConfig& config);
    ~ButtonWidget() override;

    lv_obj_t* create(lv_obj_t* parent) override;
    void applyStyle() override;

    // Check if button is in checked state
    bool isChecked() const;

private:
    lv_obj_t* contentContainer_ = nullptr;
    lv_obj_t* label_ = nullptr;
    lv_obj_t* iconLabel_ = nullptr;

    void setupFlexLayout();
    void applyTextAlignment();
    static int encodeUtf8(uint32_t codepoint, char* buf);
    static void clickCallback(lv_event_t* e);
};
