#ifndef SBK_FREEBUSYWRAPPER_H
#define SBK_FREEBUSYWRAPPER_H

// Workaround to access protected functions
#ifndef protected
#  define protected public
#endif

#include <freebusy.h>

#include <sbkpython.h>

#include <array>
namespace Shiboken { struct AutoDecRef; class GilState; }

class FreeBusyWrapper : public KCalendarCore::FreeBusy
{
public:
    FreeBusyWrapper();
    FreeBusyWrapper(const ::QDateTime & start, const ::QDateTime & end);
    FreeBusyWrapper(const ::QList<KCalendarCore::FreeBusyPeriod> & busyPeriods);
    FreeBusyWrapper(const ::QList<KCalendarCore::Period> & busyPeriods);
    FreeBusyWrapper(const FreeBusyWrapper &) = delete;
    FreeBusyWrapper(const KCalendarCore::FreeBusy& self) : KCalendarCore::FreeBusy(self)
    {
    }
    FreeBusyWrapper& operator=(const FreeBusyWrapper &) = delete;
    FreeBusyWrapper(FreeBusyWrapper &&) = delete;
    FreeBusyWrapper& operator=(FreeBusyWrapper &&) = delete;
    ~FreeBusyWrapper() override;

    void customPropertyUpdate() override;
    void customPropertyUpdated() override;
    ::QDateTime dateTime(::KCalendarCore::IncidenceBase::DateTimeRole role) const override;
    void deserialize(::QDataStream & in) override;
    ::QDateTime dtEnd() const override;
    ::QDateTime dtStart() const override;
    bool equals(const ::KCalendarCore::IncidenceBase & freebusy) const override;
    ::QLatin1String mimeType() const override;
    ::QDateTime recurrenceId() const override;
    void serialize(::QDataStream & out) const override;
    void setAllDay(bool allDay) override;
    void setDateTime(const ::QDateTime & dateTime, ::KCalendarCore::IncidenceBase::DateTimeRole role) override;
    void setDtStart(const ::QDateTime & start) override;
    void setDuration(const ::KCalendarCore::Duration & duration) override;
    void setLastModified(const ::QDateTime & lm) override;
    void setReadOnly(bool readOnly) override;
    void shiftTimes(const ::QTimeZone & oldZone, const ::QTimeZone & newZone) override;
    ::KCalendarCore::IncidenceBase::IncidenceType type() const override;
    ::QByteArray typeStr() const override;
    void virtual_hook(::KCalendarCore::IncidenceBase::VirtualHook id, void * data) override;
    static void pysideInitQtMetaTypes();

    void resetPyMethodCache();

private:
    mutable std::array<PyObject *, 20> m_PyMethodCache = {nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr};
};

#endif // SBK_FREEBUSYWRAPPER_H
