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

// default includes
#include <shiboken.h>
#include <sbkpep.h>
#include <sbkpepbuffer.h>

#define PYSIDE6_COMOPT_COMPRESS 1

#ifndef QT_NO_VERSION_TAGGING
#  define QT_NO_VERSION_TAGGING
#endif
#include <QtCore/QDebug>
#include <pysideqenum.h>
#include <pysideutils.h>
#include <feature_select.h>
QT_WARNING_DISABLE_DEPRECATED


// module include
#include "kcalendarcore_python.h"

// main header
#include "kcalendarcore_period_wrapper.h"

// Argument includes
#include <duration.h>
#include <period.h>
#include <qdatastream.h>
#include <qdatetime.h>
#include <qtimezone.h>

#include <cctype>
#include <cstring>
#include <iterator>
#include <type_traits>
#include <typeinfo>

using namespace KCalendarCore;

extern "C" {
static PyTypeObject *Sbk_KCalendarCore_Period_TypeF(void)
{
    return SbkKCalendarCoreTypeStructs[SBK_KCalendarCore_Period_IDX].type;
}
} // extern "C"


// Target ---------------------------------------------------------

extern "C" {
static int
Sbk_KCalendarCore_Period_Init(PyObject *self, PyObject *args, [[maybe_unused]] PyObject *kwds)
{
    auto *sbkSelf = reinterpret_cast<SbkObject *>(self);
    PySide::Feature::Select(self);
    if (Shiboken::Object::isUserType(self) && !Shiboken::ObjectType::canCallConstructor(self->ob_type, Shiboken::SbkType< ::KCalendarCore::Period >()))
        return -1;

    ::KCalendarCore::Period *cptr{};
    Shiboken::AutoDecRef errInfo{};
    Shiboken::PythonContextMarker pcm;
    int overloadId = -1;
    [[maybe_unused]] Shiboken::Conversions::PythonToCppConversion pythonToCpp[2];
    const Py_ssize_t numArgs = PyTuple_Size(args);
    SBK_UNUSED(numArgs)
    PyObject *pyArgs[] = {nullptr, nullptr};

    // invalid argument lengths

    if (PyArg_UnpackTuple(args, "Period", 0, 2, &(pyArgs[0]), &(pyArgs[1])) == 0)
        return -1;


    // Overloaded function decisor
    // 0: Period::Period()
    // 1: Period::Period(const KCalendarCore::Period&)
    // 2: Period::Period(const QDateTime&,const KCalendarCore::Duration&)
    // 3: Period::Period(const QDateTime&,const QDateTime&)
    if (numArgs == 0) {
        overloadId = 0; // Period()
    } else if (numArgs >= 1
        && (pythonToCpp[0] = Shiboken::Conversions::pythonToCppReferenceConversion(Shiboken::Module::get(SbkPySide6_QtCoreTypeStructs[SBK_QDateTime_IDX]), (pyArgs[0])))) {
        if (numArgs == 2
            && (pythonToCpp[1] = Shiboken::Conversions::pythonToCppReferenceConversion(Shiboken::Module::get(SbkPySide6_QtCoreTypeStructs[SBK_QDateTime_IDX]), (pyArgs[1])))) {
            overloadId = 3; // Period::Period(const QDateTime&,const QDateTime&)
        } else if (numArgs == 2
            && (pythonToCpp[1] = Shiboken::Conversions::pythonToCppReferenceConversion(Shiboken::Module::get(SbkKCalendarCoreTypeStructs[SBK_KCalendarCore_Duration_IDX]), (pyArgs[1])))) {
            overloadId = 2; // Period::Period(const QDateTime&,const KCalendarCore::Duration&)
        }
    } else if (numArgs == 1
        && (pythonToCpp[0] = Shiboken::Conversions::pythonToCppReferenceConversion(Shiboken::Module::get(SbkKCalendarCoreTypeStructs[SBK_KCalendarCore_Period_IDX]), (pyArgs[0])))) {
        overloadId = 1; // Period::Period(const KCalendarCore::Period&)
    }

    // Function signature not found.
    if (overloadId == -1)
        return Shiboken::returnWrongArguments_MinusOne(args, "__init__", SbkKCalendarCoreTypeStructs[SBK_KCalendarCore_Period_IDX]);


    // PyMI support
    Shiboken::callInheritedInit(self, args, kwds, SbkKCalendarCoreTypeStructs[SBK_KCalendarCore_Period_IDX]);
    if (Shiboken::Errors::occurred() != nullptr)
        return -1;

    // Call function/method
    switch (overloadId) {
        case 0: // Period()
        {

            // Period::Period()
            cptr = new ::KCalendarCore::Period();
            break;
        }
        case 1: // Period(const KCalendarCore::Period &period)
        {
            if (!Shiboken::Object::isValid(pyArgs[0]))
                return -1;
            ::KCalendarCore::Period cppArg0_local;
            ::KCalendarCore::Period *cppArg0 = &cppArg0_local;
            if (pythonToCpp[0].isValue())
                pythonToCpp[0](pyArgs[0], &cppArg0_local);
            else
                pythonToCpp[0](pyArgs[0], &cppArg0);


            if (Shiboken::Errors::occurred() == nullptr) {
                // Period::Period(const KCalendarCore::Period&)
                cptr = new ::KCalendarCore::Period(*cppArg0);
            }
            break;
        }
        case 2: // Period(const QDateTime &start, const KCalendarCore::Duration &duration)
        {
            if (!Shiboken::Object::isValid(pyArgs[0]))
                return -1;
            ::QDateTime cppArg0_local;
            ::QDateTime *cppArg0 = &cppArg0_local;
            if (pythonToCpp[0].isValue())
                pythonToCpp[0](pyArgs[0], &cppArg0_local);
            else
                pythonToCpp[0](pyArgs[0], &cppArg0);

            if (!Shiboken::Object::isValid(pyArgs[1]))
                return -1;
            ::KCalendarCore::Duration cppArg1_local;
            ::KCalendarCore::Duration *cppArg1 = &cppArg1_local;
            if (pythonToCpp[1].isValue())
                pythonToCpp[1](pyArgs[1], &cppArg1_local);
            else
                pythonToCpp[1](pyArgs[1], &cppArg1);


            if (Shiboken::Errors::occurred() == nullptr) {
                // Period::Period(const QDateTime&,const KCalendarCore::Duration&)
                cptr = new ::KCalendarCore::Period(*cppArg0, *cppArg1);
            }
            break;
        }
        case 3: // Period(const QDateTime &start, const QDateTime &end)
        {
            if (!Shiboken::Object::isValid(pyArgs[0]))
                return -1;
            ::QDateTime cppArg0_local;
            ::QDateTime *cppArg0 = &cppArg0_local;
            if (pythonToCpp[0].isValue())
                pythonToCpp[0](pyArgs[0], &cppArg0_local);
            else
                pythonToCpp[0](pyArgs[0], &cppArg0);

            if (!Shiboken::Object::isValid(pyArgs[1]))
                return -1;
            ::QDateTime cppArg1_local;
            ::QDateTime *cppArg1 = &cppArg1_local;
            if (pythonToCpp[1].isValue())
                pythonToCpp[1](pyArgs[1], &cppArg1_local);
            else
                pythonToCpp[1](pyArgs[1], &cppArg1);


            if (Shiboken::Errors::occurred() == nullptr) {
                // Period::Period(const QDateTime&,const QDateTime&)
                cptr = new ::KCalendarCore::Period(*cppArg0, *cppArg1);
            }
            break;
        }
    }

    if (Shiboken::Errors::occurred() != nullptr || !Shiboken::Object::setCppPointer(sbkSelf, Shiboken::SbkType< ::KCalendarCore::Period >(), cptr)) {
        delete cptr;
        return -1;
    }
    if (cptr == nullptr)
        return Shiboken::returnWrongArguments_MinusOne(args, "__init__", SbkKCalendarCoreTypeStructs[SBK_KCalendarCore_Period_IDX]);

    Shiboken::Object::setValidCpp(sbkSelf, true);
    Shiboken::BindingManager::instance().registerWrapper(sbkSelf, cptr);


    return 1;
}

static PyObject *Sbk_KCalendarCore_PeriodFunc_duration(PyObject *self, PyObject *args)
{
    if (!Shiboken::Object::isValid(self))
        return {};
    [[maybe_unused]] auto *cppSelf = reinterpret_cast< ::KCalendarCore::Period *>(Shiboken::Conversions::cppPointer(Shiboken::Module::get(SbkKCalendarCoreTypeStructs[SBK_KCalendarCore_Period_IDX]), reinterpret_cast<SbkObject *>(self)));
    PyObject *pyResult{};
    Shiboken::AutoDecRef errInfo{};
    Shiboken::PythonContextMarker pcm;
    int overloadId = -1;
    [[maybe_unused]] Shiboken::Conversions::PythonToCppConversion pythonToCpp[1];
    const Py_ssize_t numArgs = PyTuple_Size(args);
    SBK_UNUSED(numArgs)
    PyObject *pyArgs[] = {nullptr};

    // invalid argument lengths

    if (PyArg_UnpackTuple(args, "duration", 0, 1, &(pyArgs[0])) == 0)
        return {};


    // Overloaded function decisor
    // 0: Period::duration()const->KCalendarCore::Duration
    // 1: Period::duration(KCalendarCore::Duration::Type)const->KCalendarCore::Duration
    if (numArgs == 0) {
        overloadId = 0; // duration()const
    } else if (numArgs == 1
        && (pythonToCpp[0] = Shiboken::Conversions::pythonToCppConversion(Shiboken::Enum::getConverter(reinterpret_cast<SbkEnumType *>(Shiboken::Module::get(SbkKCalendarCoreTypeStructs[SBK_KCalendarCore_Duration_Type_IDX]))), (pyArgs[0])))) {
        overloadId = 1; // Period::duration(KCalendarCore::Duration::Type)const->KCalendarCore::Duration
    }

    // Function signature not found.
    if (overloadId == -1)
        return Shiboken::returnWrongArguments(args, "duration", SbkKCalendarCoreTypeStructs[SBK_KCalendarCore_Period_IDX]);

    // Call function/method
    switch (overloadId) {
        case 0: // duration() const
        {

            // Period::duration()const->KCalendarCore::Duration
            KCalendarCore::Duration cppResult = const_cast<const ::KCalendarCore::Period *>(cppSelf)->duration();
            pyResult = Shiboken::Conversions::copyToPython(Shiboken::Module::get(SbkKCalendarCoreTypeStructs[SBK_KCalendarCore_Duration_IDX]), &cppResult);
            break;
        }
        case 1: // duration(KCalendarCore::Duration::Type type) const
        {
            ::KCalendarCore::Duration::Type cppArg0{KCalendarCore::Duration::Seconds};
            pythonToCpp[0](pyArgs[0], &cppArg0);

            if (Shiboken::Errors::occurred() == nullptr) {
                // Period::duration(KCalendarCore::Duration::Type)const->KCalendarCore::Duration
                KCalendarCore::Duration cppResult = const_cast<const ::KCalendarCore::Period *>(cppSelf)->duration(cppArg0);
                pyResult = Shiboken::Conversions::copyToPython(Shiboken::Module::get(SbkKCalendarCoreTypeStructs[SBK_KCalendarCore_Duration_IDX]), &cppResult);
            }
            break;
        }
    }

    return Sbk_ReturnFromPython_Result(pyResult);
}

static PyObject *Sbk_KCalendarCore_PeriodFunc_end(PyObject *self)
{
    if (!Shiboken::Object::isValid(self))
        return {};
    [[maybe_unused]] auto *cppSelf = reinterpret_cast< ::KCalendarCore::Period *>(Shiboken::Conversions::cppPointer(Shiboken::Module::get(SbkKCalendarCoreTypeStructs[SBK_KCalendarCore_Period_IDX]), reinterpret_cast<SbkObject *>(self)));
    PyObject *pyResult{};
    Shiboken::PythonContextMarker pcm;

    // Call function/method
    {

        // Period::end()const->QDateTime
        QDateTime cppResult = const_cast<const ::KCalendarCore::Period *>(cppSelf)->end();
        pyResult = Shiboken::Conversions::copyToPython(Shiboken::Module::get(SbkPySide6_QtCoreTypeStructs[SBK_QDateTime_IDX]), &cppResult);
    }

    return Sbk_ReturnFromPython_Result(pyResult);
}

static PyObject *Sbk_KCalendarCore_PeriodFunc_hasDuration(PyObject *self)
{
    if (!Shiboken::Object::isValid(self))
        return {};
    [[maybe_unused]] auto *cppSelf = reinterpret_cast< ::KCalendarCore::Period *>(Shiboken::Conversions::cppPointer(Shiboken::Module::get(SbkKCalendarCoreTypeStructs[SBK_KCalendarCore_Period_IDX]), reinterpret_cast<SbkObject *>(self)));
    PyObject *pyResult{};
    Shiboken::PythonContextMarker pcm;

    // Call function/method
    {

        // Period::hasDuration()const->bool
        bool cppResult = const_cast<const ::KCalendarCore::Period *>(cppSelf)->hasDuration();
        pyResult = Shiboken::Conversions::copyToPython(Shiboken::Conversions::PrimitiveTypeConverter<bool>(), &cppResult);
    }

    return Sbk_ReturnFromPython_Result(pyResult);
}

static PyObject *Sbk_KCalendarCore_PeriodFunc_isValid(PyObject *self)
{
    if (!Shiboken::Object::isValid(self))
        return {};
    [[maybe_unused]] auto *cppSelf = reinterpret_cast< ::KCalendarCore::Period *>(Shiboken::Conversions::cppPointer(Shiboken::Module::get(SbkKCalendarCoreTypeStructs[SBK_KCalendarCore_Period_IDX]), reinterpret_cast<SbkObject *>(self)));
    PyObject *pyResult{};
    Shiboken::PythonContextMarker pcm;

    // Call function/method
    {

        // Period::isValid()const->bool
        bool cppResult = const_cast<const ::KCalendarCore::Period *>(cppSelf)->isValid();
        pyResult = Shiboken::Conversions::copyToPython(Shiboken::Conversions::PrimitiveTypeConverter<bool>(), &cppResult);
    }

    return Sbk_ReturnFromPython_Result(pyResult);
}

static PyObject *Sbk_KCalendarCore_PeriodFunc_shiftTimes(PyObject *self, PyObject *args)
{
    if (!Shiboken::Object::isValid(self))
        return {};
    [[maybe_unused]] auto *cppSelf = reinterpret_cast< ::KCalendarCore::Period *>(Shiboken::Conversions::cppPointer(Shiboken::Module::get(SbkKCalendarCoreTypeStructs[SBK_KCalendarCore_Period_IDX]), reinterpret_cast<SbkObject *>(self)));
    Shiboken::AutoDecRef errInfo{};
    Shiboken::PythonContextMarker pcm;
    int overloadId = -1;
    [[maybe_unused]] Shiboken::Conversions::PythonToCppConversion pythonToCpp[2];
    const Py_ssize_t numArgs = PyTuple_Size(args);
    SBK_UNUSED(numArgs)
    PyObject *pyArgs[] = {nullptr, nullptr};

    // invalid argument lengths

    if (PyArg_UnpackTuple(args, "shiftTimes", 2, 2, &(pyArgs[0]), &(pyArgs[1])) == 0)
        return {};


    // Overloaded function decisor
    // 0: Period::shiftTimes(const QTimeZone&,const QTimeZone&)
    if (numArgs == 2
        && (pythonToCpp[0] = Shiboken::Conversions::pythonToCppReferenceConversion(Shiboken::Module::get(SbkPySide6_QtCoreTypeStructs[SBK_QTimeZone_IDX]), (pyArgs[0])))
        && (pythonToCpp[1] = Shiboken::Conversions::pythonToCppReferenceConversion(Shiboken::Module::get(SbkPySide6_QtCoreTypeStructs[SBK_QTimeZone_IDX]), (pyArgs[1])))) {
        overloadId = 0; // Period::shiftTimes(const QTimeZone&,const QTimeZone&)
    }

    // Function signature not found.
    if (overloadId == -1)
        return Shiboken::returnWrongArguments(args, "shiftTimes", SbkKCalendarCoreTypeStructs[SBK_KCalendarCore_Period_IDX]);

    // Call function/method
    {
        if (!Shiboken::Object::isValid(pyArgs[0]))
            return {};
        ::QTimeZone cppArg0_local;
        ::QTimeZone *cppArg0 = &cppArg0_local;
        if (pythonToCpp[0].isValue())
            pythonToCpp[0](pyArgs[0], &cppArg0_local);
        else
            pythonToCpp[0](pyArgs[0], &cppArg0);

        if (!Shiboken::Object::isValid(pyArgs[1]))
            return {};
        ::QTimeZone cppArg1_local;
        ::QTimeZone *cppArg1 = &cppArg1_local;
        if (pythonToCpp[1].isValue())
            pythonToCpp[1](pyArgs[1], &cppArg1_local);
        else
            pythonToCpp[1](pyArgs[1], &cppArg1);


        if (Shiboken::Errors::occurred() == nullptr) {
            // Period::shiftTimes(const QTimeZone&,const QTimeZone&)
            cppSelf->shiftTimes(*cppArg0, *cppArg1);
        }
    }

     return Sbk_ReturnFromPython_None();
}

static PyObject *Sbk_KCalendarCore_PeriodFunc_start(PyObject *self)
{
    if (!Shiboken::Object::isValid(self))
        return {};
    [[maybe_unused]] auto *cppSelf = reinterpret_cast< ::KCalendarCore::Period *>(Shiboken::Conversions::cppPointer(Shiboken::Module::get(SbkKCalendarCoreTypeStructs[SBK_KCalendarCore_Period_IDX]), reinterpret_cast<SbkObject *>(self)));
    PyObject *pyResult{};
    Shiboken::PythonContextMarker pcm;

    // Call function/method
    {

        // Period::start()const->QDateTime
        QDateTime cppResult = const_cast<const ::KCalendarCore::Period *>(cppSelf)->start();
        pyResult = Shiboken::Conversions::copyToPython(Shiboken::Module::get(SbkPySide6_QtCoreTypeStructs[SBK_QDateTime_IDX]), &cppResult);
    }

    return Sbk_ReturnFromPython_Result(pyResult);
}

static PyObject *Sbk_KCalendarCore_Period__copy__(PyObject *self)
{
    if (!Shiboken::Object::isValid(self))
        return {};
    [[maybe_unused]] auto &cppSelf = *reinterpret_cast< ::KCalendarCore::Period *>(Shiboken::Conversions::cppPointer(Shiboken::Module::get(SbkKCalendarCoreTypeStructs[SBK_KCalendarCore_Period_IDX]), reinterpret_cast<SbkObject *>(self)));
    PyObject *pyResult = Shiboken::Conversions::copyToPython(Shiboken::Module::get(SbkKCalendarCoreTypeStructs[SBK_KCalendarCore_Period_IDX]), &cppSelf);
    if (Shiboken::Errors::occurred() != nullptr || pyResult == nullptr) {
        Py_XDECREF(pyResult);
        return {};
    }
    return pyResult;
}


static const char *Sbk_KCalendarCore_Period_PropertyStrings[] = {
    nullptr // Sentinel
};

static PyMethodDef Sbk_KCalendarCore_Period_methods[] = {
    {"duration", reinterpret_cast<PyCFunction>(Sbk_KCalendarCore_PeriodFunc_duration), METH_VARARGS, nullptr},
    {"end", reinterpret_cast<PyCFunction>(Sbk_KCalendarCore_PeriodFunc_end), METH_NOARGS, nullptr},
    {"hasDuration", reinterpret_cast<PyCFunction>(Sbk_KCalendarCore_PeriodFunc_hasDuration), METH_NOARGS, nullptr},
    {"isValid", reinterpret_cast<PyCFunction>(Sbk_KCalendarCore_PeriodFunc_isValid), METH_NOARGS, nullptr},
    {"shiftTimes", reinterpret_cast<PyCFunction>(Sbk_KCalendarCore_PeriodFunc_shiftTimes), METH_VARARGS, nullptr},
    {"start", reinterpret_cast<PyCFunction>(Sbk_KCalendarCore_PeriodFunc_start), METH_NOARGS, nullptr},
    {"__copy__", reinterpret_cast<PyCFunction>(Sbk_KCalendarCore_Period__copy__), METH_NOARGS, nullptr},
    {nullptr, nullptr, 0, nullptr} // Sentinel
};

static PyObject *Sbk_KCalendarCore_PeriodFunc___lshift__(PyObject *self, PyObject *pyArg)
{
    bool isReverse = SbkObject_TypeCheck(Shiboken::Module::get(SbkKCalendarCoreTypeStructs[SBK_KCalendarCore_Period_IDX]), pyArg)
                    && !SbkObject_TypeCheck(Shiboken::Module::get(SbkKCalendarCoreTypeStructs[SBK_KCalendarCore_Period_IDX]), self);
    if (isReverse)
        std::swap(self, pyArg);
    if (!Shiboken::Object::isValid(self))
        return {};
    [[maybe_unused]] auto *cppSelf = reinterpret_cast< ::KCalendarCore::Period *>(Shiboken::Conversions::cppPointer(Shiboken::Module::get(SbkKCalendarCoreTypeStructs[SBK_KCalendarCore_Period_IDX]), reinterpret_cast<SbkObject *>(self)));
    PyObject *pyResult{};
    Shiboken::AutoDecRef errInfo{};
    Shiboken::PythonContextMarker pcm;
    int overloadId = -1;
    [[maybe_unused]] Shiboken::Conversions::PythonToCppConversion pythonToCpp;

    static PyObject *attrName = Shiboken::PyMagicName::rlshift();
    if (!isReverse
        && Shiboken::Object::checkType(pyArg)
        && !PyObject_TypeCheck(pyArg, self->ob_type)
        && PyObject_HasAttr(pyArg, attrName)) {
        PyObject *revOpMethod = PyObject_GetAttr(pyArg, attrName);
        if (revOpMethod && PyCallable_Check(revOpMethod)) {
            pyResult = PyObject_CallFunction(revOpMethod, "O", self);
            if (Shiboken::Errors::occurred() != nullptr && (PyErr_ExceptionMatches(PyExc_NotImplementedError) || PyErr_ExceptionMatches(PyExc_AttributeError))) {
                PyErr_Clear();
                Py_XDECREF(pyResult);
                pyResult = nullptr;
            }
        }
        Py_XDECREF(revOpMethod);

    }

    // Do not enter here if other object has implemented a reverse operator.
    if (pyResult == nullptr) {
        // Overloaded function decisor
        // 0: Period::operator<<(QDataStream&)->QDataStream& [free reverse operator]
        if (isReverse
            && (pythonToCpp = Shiboken::Conversions::pythonToCppReferenceConversion(Shiboken::Module::get(SbkPySide6_QtCoreTypeStructs[SBK_QDataStream_IDX]), (pyArg)))) {
            overloadId = 0; // Period::operator<<(QDataStream&)->QDataStream& [free reverse operator]
        }

        if (isReverse && overloadId == -1) {
            Shiboken::Errors::setReverseOperatorNotImplemented();
            return {};
        }

        // Function signature not found.
        if (overloadId == -1)
            return Shiboken::returnWrongArguments(pyArg, "operator<<", SbkKCalendarCoreTypeStructs[SBK_KCalendarCore_Period_IDX]);

        // Call function/method
        {
            if (!Shiboken::Object::isValid(pyArg))
                return {};
            ::QDataStream *cppArg0;
            pythonToCpp(pyArg, &cppArg0);

            if (Shiboken::Errors::occurred() == nullptr) {
                // Period::operator<<(QDataStream&)->QDataStream& [free reverse operator]
                QDataStream & cppResult = (*cppArg0) << (*cppSelf);
                pyResult = Shiboken::Conversions::referenceToPython(Shiboken::Module::get(SbkPySide6_QtCoreTypeStructs[SBK_QDataStream_IDX]), &cppResult);
            }
        }

    } // End of "if (!pyResult)"

    return Sbk_ReturnFromPython_Result(pyResult);
}

static PyObject *Sbk_KCalendarCore_PeriodFunc___rshift__(PyObject *self, PyObject *pyArg)
{
    bool isReverse = SbkObject_TypeCheck(Shiboken::Module::get(SbkKCalendarCoreTypeStructs[SBK_KCalendarCore_Period_IDX]), pyArg)
                    && !SbkObject_TypeCheck(Shiboken::Module::get(SbkKCalendarCoreTypeStructs[SBK_KCalendarCore_Period_IDX]), self);
    if (isReverse)
        std::swap(self, pyArg);
    if (!Shiboken::Object::isValid(self))
        return {};
    [[maybe_unused]] auto *cppSelf = reinterpret_cast< ::KCalendarCore::Period *>(Shiboken::Conversions::cppPointer(Shiboken::Module::get(SbkKCalendarCoreTypeStructs[SBK_KCalendarCore_Period_IDX]), reinterpret_cast<SbkObject *>(self)));
    PyObject *pyResult{};
    Shiboken::AutoDecRef errInfo{};
    Shiboken::PythonContextMarker pcm;
    int overloadId = -1;
    [[maybe_unused]] Shiboken::Conversions::PythonToCppConversion pythonToCpp;

    static PyObject *attrName = Shiboken::PyMagicName::rrshift();
    if (!isReverse
        && Shiboken::Object::checkType(pyArg)
        && !PyObject_TypeCheck(pyArg, self->ob_type)
        && PyObject_HasAttr(pyArg, attrName)) {
        PyObject *revOpMethod = PyObject_GetAttr(pyArg, attrName);
        if (revOpMethod && PyCallable_Check(revOpMethod)) {
            pyResult = PyObject_CallFunction(revOpMethod, "O", self);
            if (Shiboken::Errors::occurred() != nullptr && (PyErr_ExceptionMatches(PyExc_NotImplementedError) || PyErr_ExceptionMatches(PyExc_AttributeError))) {
                PyErr_Clear();
                Py_XDECREF(pyResult);
                pyResult = nullptr;
            }
        }
        Py_XDECREF(revOpMethod);

    }

    // Do not enter here if other object has implemented a reverse operator.
    if (pyResult == nullptr) {
        // Overloaded function decisor
        // 0: Period::operator>>(QDataStream&)->QDataStream& [free reverse operator]
        if (isReverse
            && (pythonToCpp = Shiboken::Conversions::pythonToCppReferenceConversion(Shiboken::Module::get(SbkPySide6_QtCoreTypeStructs[SBK_QDataStream_IDX]), (pyArg)))) {
            overloadId = 0; // Period::operator>>(QDataStream&)->QDataStream& [free reverse operator]
        }

        if (isReverse && overloadId == -1) {
            Shiboken::Errors::setReverseOperatorNotImplemented();
            return {};
        }

        // Function signature not found.
        if (overloadId == -1)
            return Shiboken::returnWrongArguments(pyArg, "operator>>", SbkKCalendarCoreTypeStructs[SBK_KCalendarCore_Period_IDX]);

        // Call function/method
        {
            if (!Shiboken::Object::isValid(pyArg))
                return {};
            ::QDataStream *cppArg0;
            pythonToCpp(pyArg, &cppArg0);

            if (Shiboken::Errors::occurred() == nullptr) {
                // Period::operator>>(QDataStream&)->QDataStream& [free reverse operator]
                QDataStream & cppResult = (*cppArg0) >> (*cppSelf);
                pyResult = Shiboken::Conversions::referenceToPython(Shiboken::Module::get(SbkPySide6_QtCoreTypeStructs[SBK_QDataStream_IDX]), &cppResult);
            }
        }

    } // End of "if (!pyResult)"

    return Sbk_ReturnFromPython_Result(pyResult);
}

// Rich comparison
static PyObject * Sbk_KCalendarCore_Period_richcompare(PyObject *self, PyObject *pyArg, int op)
{
    if (!Shiboken::Object::isValid(self))
        return {};
    [[maybe_unused]] auto &cppSelf = *reinterpret_cast< ::KCalendarCore::Period *>(Shiboken::Conversions::cppPointer(Shiboken::Module::get(SbkKCalendarCoreTypeStructs[SBK_KCalendarCore_Period_IDX]), reinterpret_cast<SbkObject *>(self)));
    PyObject *pyResult{};
    [[maybe_unused]] Shiboken::Conversions::PythonToCppConversion pythonToCpp;
    switch (op) {
        case Py_NE:
            if ((pythonToCpp = Shiboken::Conversions::pythonToCppReferenceConversion(Shiboken::Module::get(SbkKCalendarCoreTypeStructs[SBK_KCalendarCore_Period_IDX]), (pyArg)))) {
                // Period::operator!=(const KCalendarCore::Period&)const->bool
                if (!Shiboken::Object::isValid(pyArg))
                    return {};
                ::KCalendarCore::Period cppArg0_local;
                ::KCalendarCore::Period *cppArg0 = &cppArg0_local;
                if (pythonToCpp.isValue())
                    pythonToCpp(pyArg, &cppArg0_local);
                else
                    pythonToCpp(pyArg, &cppArg0);

                bool cppResult = cppSelf != (*cppArg0);
                pyResult = Shiboken::Conversions::copyToPython(Shiboken::Conversions::PrimitiveTypeConverter<bool>(), &cppResult);
            } else {
                pyResult = Py_True;
                Py_INCREF(pyResult);
            }

            break;
        case Py_LT:
            if ((pythonToCpp = Shiboken::Conversions::pythonToCppReferenceConversion(Shiboken::Module::get(SbkKCalendarCoreTypeStructs[SBK_KCalendarCore_Period_IDX]), (pyArg)))) {
                // Period::operator<(const KCalendarCore::Period&)const->bool
                if (!Shiboken::Object::isValid(pyArg))
                    return {};
                ::KCalendarCore::Period cppArg0_local;
                ::KCalendarCore::Period *cppArg0 = &cppArg0_local;
                if (pythonToCpp.isValue())
                    pythonToCpp(pyArg, &cppArg0_local);
                else
                    pythonToCpp(pyArg, &cppArg0);

                bool cppResult = cppSelf < (*cppArg0);
                pyResult = Shiboken::Conversions::copyToPython(Shiboken::Conversions::PrimitiveTypeConverter<bool>(), &cppResult);
            } else {
                return Shiboken::returnFromRichCompare(pyResult);
            }

            break;
        case Py_EQ:
            if ((pythonToCpp = Shiboken::Conversions::pythonToCppReferenceConversion(Shiboken::Module::get(SbkKCalendarCoreTypeStructs[SBK_KCalendarCore_Period_IDX]), (pyArg)))) {
                // Period::operator==(const KCalendarCore::Period&)const->bool
                if (!Shiboken::Object::isValid(pyArg))
                    return {};
                ::KCalendarCore::Period cppArg0_local;
                ::KCalendarCore::Period *cppArg0 = &cppArg0_local;
                if (pythonToCpp.isValue())
                    pythonToCpp(pyArg, &cppArg0_local);
                else
                    pythonToCpp(pyArg, &cppArg0);

                bool cppResult = cppSelf == (*cppArg0);
                pyResult = Shiboken::Conversions::copyToPython(Shiboken::Conversions::PrimitiveTypeConverter<bool>(), &cppResult);
            } else {
                pyResult = Py_False;
                Py_INCREF(pyResult);
            }

            break;
        case Py_GT:
            if ((pythonToCpp = Shiboken::Conversions::pythonToCppReferenceConversion(Shiboken::Module::get(SbkKCalendarCoreTypeStructs[SBK_KCalendarCore_Period_IDX]), (pyArg)))) {
                // Period::operator>(const KCalendarCore::Period&)const->bool
                if (!Shiboken::Object::isValid(pyArg))
                    return {};
                ::KCalendarCore::Period cppArg0_local;
                ::KCalendarCore::Period *cppArg0 = &cppArg0_local;
                if (pythonToCpp.isValue())
                    pythonToCpp(pyArg, &cppArg0_local);
                else
                    pythonToCpp(pyArg, &cppArg0);

                bool cppResult = cppSelf > (*cppArg0);
                pyResult = Shiboken::Conversions::copyToPython(Shiboken::Conversions::PrimitiveTypeConverter<bool>(), &cppResult);
            } else {
                return Shiboken::returnFromRichCompare(pyResult);
            }

            break;
        default:
            // PYSIDE-74: By default, we redirect to object's tp_richcompare (which is `==`, `!=`).
            return FallbackRichCompare(self, pyArg, op);
    }

    return Shiboken::returnFromRichCompare(pyResult);
}

} // extern "C"

