
// 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 <pysideqobject.h>
#include <pysidesignal.h>
#include <pysideproperty.h>
#include <signalmanager.h>
#include <pysidemetafunction.h>
#include <pysideqenum.h>
#include <pysideutils.h>
#include <feature_select.h>
QT_WARNING_DISABLE_DEPRECATED


// module include
#include "akonadicore_python.h"

// main header
#include "akonadi_job_wrapper.h"

// Wrappers providing overrides
#include "akonadi_trashfilterproxymodel_wrapper.h"
#include "akonadi_specialcollectionsdiscoveryjob_wrapper.h"

// Extra includes
#include <pysidesignal.h>

// Argument includes
#include <QString>
#include <job.h>
#include <kjob.h>
#include <qmetaobject.h>
#include <qobject.h>
#include <qobjectdefs.h>

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

using namespace Akonadi;

extern "C" {
static PyTypeObject *Sbk_Akonadi_Job_TypeF(void)
{
    return SbkAkonadiCoreTypeStructs[SBK_Akonadi_Job_IDX].type;
}
} // extern "C"

// Native ---------------------------------------------------------

void JobWrapper::resetPyMethodCache()
{
    std::fill(m_PyMethodCache.begin(), m_PyMethodCache.end(), nullptr);
}

JobWrapper::JobWrapper(::QObject * parent) : Akonadi::Job(parent)
{
}

bool JobWrapper::addSubjob(::KJob * job)
{
    static const char *funcName = "addSubjob";
    static PyObject *nameCache[2] = {};
    Shiboken::GilState gil(false);
    Shiboken::AutoDecRef pyOverride(Sbk_GetPyOverride(this, Sbk_Akonadi_Job_TypeF(), gil, funcName, m_PyMethodCache[0], nameCache));
    if (pyOverride.isNull()) {
        return this->::Akonadi::Job::addSubjob(job);
    }
    return SpecialCollectionsDiscoveryJobWrapper::sbk_o_addSubjob("Job", funcName, gil, pyOverride, job);
}

void JobWrapper::childEvent(::QChildEvent * event)
{
    static const char *funcName = "childEvent";
    static PyObject *nameCache[2] = {};
    Shiboken::GilState gil(false);
    Shiboken::AutoDecRef pyOverride(Sbk_GetPyOverride(this, Sbk_Akonadi_Job_TypeF(), gil, funcName, m_PyMethodCache[1], nameCache));
    if (pyOverride.isNull()) {
        return this->::QObject::childEvent(event);
    }
    TrashFilterProxyModelWrapper::sbk_o_childEvent("Job", funcName, gil, pyOverride, event);
}

void JobWrapper::connectNotify(const ::QMetaMethod & signal)
{
    static const char *funcName = "connectNotify";
    static PyObject *nameCache[2] = {};
    Shiboken::GilState gil(false);
    Shiboken::AutoDecRef pyOverride(Sbk_GetPyOverride(this, Sbk_Akonadi_Job_TypeF(), gil, funcName, m_PyMethodCache[2], nameCache));
    if (pyOverride.isNull()) {
        return this->::QObject::connectNotify(signal);
    }
    TrashFilterProxyModelWrapper::sbk_o_connectNotify("Job", funcName, gil, pyOverride, signal);
}

void JobWrapper::customEvent(::QEvent * event)
{
    static const char *funcName = "customEvent";
    static PyObject *nameCache[2] = {};
    Shiboken::GilState gil(false);
    Shiboken::AutoDecRef pyOverride(Sbk_GetPyOverride(this, Sbk_Akonadi_Job_TypeF(), gil, funcName, m_PyMethodCache[3], nameCache));
    if (pyOverride.isNull()) {
        return this->::QObject::customEvent(event);
    }
    TrashFilterProxyModelWrapper::sbk_o_customEvent("Job", funcName, gil, pyOverride, event);
}

void JobWrapper::disconnectNotify(const ::QMetaMethod & signal)
{
    static const char *funcName = "disconnectNotify";
    static PyObject *nameCache[2] = {};
    Shiboken::GilState gil(false);
    Shiboken::AutoDecRef pyOverride(Sbk_GetPyOverride(this, Sbk_Akonadi_Job_TypeF(), gil, funcName, m_PyMethodCache[4], nameCache));
    if (pyOverride.isNull()) {
        return this->::QObject::disconnectNotify(signal);
    }
    TrashFilterProxyModelWrapper::sbk_o_connectNotify("Job", funcName, gil, pyOverride, signal);
}

bool JobWrapper::doKill()
{
    static const char *funcName = "doKill";
    static PyObject *nameCache[2] = {};
    Shiboken::GilState gil(false);
    Shiboken::AutoDecRef pyOverride(Sbk_GetPyOverride(this, Sbk_Akonadi_Job_TypeF(), gil, funcName, m_PyMethodCache[5], nameCache));
    if (pyOverride.isNull()) {
        return this->::Akonadi::Job::doKill();
    }
    return TrashFilterProxyModelWrapper::sbk_o_submit("Job", funcName, gil, pyOverride);
}

