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

// Argument includes
#include <QString>
#include <exceptions.h>

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

using namespace KCalendarCore;

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

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

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

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

extern "C" {
static int Sbk_KCalendarCore_CalFormat_Init(PyObject *, PyObject *, PyObject *)
{
    Shiboken::Errors::setInstantiateNonConstructible("CalFormat");
    return -1;
}

static PyObject *Sbk_KCalendarCore_CalFormatFunc_application([[maybe_unused]] PyObject *self)
{
    PyObject *pyResult{};
    Shiboken::PythonContextMarker pcm;

    // Call function/method
    {

        // static CalFormat::application()->const QString&
        const QString & cppResult = ::KCalendarCore::CalFormat::application();
        pyResult = Shiboken::Conversions::copyToPython(SbkPySide6_QtCoreTypeConverters[SBK_QString_IDX], &cppResult);
    }

    return Sbk_ReturnFromPython_Result(pyResult);
}

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

    // Call function/method
    {

        // CalFormat::clearException()
        cppSelf->clearException();
    }

     return Sbk_ReturnFromPython_None();
}

static PyObject *Sbk_KCalendarCore_CalFormatFunc_createUniqueId([[maybe_unused]] PyObject *self)
{
    PyObject *pyResult{};
    Shiboken::PythonContextMarker pcm;

    // Call function/method
    {

        // static CalFormat::createUniqueId()->QString
        QString cppResult = ::KCalendarCore::CalFormat::createUniqueId();
        pyResult = Shiboken::Conversions::copyToPython(SbkPySide6_QtCoreTypeConverters[SBK_QString_IDX], &cppResult);
    }

    return Sbk_ReturnFromPython_Result(pyResult);
}

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

    // Call function/method
    {

        // CalFormat::exception()const->KCalendarCore::Exception*
        KCalendarCore::Exception * cppResult = const_cast<const ::KCalendarCore::CalFormat *>(cppSelf)->exception();
        pyResult = Shiboken::Conversions::pointerToPython(Shiboken::Module::get(SbkKCalendarCoreTypeStructs[SBK_KCalendarCore_Exception_IDX]), cppResult);
    }

    return Sbk_ReturnFromPython_Result(pyResult);
}

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

    // Call function/method
    {

        // CalFormat::loadedProductId()->QString
        QString cppResult = cppSelf->loadedProductId();
        pyResult = Shiboken::Conversions::copyToPython(SbkPySide6_QtCoreTypeConverters[SBK_QString_IDX], &cppResult);
    }

    return Sbk_ReturnFromPython_Result(pyResult);
}

static PyObject *Sbk_KCalendarCore_CalFormatFunc_productId([[maybe_unused]] PyObject *self)
{
    PyObject *pyResult{};
    Shiboken::PythonContextMarker pcm;

    // Call function/method
    {

        // static CalFormat::productId()->const QString&
        const QString & cppResult = ::KCalendarCore::CalFormat::productId();
        pyResult = Shiboken::Conversions::copyToPython(SbkPySide6_QtCoreTypeConverters[SBK_QString_IDX], &cppResult);
    }

    return Sbk_ReturnFromPython_Result(pyResult);
}

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


    // Overloaded function decisor
    // 0: static CalFormat::setApplication(const QString&,const QString&)
    if (numArgs == 2
        && (pythonToCpp[0] = Shiboken::Conversions::pythonToCppConversion(SbkPySide6_QtCoreTypeConverters[SBK_QString_IDX], (pyArgs[0])))
        && (pythonToCpp[1] = Shiboken::Conversions::pythonToCppConversion(SbkPySide6_QtCoreTypeConverters[SBK_QString_IDX], (pyArgs[1])))) {
        overloadId = 0; // static CalFormat::setApplication(const QString&,const QString&)
    }

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

    // Call function/method
    {
        ::QString cppArg0;
        pythonToCpp[0](pyArgs[0], &cppArg0);
        ::QString cppArg1;
        pythonToCpp[1](pyArgs[1], &cppArg1);

        if (Shiboken::Errors::occurred() == nullptr) {
            // static CalFormat::setApplication(const QString&,const QString&)
            ::KCalendarCore::CalFormat::setApplication(cppArg0, cppArg1);
        }
    }

     return Sbk_ReturnFromPython_None();
}

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

    // Overloaded function decisor
    // 0: CalFormat::setException(KCalendarCore::Exception*)
    if ((pythonToCpp = Shiboken::Conversions::pythonToCppPointerConversion(Shiboken::Module::get(SbkKCalendarCoreTypeStructs[SBK_KCalendarCore_Exception_IDX]), (pyArg)))) {
        overloadId = 0; // CalFormat::setException(KCalendarCore::Exception*)
    }

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

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

        if (Shiboken::Errors::occurred() == nullptr) {
            // CalFormat::setException(KCalendarCore::Exception*)
            cppSelf->setException(cppArg0);
        }
    }

     return Sbk_ReturnFromPython_None();
}

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

    // Overloaded function decisor
    // 0: CalFormat::setLoadedProductId(const QString&)
    if ((pythonToCpp = Shiboken::Conversions::pythonToCppConversion(SbkPySide6_QtCoreTypeConverters[SBK_QString_IDX], (pyArg)))) {
        overloadId = 0; // CalFormat::setLoadedProductId(const QString&)
    }

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

    // Call function/method
    {
        ::QString cppArg0;
        pythonToCpp(pyArg, &cppArg0);

        if (Shiboken::Errors::occurred() == nullptr) {
            // CalFormat::setLoadedProductId(const QString&)
            cppSelf->setLoadedProductId(cppArg0);
        }
    }

     return Sbk_ReturnFromPython_None();
}


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