static int Sbk_KCalendarCore_Period_traverse(PyObject *self, visitproc visit, void *arg)
{
    auto traverseProc = reinterpret_cast<traverseproc>(PyType_GetSlot(SbkObject_TypeF(), Py_tp_traverse));
    ;
    return traverseProc(self, visit, arg);
}
static int Sbk_KCalendarCore_Period_clear(PyObject *self)
{
    auto clearProc = reinterpret_cast<inquiry>(PyType_GetSlot(SbkObject_TypeF(), Py_tp_clear));
    ;
    return clearProc(self);
}

// Class Definition -----------------------------------------------
extern "C" {

static PyType_Slot Sbk_KCalendarCore_Period_slots[] = {
    {Py_tp_base,        nullptr}, // inserted by introduceWrapperType
    {Py_tp_dealloc,     reinterpret_cast<void *>(&SbkDeallocWrapper)},
    {Py_tp_traverse,    reinterpret_cast<void *>(Sbk_KCalendarCore_Period_traverse)},
    {Py_tp_clear,       reinterpret_cast<void *>(Sbk_KCalendarCore_Period_clear)},
    {Py_tp_richcompare, reinterpret_cast<void *>(Sbk_KCalendarCore_Period_richcompare)},
    {Py_tp_methods,     reinterpret_cast<void *>(Sbk_KCalendarCore_Period_methods)},
    {Py_tp_init,        reinterpret_cast<void *>(Sbk_KCalendarCore_Period_Init)},
    {Py_tp_new,         reinterpret_cast<void *>(SbkObject_tp_new)},
    // type supports number protocol
    {Py_nb_lshift,      reinterpret_cast<void *>(Sbk_KCalendarCore_PeriodFunc___lshift__)},
    {Py_nb_rshift,      reinterpret_cast<void *>(Sbk_KCalendarCore_PeriodFunc___rshift__)},
    {0, nullptr}
};
static PyType_Spec Sbk_KCalendarCore_Period_spec = {
    "1:KCalendarCore.KCalendarCore.Period",
    sizeof(SbkObject),
    0,
    Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
    Sbk_KCalendarCore_Period_slots
};

} //extern "C"