bool JobWrapper::doResume()
{
    static const char *funcName = "doResume";
    static PyObject *nameCache[2] = {};
    Shiboken::GilState gil(false);
    Shiboken::AutoDecRef pyOverride(Sbk_GetPyOverride(this, Sbk_Akonadi_Job_TypeF(), gil, funcName, m_PyMethodCache[6], nameCache));
    if (pyOverride.isNull()) {
        return this->::KJob::doResume();
    }
    return TrashFilterProxyModelWrapper::sbk_o_submit("Job", funcName, gil, pyOverride);
}

void JobWrapper::doStart()
{
    static const char *funcName = "doStart";
    static PyObject *nameCache[2] = {};
    Shiboken::GilState gil(false);
    Shiboken::AutoDecRef pyOverride(Sbk_GetPyOverride(this, Sbk_Akonadi_Job_TypeF(), gil, funcName, m_PyMethodCache[7], nameCache));
    if (pyOverride.isNull()) {
        gil.acquire();
        Shiboken::Errors::setPureVirtualMethodError("Job.doStart");
        return;
    }
    TrashFilterProxyModelWrapper::sbk_o_resetInternalData("Job", funcName, gil, pyOverride);
}

bool JobWrapper::doSuspend()
{
    static const char *funcName = "doSuspend";
    static PyObject *nameCache[2] = {};
    Shiboken::GilState gil(false);
    Shiboken::AutoDecRef pyOverride(Sbk_GetPyOverride(this, Sbk_Akonadi_Job_TypeF(), gil, funcName, m_PyMethodCache[8], nameCache));
    if (pyOverride.isNull()) {
        return this->::KJob::doSuspend();
    }
    return TrashFilterProxyModelWrapper::sbk_o_submit("Job", funcName, gil, pyOverride);
}

bool JobWrapper::event(::QEvent * event)
{
    static const char *funcName = "event";
    static PyObject *nameCache[2] = {};
    Shiboken::GilState gil(false);
    Shiboken::AutoDecRef pyOverride(Sbk_GetPyOverride(this, Sbk_Akonadi_Job_TypeF(), gil, funcName, m_PyMethodCache[9], nameCache));
    if (pyOverride.isNull()) {
        return this->::QObject::event(event);
    }
    return TrashFilterProxyModelWrapper::sbk_o_event("Job", funcName, gil, pyOverride, event);
}

bool JobWrapper::eventFilter(::QObject * watched, ::QEvent * event)
{
    static const char *funcName = "eventFilter";
    static PyObject *nameCache[2] = {};
    Shiboken::GilState gil(false);
    Shiboken::AutoDecRef pyOverride(Sbk_GetPyOverride(this, Sbk_Akonadi_Job_TypeF(), gil, funcName, m_PyMethodCache[10], nameCache));
    if (pyOverride.isNull()) {
        return this->::QObject::eventFilter(watched, event);
    }
    return TrashFilterProxyModelWrapper::sbk_o_eventFilter("Job", funcName, gil, pyOverride, watched, event);
}

bool JobWrapper::removeSubjob(::KJob * job)
{
    static const char *funcName = "removeSubjob";
    static PyObject *nameCache[2] = {};
    Shiboken::GilState gil(false);
    Shiboken::AutoDecRef pyOverride(Sbk_GetPyOverride(this, Sbk_Akonadi_Job_TypeF(), gil, funcName, m_PyMethodCache[11], nameCache));
    if (pyOverride.isNull()) {
        return this->::Akonadi::Job::removeSubjob(job);
    }
    return SpecialCollectionsDiscoveryJobWrapper::sbk_o_addSubjob("Job", funcName, gil, pyOverride, job);
}

void JobWrapper::slotInfoMessage(::KJob * job, const ::QString & message)
{
    static const char *funcName = "slotInfoMessage";
    static PyObject *nameCache[2] = {};
    Shiboken::GilState gil(false);
    Shiboken::AutoDecRef pyOverride(Sbk_GetPyOverride(this, Sbk_Akonadi_Job_TypeF(), gil, funcName, m_PyMethodCache[12], nameCache));
    if (pyOverride.isNull()) {
        return this->::KCompositeJob::slotInfoMessage(job, message);
    }
    SpecialCollectionsDiscoveryJobWrapper::sbk_o_slotInfoMessage("Job", funcName, gil, pyOverride, job, message);
}

void JobWrapper::slotResult(::KJob * job)
{
    static const char *funcName = "slotResult";
    static PyObject *nameCache[2] = {};
    Shiboken::GilState gil(false);
    Shiboken::AutoDecRef pyOverride(Sbk_GetPyOverride(this, Sbk_Akonadi_Job_TypeF(), gil, funcName, m_PyMethodCache[13], nameCache));
    if (pyOverride.isNull()) {
        return this->::Akonadi::Job::slotResult(job);
    }
    SpecialCollectionsDiscoveryJobWrapper::sbk_o_slotResult("Job", funcName, gil, pyOverride, job);
}

void JobWrapper::start()
{
    static const char *funcName = "start";
    static PyObject *nameCache[2] = {};
    Shiboken::GilState gil(false);
    Shiboken::AutoDecRef pyOverride(Sbk_GetPyOverride(this, Sbk_Akonadi_Job_TypeF(), gil, funcName, m_PyMethodCache[14], nameCache));
    if (pyOverride.isNull()) {
        return this->::Akonadi::Job::start();
    }
    TrashFilterProxyModelWrapper::sbk_o_resetInternalData("Job", funcName, gil, pyOverride);
}

