
// 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 "akonadicalendar_python.h"

// main header
#include "akonadi_calendarutils_wrapper.h"

// Argument includes
#include <QList>
#include <QString>
#include <akonadi/collection.h>
#include <akonadi/entitytreemodel.h>
#include <akonadi/item.h>
#include <etmcalendar.h>

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

using namespace Akonadi;


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

extern "C" {
static int Sbk_Akonadi_CalendarUtils_Init(PyObject *, PyObject *, PyObject *)
{
    Shiboken::Errors::setInstantiateNamespace("CalendarUtils");
    return -1;
}

static PyObject *Sbk_Akonadi_CalendarUtilsFunc_createMimeData([[maybe_unused]] PyObject *self, PyObject *pyArg)
{
    PyObject *pyResult{};
    Shiboken::AutoDecRef errInfo{};
    Shiboken::PythonContextMarker pcm;
    int overloadId = -1;
    [[maybe_unused]] Shiboken::Conversions::PythonToCppConversion pythonToCpp;

    // Overloaded function decisor
    // 0: static CalendarUtils::createMimeData(const QList<Akonadi::Item>&)->QMimeData*
    if ((pythonToCpp = Shiboken::Conversions::pythonToCppConversion(SbkAkonadiCalendarTypeConverters[SBK_AkonadiCalendar_QList_Akonadi_Item_IDX], (pyArg)))) {
        overloadId = 0; // static CalendarUtils::createMimeData(const QList<Akonadi::Item>&)->QMimeData*
    }

    // Function signature not found.
    if (overloadId == -1)
        return Shiboken::returnWrongArguments(pyArg, "createMimeData", SbkAkonadiCalendarTypeStructs[SBK_AkonadiCalendarAkonadi_CalendarUtils_IDX]);

    // Call function/method
    {
        ::QList<Akonadi::Item> cppArg0;
        pythonToCpp(pyArg, &cppArg0);

        if (Shiboken::Errors::occurred() == nullptr) {
            // static CalendarUtils::createMimeData(const QList<Akonadi::Item>&)->QMimeData*
            QMimeData * cppResult = ::Akonadi::CalendarUtils::createMimeData(cppArg0);
            pyResult = Shiboken::Conversions::pointerToPython(Shiboken::Module::get(SbkPySide6_QtCoreTypeStructs[SBK_QMimeData_IDX]), cppResult);
        }
    }

    return Sbk_ReturnFromPython_Result(pyResult);
}

static PyObject *Sbk_Akonadi_CalendarUtilsFunc_displayName([[maybe_unused]] PyObject *self, PyObject *args)
{
    PyObject *pyResult{};
    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, "displayName", 1, 2, &(pyArgs[0]), &(pyArgs[1])) == 0)
        return {};


    // Overloaded function decisor
    // 0: static CalendarUtils::displayName(const Akonadi::Collection&)->QString
    // 1: static CalendarUtils::displayName(const Akonadi::ETMCalendar*,const Akonadi::Collection&)->QString
    // 2: static CalendarUtils::displayName(const Akonadi::EntityTreeModel*,const Akonadi::Collection&)->QString
    if (numArgs == 2
        && (pythonToCpp[0] = Shiboken::Conversions::pythonToCppPointerConversion(Shiboken::Module::get(SbkAkonadiCoreTypeStructs[SBK_Akonadi_EntityTreeModel_IDX]), (pyArgs[0])))
        && (pythonToCpp[1] = Shiboken::Conversions::pythonToCppReferenceConversion(Shiboken::Module::get(SbkAkonadiCoreTypeStructs[SBK_Akonadi_Collection_IDX]), (pyArgs[1])))) {
        overloadId = 2; // static CalendarUtils::displayName(const Akonadi::EntityTreeModel*,const Akonadi::Collection&)->QString
    } else if (numArgs == 2
        && (pythonToCpp[0] = Shiboken::Conversions::pythonToCppPointerConversion(Shiboken::Module::get(SbkAkonadiCalendarTypeStructs[SBK_Akonadi_ETMCalendar_IDX]), (pyArgs[0])))
        && (pythonToCpp[1] = Shiboken::Conversions::pythonToCppReferenceConversion(Shiboken::Module::get(SbkAkonadiCoreTypeStructs[SBK_Akonadi_Collection_IDX]), (pyArgs[1])))) {
        overloadId = 1; // static CalendarUtils::displayName(const Akonadi::ETMCalendar*,const Akonadi::Collection&)->QString
    } else if (numArgs == 1
        && (pythonToCpp[0] = Shiboken::Conversions::pythonToCppReferenceConversion(Shiboken::Module::get(SbkAkonadiCoreTypeStructs[SBK_Akonadi_Collection_IDX]), (pyArgs[0])))) {
        overloadId = 0; // static CalendarUtils::displayName(const Akonadi::Collection&)->QString
    }

    // Function signature not found.
    if (overloadId == -1)
        return Shiboken::returnWrongArguments(args, "displayName", SbkAkonadiCalendarTypeStructs[SBK_AkonadiCalendarAkonadi_CalendarUtils_IDX]);

    // Call function/method
    switch (overloadId) {
        case 0: // displayName(const Akonadi::Collection &collection)
        {
            if (!Shiboken::Object::isValid(pyArgs[0]))
                return {};
            ::Akonadi::Collection cppArg0_local;
            ::Akonadi::Collection *cppArg0 = &cppArg0_local;
            if (pythonToCpp[0].isValue())
                pythonToCpp[0](pyArgs[0], &cppArg0_local);
            else
                pythonToCpp[0](pyArgs[0], &cppArg0);


            if (Shiboken::Errors::occurred() == nullptr) {
                // static CalendarUtils::displayName(const Akonadi::Collection&)->QString
                QString cppResult = ::Akonadi::CalendarUtils::displayName(*cppArg0);
                pyResult = Shiboken::Conversions::copyToPython(SbkPySide6_QtCoreTypeConverters[SBK_QString_IDX], &cppResult);
            }
            break;
        }
        case 1: // displayName(const Akonadi::ETMCalendar *calendar, const Akonadi::Collection &collection)
        {
            if (!Shiboken::Object::isValid(pyArgs[0]))
                return {};
            ::Akonadi::ETMCalendar *cppArg0;
            pythonToCpp[0](pyArgs[0], &cppArg0);
            if (!Shiboken::Object::isValid(pyArgs[1]))
                return {};
            ::Akonadi::Collection cppArg1_local;
            ::Akonadi::Collection *cppArg1 = &cppArg1_local;
            if (pythonToCpp[1].isValue())
                pythonToCpp[1](pyArgs[1], &cppArg1_local);
            else
                pythonToCpp[1](pyArgs[1], &cppArg1);


            if (Shiboken::Errors::occurred() == nullptr) {
                // static CalendarUtils::displayName(const Akonadi::ETMCalendar*,const Akonadi::Collection&)->QString
                QString cppResult = ::Akonadi::CalendarUtils::displayName(cppArg0, *cppArg1);
                pyResult = Shiboken::Conversions::copyToPython(SbkPySide6_QtCoreTypeConverters[SBK_QString_IDX], &cppResult);
            }
            break;
        }
        case 2: // displayName(const Akonadi::EntityTreeModel *model, const Akonadi::Collection &collection)
        {
            if (!Shiboken::Object::isValid(pyArgs[0]))
                return {};
            ::Akonadi::EntityTreeModel *cppArg0;
            pythonToCpp[0](pyArgs[0], &cppArg0);
            if (!Shiboken::Object::isValid(pyArgs[1]))
                return {};
            ::Akonadi::Collection cppArg1_local;
            ::Akonadi::Collection *cppArg1 = &cppArg1_local;
            if (pythonToCpp[1].isValue())
                pythonToCpp[1](pyArgs[1], &cppArg1_local);
            else
                pythonToCpp[1](pyArgs[1], &cppArg1);


            if (Shiboken::Errors::occurred() == nullptr) {
                // static CalendarUtils::displayName(const Akonadi::EntityTreeModel*,const Akonadi::Collection&)->QString
                QString cppResult = ::Akonadi::CalendarUtils::displayName(cppArg0, *cppArg1);
                pyResult = Shiboken::Conversions::copyToPython(SbkPySide6_QtCoreTypeConverters[SBK_QString_IDX], &cppResult);
            }
            break;
        }
    }

    return Sbk_ReturnFromPython_Result(pyResult);
}


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