// Type conversion functions.

// Python to C++ pointer conversion - returns the C++ object of the Python wrapper (keeps object identity).
static void Period_PythonToCpp_Period_PTR(PyObject *pyIn, void *cppOut)
{
    Shiboken::Conversions::pythonToCppPointer(Sbk_KCalendarCore_Period_TypeF(), pyIn, cppOut);
}
static PythonToCppFunc is_Period_PythonToCpp_Period_PTR_Convertible(PyObject *pyIn)
{
    if (pyIn == Py_None)
        return Shiboken::Conversions::nonePythonToCppNullPtr;
    if (PyObject_TypeCheck(pyIn, Sbk_KCalendarCore_Period_TypeF()))
        return Period_PythonToCpp_Period_PTR;
    return {};
}

// C++ to Python pointer conversion - tries to find the Python wrapper for the C++ object (keeps object identity).
static PyObject *Period_PTR_CppToPython_Period(const void *cppIn)
{
    auto *pyOut = reinterpret_cast<PyObject *>(Shiboken::BindingManager::instance().retrieveWrapper(cppIn, Sbk_KCalendarCore_Period_TypeF()));
    if (pyOut) {
        Py_INCREF(pyOut);
        return pyOut;
    }
    return Shiboken::Object::newObjectWithHeuristics(Sbk_KCalendarCore_Period_TypeF(), const_cast<void *>(cppIn), false);

}