void JobWrapper::timerEvent(::QTimerEvent * event)
{
    static const char *funcName = "timerEvent";
    static PyObject *nameCache[2] = {};
    Shiboken::GilState gil(false);
    Shiboken::AutoDecRef pyOverride(Sbk_GetPyOverride(this, Sbk_Akonadi_Job_TypeF(), gil, funcName, m_PyMethodCache[15], nameCache));
    if (pyOverride.isNull()) {
        return this->::QObject::timerEvent(event);
    }
    TrashFilterProxyModelWrapper::sbk_o_timerEvent("Job", funcName, gil, pyOverride, event);
}

const QMetaObject *JobWrapper::metaObject() const
{
    if (QObject::d_ptr->metaObject != nullptr)
        return QObject::d_ptr->dynamicMetaObject();
    SbkObject *pySelf = Shiboken::BindingManager::instance().retrieveWrapper(this);
    if (pySelf == nullptr)
        return Akonadi::Job::metaObject();
    return PySide::SignalManager::retrieveMetaObject(reinterpret_cast<PyObject *>(pySelf));
}

int JobWrapper::qt_metacall(QMetaObject::Call call, int id, void **args)
{
    int result = Akonadi::Job::qt_metacall(call, id, args);
    return result < 0 ? result : PySide::SignalManager::qt_metacall(this, call, id, args);
}

void *JobWrapper::qt_metacast(const char *_clname)
{
    if (_clname == nullptr)
        return {};
    if (SbkObject *pySelf = Shiboken::BindingManager::instance().retrieveWrapper(this)) {
        auto *obSelf = reinterpret_cast<PyObject *>(pySelf);
        if (PySide::inherits(Py_TYPE(obSelf), _clname))
            return static_cast<void *>(const_cast< JobWrapper *>(this));
    }
    return Akonadi::Job::qt_metacast(_clname);
}

JobWrapper::~JobWrapper()
{
    auto *wrapper = Shiboken::BindingManager::instance().retrieveWrapper(this, Sbk_Akonadi_Job_TypeF());
    Shiboken::Object::destroy(wrapper, this);
}

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

extern "C" {
static int
Sbk_Akonadi_Job_Init(PyObject *self, [[maybe_unused]] PyObject *args, [[maybe_unused]] PyObject *kwds)
{
    auto *sbkSelf = reinterpret_cast<SbkObject *>(self);
    PyTypeObject *type = self->ob_type;
    PyTypeObject *myType = Shiboken::Module::get(SbkAkonadiCoreTypeStructs[SBK_Akonadi_Job_IDX]);
    if (type == myType) {
        Shiboken::Errors::setInstantiateAbstractClass("Akonadi::Job");
        return -1;
    }

    PySide::Feature::Select(self);
    if (Shiboken::Object::isUserType(self) && !Shiboken::ObjectType::canCallConstructor(self->ob_type, Shiboken::SbkType< ::Akonadi::Job >()))
        return -1;

    JobWrapper *cptr{};
    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_ParseTuple(args, "|O:Job", &(pyArgs[0])) == 0)
        return -1;


    // Overloaded function decisor
    // 0: Job::Job(QObject*=)
    if (numArgs == 0) {
        overloadId = 0; // Job(QObject*)
    } else if (numArgs >= 1
        && (pythonToCpp[0] = Shiboken::Conversions::pythonToCppPointerConversion(Shiboken::Module::get(SbkPySide6_QtCoreTypeStructs[SBK_QObject_IDX]), (pyArgs[0])))) {
        overloadId = 0; // Job::Job(QObject*=)
    }

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

    // Resolve keyword arguments
    {
        if (kwds != nullptr && PyDict_Size(kwds) > 0) {
            static const Shiboken::ArgumentNameIndexMapping mapping[1] = {{"parent", 0}};
            if (!Shiboken::parseConstructorKeywordArguments(kwds, mapping, 1, errInfo, pyArgs)
                || (pyArgs[0] != nullptr && !((pythonToCpp[0] = Shiboken::Conversions::pythonToCppPointerConversion(Shiboken::Module::get(SbkPySide6_QtCoreTypeStructs[SBK_QObject_IDX]), (pyArgs[0])))))) {
                Py_XINCREF(errInfo.object());
                return Shiboken::returnWrongArguments_MinusOne(args, "__init__", errInfo, SbkAkonadiCoreTypeStructs[SBK_Akonadi_Job_IDX]);
            }
        }
    }

    // PyMI support
    [[maybe_unused]] const bool usesPyMI = Shiboken::callInheritedInit(self, args, errInfo.isNull() ? kwds : errInfo.object(), SbkAkonadiCoreTypeStructs[SBK_Akonadi_Job_IDX]);
    if (Shiboken::Errors::occurred() != nullptr)
        return -1;

    // Call function/method
    {
        if (!Shiboken::Object::isValid(pyArgs[0]))
            return -1;
        ::QObject *cppArg0 = nullptr;
        if (pythonToCpp[0])
            pythonToCpp[0](pyArgs[0], &cppArg0);

        if (Shiboken::Errors::occurred() == nullptr) {
            // Job::Job(QObject*=)
            void *addr = PySide::nextQObjectMemoryAddr();
            if (addr != nullptr) {
                cptr = new (addr) JobWrapper(cppArg0);
                PySide::setNextQObjectMemoryAddr(nullptr);
            } else {
                cptr = new JobWrapper(cppArg0);
            }

        }
    }

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

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

    // QObject setup
    PySide::Signal::updateSourceObject(self);
    const auto *metaObject = cptr->metaObject(); // <- init python qt properties
    if (!errInfo.isNull() && PyDict_Check(errInfo.object())) {
        if (!PySide::fillQtProperties(self, metaObject, errInfo, usesPyMI))
            return Shiboken::returnWrongArguments_MinusOne(args, "__init__", errInfo, SbkAkonadiCoreTypeStructs[SBK_Akonadi_Job_IDX]);
    };


    return 1;
}

