// calendarviewwidget.h
#ifndef CALENDARVIEWWIDGET_H
#define CALENDARVIEWWIDGET_H

#include <QWidget>
#include <QList>
#include <QDate>
#include <QTextCharFormat> // For highlighting calendar dates

#include "event.h" // Include your Event class

// Forward declaration of the Ui namespace from Qt Designer
namespace Ui {
class CalendarViewWidget;
}

class CalendarViewWidget : public QWidget
{
    Q_OBJECT

public:
    explicit CalendarViewWidget(QWidget *parent = nullptr);
    ~CalendarViewWidget();

    // Call this to explicitly refresh the calendar display, e.g., after loading new events
    void refreshCalendarDisplay();

private slots:
    void on_calendarWidget_clicked(const QDate& date);

private:
    void loadEventsFromJson(const QString& filePath);
    void updateCalendarHighlights();

    Ui::CalendarViewWidget *ui; // Pointer to the UI generated by Qt Designer
    QList<Event> m_events;      // List to store loaded events
    QString m_eventsFilePath = "datos_planner.json"; // Default path for datos_planner.json
};

#endif // CALENDARVIEWWIDGET_H