// C++ to Python copy conversion.
static PyObject *Period_COPY_CppToPython_Period(const void *cppIn)
{
    auto *source = reinterpret_cast<const ::KCalendarCore::Period *>(cppIn);
    return Shiboken::Object::newObject(Sbk_KCalendarCore_Period_TypeF(), new ::KCalendarCore::Period(*source), true, true);
}

// Python to C++ copy conversion.
static void Period_PythonToCpp_Period_COPY(PyObject *pyIn, void *cppOut)
{
    *reinterpret_cast<::KCalendarCore::Period *>(cppOut) = *reinterpret_cast< ::KCalendarCore::Period *>(Shiboken::Conversions::cppPointer(Shiboken::Module::get(SbkKCalendarCoreTypeStructs[SBK_KCalendarCore_Period_IDX]), reinterpret_cast<SbkObject *>(pyIn)));
}
static PythonToCppFunc is_Period_PythonToCpp_Period_COPY_Convertible(PyObject *pyIn)
{
    if (PyObject_TypeCheck(pyIn, Sbk_KCalendarCore_Period_TypeF()))
        return Period_PythonToCpp_Period_COPY;
    return {};
}

// The signatures string for the functions.
// Multiple signatures have their index "n:" in front.
#if PYSIDE6_COMOPT_COMPRESS == 0
static const char *KCalendarCore_Period_SignatureStrings[] = {
    "3:KCalendarCore.KCalendarCore.Period(self)",
    "2:KCalendarCore.KCalendarCore.Period(self,period:KCalendarCore.KCalendarCore.Period)",
    "1:KCalendarCore.KCalendarCore.Period(self,start:PySide6.QtCore.QDateTime,duration:typing.Union[KCalendarCore.KCalendarCore.Duration, int])",
    "0:KCalendarCore.KCalendarCore.Period(self,start:PySide6.QtCore.QDateTime,end:PySide6.QtCore.QDateTime)",
    "1:KCalendarCore.KCalendarCore.Period.duration(self)->KCalendarCore.KCalendarCore.Duration",
    "0:KCalendarCore.KCalendarCore.Period.duration(self,type:KCalendarCore.KCalendarCore.Duration.Type)->KCalendarCore.KCalendarCore.Duration",
    "KCalendarCore.KCalendarCore.Period.end(self)->PySide6.QtCore.QDateTime",
    "KCalendarCore.KCalendarCore.Period.hasDuration(self)->bool",
    "KCalendarCore.KCalendarCore.Period.isValid(self)->bool",
    "KCalendarCore.KCalendarCore.Period.shiftTimes(self,oldZone:typing.Union[PySide6.QtCore.QTimeZone, PySide6.QtCore.QTimeZone.Initialization],newZone:typing.Union[PySide6.QtCore.QTimeZone, PySide6.QtCore.QTimeZone.Initialization])",
    "KCalendarCore.KCalendarCore.Period.start(self)->PySide6.QtCore.QDateTime",
    "KCalendarCore.KCalendarCore.Period.__copy__(self)->typing._Self",
    "KCalendarCore.KCalendarCore.Period.__lshift__(self,stream:PySide6.QtCore.QDataStream)->PySide6.QtCore.QDataStream",
    "KCalendarCore.KCalendarCore.Period.__rshift__(self,stream:PySide6.QtCore.QDataStream)->PySide6.QtCore.QDataStream",
    "KCalendarCore.KCalendarCore.Period.__ne__(self,other:KCalendarCore.KCalendarCore.Period)->bool",
    "KCalendarCore.KCalendarCore.Period.__lt__(self,other:KCalendarCore.KCalendarCore.Period)->bool",
    "KCalendarCore.KCalendarCore.Period.__eq__(self,other:KCalendarCore.KCalendarCore.Period)->bool",
    "KCalendarCore.KCalendarCore.Period.__gt__(self,other:KCalendarCore.KCalendarCore.Period)->bool",
    nullptr}; // Sentinel