static PyObject *Sbk_Akonadi_JobFunc_addSubjob(PyObject *self, PyObject *pyArg)
{
    if (!Shiboken::Object::isValid(self))
        return {};
    [[maybe_unused]] auto *cppSelf = reinterpret_cast< ::Akonadi::Job *>(Shiboken::Conversions::cppPointer(Shiboken::Module::get(SbkAkonadiCoreTypeStructs[SBK_Akonadi_Job_IDX]), reinterpret_cast<SbkObject *>(self)));
    PyObject *pyResult{};
    Shiboken::AutoDecRef errInfo{};
    Shiboken::PythonContextMarker pcm;
    int overloadId = -1;
    [[maybe_unused]] Shiboken::Conversions::PythonToCppConversion pythonToCpp;

    // Overloaded function decisor
    // 0: KCompositeJob::addSubjob(KJob*)->bool
    if ((pythonToCpp = Shiboken::Conversions::pythonToCppPointerConversion(Shiboken::Module::get(SbkKCoreAddonsTypeStructs[SBK_KJob_IDX]), (pyArg)))) {
        overloadId = 0; // KCompositeJob::addSubjob(KJob*)->bool
    }

    // Function signature not found.
    if (overloadId == -1)
        return Shiboken::returnWrongArguments(pyArg, "addSubjob", SbkAkonadiCoreTypeStructs[SBK_Akonadi_Job_IDX]);

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

        if (Shiboken::Errors::occurred() == nullptr) {
            // KCompositeJob::addSubjob(KJob*)->bool
            bool cppResult = Shiboken::Object::hasCppWrapper(reinterpret_cast<SbkObject *>(self))
                ? cppSelf->::Akonadi::Job::addSubjob(cppArg0)
                : cppSelf->addSubjob(cppArg0);
            pyResult = Shiboken::Conversions::copyToPython(Shiboken::Conversions::PrimitiveTypeConverter<bool>(), &cppResult);
        }
    }

    return Sbk_ReturnFromPython_Result(pyResult);
}

static PyObject *Sbk_Akonadi_JobFunc_doKill(PyObject *self)
{
    if (!Shiboken::Object::isValid(self))
        return {};
    [[maybe_unused]] auto *cppSelf = reinterpret_cast< ::Akonadi::Job *>(Shiboken::Conversions::cppPointer(Shiboken::Module::get(SbkAkonadiCoreTypeStructs[SBK_Akonadi_Job_IDX]), reinterpret_cast<SbkObject *>(self)));
    PyObject *pyResult{};
    Shiboken::PythonContextMarker pcm;

    // Call function/method
    {

        // KJob::doKill()->bool
        bool cppResult = Shiboken::Object::hasCppWrapper(reinterpret_cast<SbkObject *>(self))
            ? cppSelf->::Akonadi::Job::doKill()
            : cppSelf->doKill();
        pyResult = Shiboken::Conversions::copyToPython(Shiboken::Conversions::PrimitiveTypeConverter<bool>(), &cppResult);
    }

    return Sbk_ReturnFromPython_Result(pyResult);
}

static PyObject *Sbk_Akonadi_JobFunc_doStart(PyObject *self)
{
    if (!Shiboken::Object::isValid(self))
        return {};
    [[maybe_unused]] auto *cppSelf = reinterpret_cast< ::Akonadi::Job *>(Shiboken::Conversions::cppPointer(Shiboken::Module::get(SbkAkonadiCoreTypeStructs[SBK_Akonadi_Job_IDX]), reinterpret_cast<SbkObject *>(self)));
    Shiboken::PythonContextMarker pcm;

    // Call function/method
    {

        // Job::doStart()
        if (Shiboken::Object::hasCppWrapper(reinterpret_cast<SbkObject *>(self))) {
            Shiboken::Errors::setPureVirtualMethodError("Job.doStart");
            return {};
        }
        cppSelf->doStart();
    }

     return Sbk_ReturnFromPython_None();
}