static PyMethodDef Sbk_Akonadi_CalendarUtils_methods[] = {
    {"createMimeData", reinterpret_cast<PyCFunction>(Sbk_Akonadi_CalendarUtilsFunc_createMimeData), METH_O|METH_STATIC, nullptr},
    {"displayName", reinterpret_cast<PyCFunction>(Sbk_Akonadi_CalendarUtilsFunc_displayName), METH_VARARGS|METH_STATIC, nullptr},
    {nullptr, nullptr, 0, nullptr} // Sentinel
};

} // extern "C"

static int Sbk_Akonadi_CalendarUtils_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_Akonadi_CalendarUtils_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_Akonadi_CalendarUtils_slots[] = {
    {Py_tp_base,        nullptr}, // inserted by introduceWrapperType
    {Py_tp_dealloc,     reinterpret_cast<void *>(Sbk_object_dealloc /* PYSIDE-832: Prevent replacement of "0" with subtype_dealloc. */)},
    {Py_tp_traverse,    reinterpret_cast<void *>(Sbk_Akonadi_CalendarUtils_traverse)},
    {Py_tp_clear,       reinterpret_cast<void *>(Sbk_Akonadi_CalendarUtils_clear)},
    {Py_tp_methods,     reinterpret_cast<void *>(Sbk_Akonadi_CalendarUtils_methods)},
    {Py_tp_init,        reinterpret_cast<void *>(Sbk_Akonadi_CalendarUtils_Init)},
    {Py_tp_new,         reinterpret_cast<void *>(SbkDummyNew /* PYSIDE-595: Prevent replacement of "0" with base->tp_new. */)},
    {0, nullptr}
};
static PyType_Spec Sbk_Akonadi_CalendarUtils_spec = {
    "1:AkonadiCalendar.Akonadi.CalendarUtils",
    sizeof(SbkObject),
    0,
    Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
    Sbk_Akonadi_CalendarUtils_slots
};

} //extern "C"