static PyMethodDef Sbk_KCalendarCore_CalFormat_methods[] = {
    {"application", reinterpret_cast<PyCFunction>(Sbk_KCalendarCore_CalFormatFunc_application), METH_NOARGS|METH_STATIC, nullptr},
    {"clearException", reinterpret_cast<PyCFunction>(Sbk_KCalendarCore_CalFormatFunc_clearException), METH_NOARGS, nullptr},
    {"createUniqueId", reinterpret_cast<PyCFunction>(Sbk_KCalendarCore_CalFormatFunc_createUniqueId), METH_NOARGS|METH_STATIC, nullptr},
    {"exception", reinterpret_cast<PyCFunction>(Sbk_KCalendarCore_CalFormatFunc_exception), METH_NOARGS, nullptr},
    {"loadedProductId", reinterpret_cast<PyCFunction>(Sbk_KCalendarCore_CalFormatFunc_loadedProductId), METH_NOARGS, nullptr},
    {"productId", reinterpret_cast<PyCFunction>(Sbk_KCalendarCore_CalFormatFunc_productId), METH_NOARGS|METH_STATIC, nullptr},
    {"setApplication", reinterpret_cast<PyCFunction>(Sbk_KCalendarCore_CalFormatFunc_setApplication), METH_VARARGS|METH_STATIC, nullptr},
    {"setException", reinterpret_cast<PyCFunction>(Sbk_KCalendarCore_CalFormatFunc_setException), METH_O, nullptr},
    {"setLoadedProductId", reinterpret_cast<PyCFunction>(Sbk_KCalendarCore_CalFormatFunc_setLoadedProductId), METH_O, nullptr},
    {nullptr, nullptr, 0, nullptr} // Sentinel
};

} // extern "C"

static int Sbk_KCalendarCore_CalFormat_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_CalFormat_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_CalFormat_slots[] = {
    {Py_tp_base,        nullptr}, // inserted by introduceWrapperType
    {Py_tp_dealloc,     reinterpret_cast<void *>(&SbkDeallocWrapper)},
    {Py_tp_traverse,    reinterpret_cast<void *>(Sbk_KCalendarCore_CalFormat_traverse)},
    {Py_tp_clear,       reinterpret_cast<void *>(Sbk_KCalendarCore_CalFormat_clear)},
    {Py_tp_methods,     reinterpret_cast<void *>(Sbk_KCalendarCore_CalFormat_methods)},
    {Py_tp_init,        reinterpret_cast<void *>(Sbk_KCalendarCore_CalFormat_Init)},
    {Py_tp_new,         reinterpret_cast<void *>(SbkDummyNew /* PYSIDE-595: Prevent replacement of "0" with base->tp_new. */)},
    {0, nullptr}
};
static PyType_Spec Sbk_KCalendarCore_CalFormat_spec = {
    "1:KCalendarCore.KCalendarCore.CalFormat",
    sizeof(SbkObject),
    0,
    Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
    Sbk_KCalendarCore_CalFormat_slots
};

} //extern "C"

// Type conversion functions.

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

// C++ to Python pointer conversion - tries to find the Python wrapper for the C++ object (keeps object identity).
static PyObject *CalFormat_PTR_CppToPython_CalFormat(const void *cppIn)
{
    auto *pyOut = reinterpret_cast<PyObject *>(Shiboken::BindingManager::instance().retrieveWrapper(cppIn, Sbk_KCalendarCore_CalFormat_TypeF()));
    if (pyOut) {
        Py_INCREF(pyOut);
        return pyOut;
    }
    auto *tCppIn = reinterpret_cast<const ::KCalendarCore::CalFormat *>(cppIn);
    const char *typeName = typeid(*tCppIn).name();
    return Shiboken::Object::newObjectForPointer(Sbk_KCalendarCore_CalFormat_TypeF(), const_cast<void *>(cppIn), false, typeName);

}