static PyObject *Sbk_Akonadi_JobFunc_emitWriteFinished(PyObject *self)
{
    if (!Shiboken::Object::isValid(self))
        return {};
    [[maybe_unused]] auto *cppSelf = reinterpret_cast< ::Akonadi::Job *>(Shiboken::Conversions::cppPointer(Shiboken::Module::get(SbkAkonadiCoreTypeStructs[SBK_Akonadi_Job_IDX]), reinterpret_cast<SbkObject *>(self)));
    Shiboken::PythonContextMarker pcm;

    // Call function/method
    {

        // Job::emitWriteFinished()
        cppSelf->emitWriteFinished();
    }

     return Sbk_ReturnFromPython_None();
}

static PyObject *Sbk_Akonadi_JobFunc_errorString(PyObject *self)
{
    if (!Shiboken::Object::isValid(self))
        return {};
    [[maybe_unused]] auto *cppSelf = reinterpret_cast< ::Akonadi::Job *>(Shiboken::Conversions::cppPointer(Shiboken::Module::get(SbkAkonadiCoreTypeStructs[SBK_Akonadi_Job_IDX]), reinterpret_cast<SbkObject *>(self)));
    PyObject *pyResult{};
    Shiboken::PythonContextMarker pcm;

    // Call function/method
    {

        // KJob::errorString()const->QString
        QString cppResult = Shiboken::Object::hasCppWrapper(reinterpret_cast<SbkObject *>(self))
            ? const_cast<const ::Akonadi::Job *>(cppSelf)->::Akonadi::Job::errorString()
            : const_cast<const ::Akonadi::Job *>(cppSelf)->errorString();
        pyResult = Shiboken::Conversions::copyToPython(SbkPySide6_QtCoreTypeConverters[SBK_QString_IDX], &cppResult);
    }

    return Sbk_ReturnFromPython_Result(pyResult);
}

static PyObject *Sbk_Akonadi_JobFunc_removeSubjob(PyObject *self, PyObject *pyArg)
{
    if (!Shiboken::Object::isValid(self))
        return {};
    [[maybe_unused]] auto *cppSelf = reinterpret_cast< ::Akonadi::Job *>(Shiboken::Conversions::cppPointer(Shiboken::Module::get(SbkAkonadiCoreTypeStructs[SBK_Akonadi_Job_IDX]), reinterpret_cast<SbkObject *>(self)));
    PyObject *pyResult{};
    Shiboken::AutoDecRef errInfo{};
    Shiboken::PythonContextMarker pcm;
    int overloadId = -1;
    [[maybe_unused]] Shiboken::Conversions::PythonToCppConversion pythonToCpp;

    // Overloaded function decisor
    // 0: KCompositeJob::removeSubjob(KJob*)->bool
    if ((pythonToCpp = Shiboken::Conversions::pythonToCppPointerConversion(Shiboken::Module::get(SbkKCoreAddonsTypeStructs[SBK_KJob_IDX]), (pyArg)))) {
        overloadId = 0; // KCompositeJob::removeSubjob(KJob*)->bool
    }

    // Function signature not found.
    if (overloadId == -1)
        return Shiboken::returnWrongArguments(pyArg, "removeSubjob", SbkAkonadiCoreTypeStructs[SBK_Akonadi_Job_IDX]);

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

        if (Shiboken::Errors::occurred() == nullptr) {
            // KCompositeJob::removeSubjob(KJob*)->bool
            bool cppResult = Shiboken::Object::hasCppWrapper(reinterpret_cast<SbkObject *>(self))
                ? cppSelf->::Akonadi::Job::removeSubjob(cppArg0)
                : cppSelf->removeSubjob(cppArg0);
            pyResult = Shiboken::Conversions::copyToPython(Shiboken::Conversions::PrimitiveTypeConverter<bool>(), &cppResult);
        }
    }

    return Sbk_ReturnFromPython_Result(pyResult);
}

static PyObject *Sbk_Akonadi_JobFunc_slotResult(PyObject *self, PyObject *pyArg)
{
    if (!Shiboken::Object::isValid(self))
        return {};
    [[maybe_unused]] auto *cppSelf = reinterpret_cast< ::Akonadi::Job *>(Shiboken::Conversions::cppPointer(Shiboken::Module::get(SbkAkonadiCoreTypeStructs[SBK_Akonadi_Job_IDX]), reinterpret_cast<SbkObject *>(self)));
    Shiboken::AutoDecRef errInfo{};
    Shiboken::PythonContextMarker pcm;
    int overloadId = -1;
    [[maybe_unused]] Shiboken::Conversions::PythonToCppConversion pythonToCpp;

    // Overloaded function decisor
    // 0: KCompositeJob::slotResult(KJob*)
    if ((pythonToCpp = Shiboken::Conversions::pythonToCppPointerConversion(Shiboken::Module::get(SbkKCoreAddonsTypeStructs[SBK_KJob_IDX]), (pyArg)))) {
        overloadId = 0; // KCompositeJob::slotResult(KJob*)
    }

    // Function signature not found.
    if (overloadId == -1)
        return Shiboken::returnWrongArguments(pyArg, "slotResult", SbkAkonadiCoreTypeStructs[SBK_Akonadi_Job_IDX]);

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

        if (Shiboken::Errors::occurred() == nullptr) {
            // KCompositeJob::slotResult(KJob*)
            Shiboken::Object::hasCppWrapper(reinterpret_cast<SbkObject *>(self))
                ? cppSelf->::Akonadi::Job::slotResult(cppArg0)
                : cppSelf->slotResult(cppArg0);
        }
    }

     return Sbk_ReturnFromPython_None();
}