// Type conversion functions.

// The signatures string for the functions.
// Multiple signatures have their index "n:" in front.
#if PYSIDE6_COMOPT_COMPRESS == 0
static const char *AkonadiCalendarAkonadi_CalendarUtils_SignatureStrings[] = {
    "AkonadiCalendar.Akonadi.CalendarUtils.createMimeData(items:QList[AkonadiCore.Akonadi.Item])->PySide6.QtCore.QMimeData",
    "2:AkonadiCalendar.Akonadi.CalendarUtils.displayName(collection:AkonadiCore.Akonadi.Collection)->QString",
    "1:AkonadiCalendar.Akonadi.CalendarUtils.displayName(calendar:AkonadiCalendar.Akonadi.ETMCalendar,collection:AkonadiCore.Akonadi.Collection)->QString",
    "0:AkonadiCalendar.Akonadi.CalendarUtils.displayName(model:AkonadiCore.Akonadi.EntityTreeModel,collection:AkonadiCore.Akonadi.Collection)->QString",
    nullptr}; // Sentinel
#else
static constexpr size_t AkonadiCalendarAkonadi_CalendarUtils_SignatureByteSize = 173;
static constexpr uint8_t AkonadiCalendarAkonadi_CalendarUtils_SignatureBytes[173] = {
    0x78, 0xda, 0x9d, 0x8e, 0x3d, 0x0b, 0xc2, 0x40, 0x0c, 0x86, 0x77, 0x7f, 0x49, 0x05, 0x3d, 0xd4,
    0xc1, 0xa1, 0x83, 0x50, 0x6a, 0x07, 0xc1, 0x8a, 0x47, 0xeb, 0x24, 0x0e, 0xa1, 0x17, 0x24, 0x78,
    0x1f, 0x72, 0x97, 0xa5, 0xff, 0xde, 0xaa, 0x6d, 0xa7, 0x0a, 0x72, 0x63, 0xf2, 0xe4, 0xcd, 0xf3,
    0x66, 0x0f, 0x67, 0x41, 0x51, 0x0e, 0x1a, 0xad, 0x02, 0x2f, 0xb2, 0xef, 0x2c, 0x86, 0xc5, 0x85,
    0x49, 0x07, 0xd1, 0x78, 0x04, 0xc6, 0x92, 0x0c, 0xee, 0x81, 0x21, 0x21, 0x46, 0x13, 0x52, 0x79,
    0xa4, 0xc0, 0xd7, 0x3e, 0x90, 0x3b, 0x8f, 0x63, 0xf8, 0xd0, 0xf1, 0xdb, 0x7c, 0xb9, 0x3b, 0xb7,
    0x15, 0x29, 0xdc, 0x0a, 0xc9, 0x1f, 0x2c, 0x87, 0x07, 0xb3, 0x4d, 0x9a, 0xfd, 0xe5, 0x55, 0x14,
    0x9e, 0x1a, 0xda, 0x13, 0x18, 0x4c, 0x1a, 0xa7, 0x35, 0x36, 0x4c, 0xce, 0xa6, 0x53, 0xce, 0x7c,
    0xc4, 0x9d, 0x58, 0x56, 0xec, 0xc9, 0xde, 0x67, 0xeb, 0x18, 0x4f, 0x4f, 0x7e, 0x46, 0x8b, 0xba,
    0x1c, 0x76, 0x8b, 0x98, 0x52, 0xab, 0x88, 0x52, 0xc6, 0x29, 0xd4, 0x93, 0x8a, 0xc2, 0x32, 0x71,
    0x5b, 0x7b, 0xc4, 0xf2, 0x7d, 0x13, 0xd5, 0xe8, 0x05, 0x74, 0x29, 0xbe, 0x80
};
#endif