// The signatures string for the functions.
// Multiple signatures have their index "n:" in front.
#if PYSIDE6_COMOPT_COMPRESS == 0
static const char *KCalendarCore_CalFormat_SignatureStrings[] = {
    "KCalendarCore.KCalendarCore.CalFormat.application()->QString",
    "KCalendarCore.KCalendarCore.CalFormat.clearException(self)",
    "KCalendarCore.KCalendarCore.CalFormat.createUniqueId()->QString",
    "KCalendarCore.KCalendarCore.CalFormat.exception(self)->KCalendarCore.KCalendarCore.Exception",
    "KCalendarCore.KCalendarCore.CalFormat.loadedProductId(self)->QString",
    "KCalendarCore.KCalendarCore.CalFormat.productId()->QString",
    "KCalendarCore.KCalendarCore.CalFormat.setApplication(application:QString,productID:QString)",
    "KCalendarCore.KCalendarCore.CalFormat.setException(self,error:KCalendarCore.KCalendarCore.Exception)",
    "KCalendarCore.KCalendarCore.CalFormat.setLoadedProductId(self,id:QString)",
    nullptr}; // Sentinel
#else
static constexpr size_t KCalendarCore_CalFormat_SignatureByteSize = 171;
static constexpr uint8_t KCalendarCore_CalFormat_SignatureBytes[171] = {
    0x78, 0xda, 0x95, 0x91, 0xc1, 0x0a, 0xc2, 0x30, 0x10, 0x44, 0xef, 0x7e, 0x89, 0x81, 0xb4, 0x1f,
    0xd0, 0x43, 0x41, 0xaa, 0x82, 0xd4, 0x83, 0x22, 0x7e, 0xc0, 0x92, 0xac, 0x12, 0x88, 0xd9, 0xb8,
    0x4d, 0xc1, 0xcf, 0xb7, 0x48, 0x5b, 0x1b, 0x10, 0x49, 0x8e, 0xb3, 0xf0, 0x66, 0x86, 0x9d, 0xb6,
    0x01, 0x8b, 0x4e, 0x03, 0x37, 0xc4, 0x58, 0xb6, 0x91, 0x1a, 0xc4, 0x9e, 0xf8, 0x01, 0xa1, 0x04,
    0xef, 0xad, 0x51, 0x10, 0x0c, 0xb9, 0xb5, 0x28, 0xea, 0xf3, 0x25, 0xb0, 0x71, 0xf7, 0x55, 0x9b,
    0x04, 0x2b, 0x8b, 0xc0, 0xbb, 0x97, 0x42, 0xff, 0xe1, 0x3b, 0xb4, 0x37, 0x91, 0x8a, 0x32, 0x42,
    0xc0, 0xab, 0x33, 0xcf, 0x1e, 0x0f, 0x3a, 0x3f, 0x1a, 0xe3, 0xd4, 0xa2, 0xfe, 0x87, 0xcd, 0x15,
    0x13, 0xcd, 0x2d, 0x81, 0x46, 0x7d, 0x62, 0xd2, 0xbd, 0x0a, 0x43, 0xbb, 0x31, 0x22, 0xaf, 0xa1,
    0x9f, 0xf1, 0x6c, 0xb4, 0xc3, 0xb0, 0x59, 0xec, 0xb2, 0xd8, 0xa8, 0x1a, 0x8d, 0xe4, 0xe4, 0xbe,
    0x9d, 0x2e, 0x22, 0xdd, 0x3b, 0x5e, 0x4c, 0x22, 0x33, 0x71, 0x95, 0xf4, 0xbf, 0x8c, 0x90, 0xe3,
    0x8f, 0x1f, 0x4a, 0xa3, 0xbf, 0x75, 0xdf, 0xf0, 0x27, 0xf5, 0x73
};
#endif

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

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

    PyTypeObject *pyType = Shiboken::ObjectType::introduceWrapperType(
        enclosingClass,
        "CalFormat",
        "KCalendarCore::CalFormat*",
        &Sbk_KCalendarCore_CalFormat_spec,
        &Shiboken::callCppDestructor< KCalendarCore::CalFormat >,
        Sbk_KCalendarCore_CalFormat_Type_bases.object(),
        Shiboken::ObjectType::WrapperFlags::InnerClass);
#if PYSIDE6_COMOPT_COMPRESS == 0
    InitSignatureStrings(pyType, KCalendarCore_CalFormat_SignatureStrings);
#else
    InitSignatureBytes(pyType, KCalendarCore_CalFormat_SignatureBytes, KCalendarCore_CalFormat_SignatureByteSize);
#endif
    SbkObjectType_SetPropertyStrings(pyType, Sbk_KCalendarCore_CalFormat_PropertyStrings);
    typeStruct.type = pyType;

    // Register Converter
    SbkConverter *converter = Shiboken::Conversions::createConverter(pyType,
        CalFormat_PythonToCpp_CalFormat_PTR,
        is_CalFormat_PythonToCpp_CalFormat_PTR_Convertible,
        CalFormat_PTR_CppToPython_CalFormat);

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

    qRegisterMetaType< ::KCalendarCore::CalFormat *>();

    return pyType;
}