static PyObject *Sbk_Akonadi_JobFunc_start(PyObject *self)
{
    if (!Shiboken::Object::isValid(self))
        return {};
    [[maybe_unused]] auto *cppSelf = reinterpret_cast< ::Akonadi::Job *>(Shiboken::Conversions::cppPointer(Shiboken::Module::get(SbkAkonadiCoreTypeStructs[SBK_Akonadi_Job_IDX]), reinterpret_cast<SbkObject *>(self)));
    Shiboken::PythonContextMarker pcm;

    // Call function/method
    {

        // KJob::start()
        Shiboken::Object::hasCppWrapper(reinterpret_cast<SbkObject *>(self))
            ? cppSelf->::Akonadi::Job::start()
            : cppSelf->start();
    }

     return Sbk_ReturnFromPython_None();
}


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

static const char *Sbk_Akonadi_Job_EnumFlagInfo[] = {
    "Error:IntEnum",
    nullptr // Sentinel
};

static PyMethodDef Sbk_Akonadi_Job_methods[] = {
    {"addSubjob", reinterpret_cast<PyCFunction>(Sbk_Akonadi_JobFunc_addSubjob), METH_O, nullptr},
    {"doKill", reinterpret_cast<PyCFunction>(Sbk_Akonadi_JobFunc_doKill), METH_NOARGS, nullptr},
    {"doStart", reinterpret_cast<PyCFunction>(Sbk_Akonadi_JobFunc_doStart), METH_NOARGS, nullptr},
    {"emitWriteFinished", reinterpret_cast<PyCFunction>(Sbk_Akonadi_JobFunc_emitWriteFinished), METH_NOARGS, nullptr},
    {"errorString", reinterpret_cast<PyCFunction>(Sbk_Akonadi_JobFunc_errorString), METH_NOARGS, nullptr},
    {"removeSubjob", reinterpret_cast<PyCFunction>(Sbk_Akonadi_JobFunc_removeSubjob), METH_O, nullptr},
    {"slotResult", reinterpret_cast<PyCFunction>(Sbk_Akonadi_JobFunc_slotResult), METH_O, nullptr},
    {"start", reinterpret_cast<PyCFunction>(Sbk_Akonadi_JobFunc_start), METH_NOARGS, nullptr},
    {nullptr, nullptr, 0, nullptr} // Sentinel
};

static int Sbk_Akonadi_Job_setattro(PyObject *self, PyObject *name, PyObject *value)
{
    PySide::Feature::Select(self);
    if (value != nullptr && PyCallable_Check(value) != 0) {
        auto plain_inst = reinterpret_cast< ::Akonadi::Job *>(Shiboken::Conversions::cppPointer(Shiboken::Module::get(SbkAkonadiCoreTypeStructs[SBK_Akonadi_Job_IDX]), reinterpret_cast<SbkObject *>(self)));
        auto *inst = dynamic_cast<JobWrapper *>(plain_inst);
        if (inst != nullptr)
            inst->resetPyMethodCache();
    }
    Shiboken::AutoDecRef pp(reinterpret_cast<PyObject *>(PySide::Property::getObject(self, name)));
    if (!pp.isNull())
        return PySide::Property::setValue(reinterpret_cast<PySideProperty *>(pp.object()), self, value);
    return PyObject_GenericSetAttr(self, name, value);
}

} // extern "C"

static int Sbk_Akonadi_Job_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_Job_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_Job_slots[] = {
    {Py_tp_base,        nullptr}, // inserted by introduceWrapperType
    {Py_tp_dealloc,     reinterpret_cast<void *>(&SbkDeallocWrapper)},
    {Py_tp_setattro,    reinterpret_cast<void *>(Sbk_Akonadi_Job_setattro)},
    {Py_tp_traverse,    reinterpret_cast<void *>(Sbk_Akonadi_Job_traverse)},
    {Py_tp_clear,       reinterpret_cast<void *>(Sbk_Akonadi_Job_clear)},
    {Py_tp_methods,     reinterpret_cast<void *>(Sbk_Akonadi_Job_methods)},
    {Py_tp_init,        reinterpret_cast<void *>(Sbk_Akonadi_Job_Init)},
    {Py_tp_new,         reinterpret_cast<void *>(SbkObject_tp_new)},
    {0, nullptr}
};
static PyType_Spec Sbk_Akonadi_Job_spec = {
    "1:AkonadiCore.Akonadi.Job",
    sizeof(SbkObject),
    0,
    Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
    Sbk_Akonadi_Job_slots
};

} //extern "C"

static void *Sbk_Akonadi_Job_typeDiscovery([[maybe_unused]] void *cptr, [[maybe_unused]] PyTypeObject *instanceType)
{
    if (instanceType == Shiboken::SbkType< ::QObject >())
        return dynamic_cast< ::Akonadi::Job *>(reinterpret_cast< ::QObject *>(cptr));
    return {};
}


// Type conversion functions.