PyTypeObject *init_AkonadiCalendarAkonadi_CalendarUtils(PyObject *enclosingClass)
{
    auto &typeStruct = SbkAkonadiCalendarTypeStructs[SBK_AkonadiCalendarAkonadi_CalendarUtils_IDX];
    if (typeStruct.type != nullptr)
        return typeStruct.type;

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

    PyTypeObject *pyType = Shiboken::ObjectType::introduceWrapperType(
        enclosingClass,
        "CalendarUtils",
        "Akonadi::CalendarUtils",
        &Sbk_Akonadi_CalendarUtils_spec,
        nullptr,
        Sbk_Akonadi_CalendarUtils_Type_bases.object(),
        Shiboken::ObjectType::WrapperFlags::InnerClass);
#if PYSIDE6_COMOPT_COMPRESS == 0
    InitSignatureStrings(pyType, AkonadiCalendarAkonadi_CalendarUtils_SignatureStrings);
#else
    InitSignatureBytes(pyType, AkonadiCalendarAkonadi_CalendarUtils_SignatureBytes, AkonadiCalendarAkonadi_CalendarUtils_SignatureByteSize);
#endif
    SbkObjectType_SetPropertyStrings(pyType, Sbk_Akonadi_CalendarUtils_PropertyStrings);
    typeStruct.type = pyType;



    return pyType;
}
