#pragma once

#include <QWidget>
#include <QToolButton>
#include <QTextBrowser>

class CollapsibleSection final : public QWidget {
    Q_OBJECT

public:
    explicit CollapsibleSection(
        const QString &title,
        const QString &markdownContent,
        QWidget *parent = nullptr,
        bool expanded = false
    );

private slots:
    void onToggled(bool checked) const;

private:
    QToolButton *m_toggleButton;
    QTextBrowser *m_contentBrowser;

    void updateContentHeight() const;

    bool eventFilter(QObject *watched, QEvent *event) override;
};