// Python to C++ enum conversion.
static void Enum_PythonToCpp_Akonadi_Job_Error(PyObject *pyIn, void *cppOut)
{
    const auto value = static_cast<::Akonadi::Job::Error>(Shiboken::Enum::getValue(pyIn));
    *reinterpret_cast<::Akonadi::Job::Error *>(cppOut) = value;

}
static PythonToCppFunc is_Enum_PythonToCpp_Akonadi_Job_Error_Convertible(PyObject *pyIn)
{
    if (PyObject_TypeCheck(pyIn, Shiboken::Module::get(SbkAkonadiCoreTypeStructs[SBK_Akonadi_Job_Error_IDX])))
        return Enum_PythonToCpp_Akonadi_Job_Error;
    return {};
}

static PyObject *Akonadi_Job_Error_CppToPython_Enum(PyTypeObject *pyType, const void *cppIn)
{
    using IntType = std::underlying_type_t<::Akonadi::Job::Error>;
    const auto castCppIn = IntType(*reinterpret_cast<const ::Akonadi::Job::Error *>(cppIn));
    return Shiboken::Enum::newItem(pyType, castCppIn);

}

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

// C++ to Python pointer conversion - tries to find the Python wrapper for the C++ object (keeps object identity).
static PyObject *Job_PTR_CppToPython_Job(const void *cppIn)
{
    return PySide::getWrapperForQObject(reinterpret_cast<::Akonadi::Job *>(const_cast<void *>(cppIn)), Sbk_Akonadi_Job_TypeF());

}

// The signatures string for the functions.
// Multiple signatures have their index "n:" in front.
#if PYSIDE6_COMOPT_COMPRESS == 0
static const char *Akonadi_Job_SignatureStrings[] = {
    "AkonadiCore.Akonadi.Job(self,parent:PySide6.QtCore.QObject=nullptr)",
    "AkonadiCore.Akonadi.Job.addSubjob(self,job:KCoreAddons.KJob)->bool",
    "AkonadiCore.Akonadi.Job.doKill(self)->bool",
    "AkonadiCore.Akonadi.Job.doStart(self)",
    "AkonadiCore.Akonadi.Job.emitWriteFinished(self)",
    "AkonadiCore.Akonadi.Job.errorString(self)->QString",
    "AkonadiCore.Akonadi.Job.removeSubjob(self,job:KCoreAddons.KJob)->bool",
    "AkonadiCore.Akonadi.Job.slotResult(self,job:KCoreAddons.KJob)",
    "AkonadiCore.Akonadi.Job.start(self)",
    nullptr}; // Sentinel
#else
static constexpr size_t Akonadi_Job_SignatureByteSize = 177;
static constexpr uint8_t Akonadi_Job_SignatureBytes[177] = {
    0x78, 0xda, 0xa5, 0x90, 0xb1, 0x0a, 0xc2, 0x30, 0x10, 0x86, 0x77, 0x9f, 0xc4, 0x82, 0x66, 0x74,
    0x28, 0x28, 0x04, 0xc1, 0xc1, 0x0e, 0x5a, 0x33, 0x38, 0x27, 0xe6, 0xd4, 0xd4, 0x34, 0x57, 0x2e,
    0x57, 0xc1, 0xb7, 0xb7, 0xb6, 0x14, 0x1c, 0x8c, 0x0e, 0x6e, 0xff, 0xc1, 0xf7, 0x7f, 0xdc, 0x9d,
    0xbc, 0x61, 0xd0, 0xd6, 0xad, 0x91, 0x40, 0xc8, 0x21, 0x8b, 0x2d, 0x9a, 0x69, 0x04, 0x7f, 0x9e,
    0x35, 0x9a, 0x20, 0x70, 0xbe, 0x7f, 0x28, 0x67, 0x61, 0x21, 0x4a, 0xee, 0xb1, 0x72, 0x67, 0x2a,
    0x38, 0xf1, 0x32, 0xb4, 0xde, 0x37, 0x4c, 0xd9, 0x44, 0x7e, 0x76, 0x08, 0x6d, 0xad, 0x6a, 0x4d,
    0x35, 0xda, 0xba, 0x90, 0x17, 0x2f, 0x48, 0x5a, 0x8b, 0x21, 0x8a, 0xa2, 0x63, 0xb2, 0xf9, 0xca,
    0x20, 0xfa, 0xa4, 0xc2, 0x62, 0xe1, 0xbc, 0xef, 0xfb, 0xbf, 0x51, 0xc5, 0x9a, 0x78, 0x60, 0x93,
    0x14, 0xd4, 0x8e, 0x8f, 0xe4, 0x18, 0x36, 0x2e, 0xb8, 0x78, 0x05, 0xfb, 0x8b, 0x27, 0x42, 0x52,
    0x4c, 0x2e, 0x5c, 0xc6, 0x2d, 0xca, 0x61, 0x4c, 0x56, 0x08, 0x6a, 0xbc, 0xc3, 0xbf, 0x97, 0x47,
    0x8f, 0x7c, 0x80, 0xd8, 0x7a, 0xfe, 0xe2, 0x48, 0xb7, 0xdf, 0x5e, 0xf1, 0x04, 0xc8, 0xda, 0xac,
    0xe3
};
#endif