#else
static constexpr size_t KCalendarCore_Period_SignatureByteSize = 307;
static constexpr uint8_t KCalendarCore_Period_SignatureBytes[307] = {
    0x78, 0xda, 0xbd, 0x54, 0x3d, 0x4f, 0xc3, 0x30, 0x10, 0xdd, 0xf3, 0x2b, 0x3a, 0x12, 0xc9, 0x58,
    0x7c, 0x48, 0x0c, 0x19, 0x58, 0x9a, 0x05, 0xb1, 0xb4, 0x4a, 0x61, 0x00, 0x55, 0x96, 0xc1, 0xd7,
    0xc6, 0x92, 0x6b, 0x07, 0xfb, 0x10, 0x0a, 0xbf, 0x1e, 0x27, 0x4d, 0x86, 0x54, 0x0d, 0xba, 0xa2,
    0x86, 0x2d, 0x97, 0x7b, 0xf7, 0xee, 0xbd, 0x17, 0x3b, 0xb7, 0xd9, 0xe3, 0x5c, 0x1a, 0xb0, 0x4a,
    0xfa, 0xb9, 0xf3, 0xc0, 0x87, 0xd5, 0x02, 0xbc, 0x76, 0xea, 0x22, 0x80, 0xd9, 0xa4, 0xc9, 0x0d,
    0x15, 0xca, 0xaa, 0xf6, 0x99, 0x00, 0x4f, 0x93, 0x6b, 0x32, 0x69, 0x40, 0xe9, 0x31, 0x5b, 0xd4,
    0x85, 0x56, 0x70, 0xc7, 0x97, 0xd8, 0x02, 0x96, 0xb9, 0x44, 0x58, 0xe9, 0x1d, 0x30, 0xf5, 0xe9,
    0x25, 0x6a, 0x67, 0x33, 0xac, 0x2b, 0x6d, 0xb7, 0xfc, 0xc9, 0xc6, 0xe2, 0xf5, 0x37, 0xf2, 0xbc,
    0x9b, 0x60, 0x33, 0x6d, 0x71, 0x9d, 0x26, 0x57, 0xe7, 0x92, 0x12, 0x87, 0x46, 0x9b, 0x34, 0xc7,
    0xbc, 0x77, 0xb3, 0x8f, 0xfe, 0xf2, 0x9e, 0xe2, 0x83, 0x64, 0x60, 0xc8, 0xcc, 0x62, 0x58, 0x90,
    0x51, 0xc8, 0xf9, 0x2a, 0x22, 0xa9, 0x42, 0x08, 0x32, 0xe2, 0x8b, 0xde, 0xdb, 0x58, 0x54, 0x14,
    0x9a, 0x52, 0x86, 0xfc, 0x20, 0xaa, 0x37, 0xe7, 0x0c, 0x65, 0x54, 0x87, 0x67, 0x69, 0xb4, 0x3a,
    0x75, 0x2c, 0x94, 0x7a, 0x83, 0x8d, 0xbc, 0xb0, 0x4f, 0xd0, 0x19, 0xf5, 0xe2, 0x2c, 0x0c, 0x8f,
    0xdd, 0xa1, 0xa5, 0x06, 0xdf, 0xa0, 0xd8, 0x6c, 0xac, 0xc3, 0x1f, 0xac, 0x46, 0x1d, 0x05, 0x7d,
    0xb7, 0x66, 0xd6, 0xcc, 0xc2, 0xd7, 0x14, 0xbc, 0x29, 0xc9, 0x63, 0x73, 0xbe, 0xcf, 0xf1, 0x79,
    0x84, 0x78, 0x77, 0x55, 0x2d, 0x44, 0xcf, 0xd5, 0x99, 0x11, 0x45, 0x2c, 0x69, 0xf3, 0xa6, 0xcd,
    0xbb, 0x63, 0x88, 0x17, 0xcf, 0x83, 0xdc, 0x1d, 0xbb, 0x5c, 0xb2, 0x68, 0x5b, 0xc7, 0xf5, 0x76,
    0x4d, 0xda, 0x46, 0xff, 0xef, 0x1b, 0x2d, 0xf4, 0xdb, 0x1c, 0x96, 0xe0, 0x29, 0xff, 0x4d, 0xfa,
    0x79, 0x8d, 0x11, 0xe2, 0xa4, 0xf4, 0xf0, 0x31, 0x29, 0xfd, 0xf6, 0xcf, 0xea, 0x7f, 0x00, 0x4c,
    0x68, 0x79, 0x7e
};
#endif