PyTypeObject *init_Akonadi_Job(PyObject *enclosingClass)
{
    auto &typeStruct = SbkAkonadiCoreTypeStructs[SBK_Akonadi_Job_IDX];
    if (typeStruct.type != nullptr)
        return typeStruct.type;

    auto *base1 = reinterpret_cast<PyObject *>(Shiboken::Module::get(SbkKCoreAddonsTypeStructs[SBK_KCompositeJob_IDX]));
    Shiboken::AutoDecRef Sbk_Akonadi_Job_Type_bases(PyTuple_Pack(1, base1));

    PyTypeObject *pyType = Shiboken::ObjectType::introduceWrapperType(
        enclosingClass,
        "Job",
        "Akonadi::Job*",
        &Sbk_Akonadi_Job_spec,
        &Shiboken::callCppDestructor< Akonadi::Job >,
        Sbk_Akonadi_Job_Type_bases.object(),
        Shiboken::ObjectType::WrapperFlags::InnerClass);
#if PYSIDE6_COMOPT_COMPRESS == 0
    InitSignatureStrings(pyType, Akonadi_Job_SignatureStrings);
#else
    InitSignatureBytes(pyType, Akonadi_Job_SignatureBytes, Akonadi_Job_SignatureByteSize);
#endif
    SbkObjectType_SetPropertyStrings(pyType, Sbk_Akonadi_Job_PropertyStrings);
    typeStruct.type = pyType;

    // Register Converter
    SbkConverter *converter = Shiboken::Conversions::createConverter(pyType,
        Job_PythonToCpp_Job_PTR,
        is_Job_PythonToCpp_Job_PTR_Convertible,
        Job_PTR_CppToPython_Job);

    Shiboken::Conversions::registerConverterName(converter, "Akonadi::Job");
    Shiboken::Conversions::registerConverterName(converter, "Akonadi::Job*");
    Shiboken::Conversions::registerConverterName(converter, "Akonadi::Job&");
    Shiboken::Conversions::registerConverterAlias(converter, "Job");
    Shiboken::Conversions::registerConverterAlias(converter, "Job*");
    Shiboken::Conversions::registerConverterAlias(converter, "Job&");
    Shiboken::Conversions::registerConverterName(converter, typeid(::Akonadi::Job).name());
    Shiboken::Conversions::registerConverterName(converter, typeid(JobWrapper).name());

    Shiboken::ObjectType::setTypeDiscoveryFunctionV2(pyType, &Sbk_Akonadi_Job_typeDiscovery);

    // Pass the ..._EnumFlagInfo to the class.
    SbkObjectType_SetEnumFlagInfo(pyType, Sbk_Akonadi_Job_EnumFlagInfo);

    // Initialization of enums.
    Shiboken::AutoDecRef tpDict{};
    [[maybe_unused]] PyTypeObject *EType{};

    // Initialization of enum 'Error'.
    const char *Error_Initializer[] = {
        "ConnectionFailed",
        "ProtocolVersionMismatch",
        "UserCanceled",
        "Unknown",
        "UserError",
        nullptr};
    // "uint8_t" used instead of "unsigned int"
    constexpr uint8_t Error_InitializerValues[] = {
        uint8_t(Akonadi::Job::Error::ConnectionFailed),        //  0x64  100
        uint8_t(Akonadi::Job::Error::ProtocolVersionMismatch), //  0x65  101
        uint8_t(Akonadi::Job::Error::UserCanceled),            //  0x66  102
        uint8_t(Akonadi::Job::Error::Unknown),                 //  0x67  103
        uint8_t(Akonadi::Job::Error::UserError)                //  0x8e  142
        };
    EType = Shiboken::Enum::createPythonEnum(pyType,
        "1:AkonadiCore.Akonadi.Job.Error",
        Error_Initializer, Error_InitializerValues);
    SbkAkonadiCoreTypeStructs[SBK_Akonadi_Job_Error_IDX].type = EType;
    // Register converter for enum 'Akonadi::Job::Error'.
    {
        SbkConverter *converter = Shiboken::Conversions::createConverter(EType,
            Akonadi_Job_Error_CppToPython_Enum);
        Shiboken::Conversions::addPythonToCppValueConversion(converter,
            Enum_PythonToCpp_Akonadi_Job_Error,
            is_Enum_PythonToCpp_Akonadi_Job_Error_Convertible);
        Shiboken::Conversions::registerConverterName(converter, "Akonadi::Job::Error");
        Shiboken::Conversions::registerConverterAlias(converter, "Job::Error");
        Shiboken::Conversions::registerConverterAlias(converter, "Error");
        Shiboken::Enum::setTypeConverter(EType, converter, nullptr);
    }
    // End of 'Error' enum.

    PySide::Signal::registerSignals(pyType, &::Akonadi::Job::staticMetaObject);
    qRegisterMetaType< ::Akonadi::Job::Error >("Job::Error");
    qRegisterMetaType< ::Akonadi::Job::Error >("Akonadi::Job::Error");
    Shiboken::ObjectType::setSubTypeInitHook(pyType, &PySide::initQObjectSubType);
    PySide::initDynamicMetaObject(pyType, &::Akonadi::Job::staticMetaObject, sizeof(JobWrapper));

    return pyType;
}