PyTypeObject *init_KCalendarCore_Period(PyObject *enclosingClass)
{
    auto &typeStruct = SbkKCalendarCoreTypeStructs[SBK_KCalendarCore_Period_IDX];
    if (typeStruct.type != nullptr)
        return typeStruct.type;

    auto *base1 = SbkObject_TypeF();
    Shiboken::AutoDecRef Sbk_KCalendarCore_Period_Type_bases(PyTuple_Pack(1, base1));

    PyTypeObject *pyType = Shiboken::ObjectType::introduceWrapperType(
        enclosingClass,
        "Period",
        "KCalendarCore::Period",
        &Sbk_KCalendarCore_Period_spec,
        &Shiboken::callCppDestructor< ::KCalendarCore::Period >,
        Sbk_KCalendarCore_Period_Type_bases.object(),
        Shiboken::ObjectType::WrapperFlags::InnerClass | Shiboken::ObjectType::WrapperFlags::Value);
#if PYSIDE6_COMOPT_COMPRESS == 0
    InitSignatureStrings(pyType, KCalendarCore_Period_SignatureStrings);
#else
    InitSignatureBytes(pyType, KCalendarCore_Period_SignatureBytes, KCalendarCore_Period_SignatureByteSize);
#endif
    SbkObjectType_SetPropertyStrings(pyType, Sbk_KCalendarCore_Period_PropertyStrings);
    typeStruct.type = pyType;

    // Register Converter
    SbkConverter *converter = Shiboken::Conversions::createConverter(pyType,
        Period_PythonToCpp_Period_PTR,
        is_Period_PythonToCpp_Period_PTR_Convertible,
        Period_PTR_CppToPython_Period,
        Period_COPY_CppToPython_Period);

    Shiboken::Conversions::registerConverterName(converter, "KCalendarCore::Period");
    Shiboken::Conversions::registerConverterName(converter, "KCalendarCore::Period*");
    Shiboken::Conversions::registerConverterName(converter, "KCalendarCore::Period&");
    Shiboken::Conversions::registerConverterAlias(converter, "Period");
    Shiboken::Conversions::registerConverterAlias(converter, "Period*");
    Shiboken::Conversions::registerConverterAlias(converter, "Period&");
    Shiboken::Conversions::registerConverterName(converter, typeid(::KCalendarCore::Period).name());

    // Add Python to C++ copy (value, not pointer neither reference) conversion to type converter.
    Shiboken::Conversions::addPythonToCppValueConversion(converter,
        Period_PythonToCpp_Period_COPY,
        is_Period_PythonToCpp_Period_COPY_Convertible);

    qRegisterMetaType< ::KCalendarCore::Period >("Period");
    qRegisterMetaType< ::KCalendarCore::Period >("KCalendarCore::Period");

    return pyType;
}
