/*
 * Interface wrapper code.
 *
 * Generated by SIP 6.15.3
 *
 * Copyright (c) 2026 Riverbank Computing Limited <info@riverbankcomputing.com>
 * 
 * This file is part of PyQt6.
 * 
 * This file may be used under the terms of the GNU General Public License
 * version 3.0 as published by the Free Software Foundation and appearing in
 * the file LICENSE included in the packaging of this file.  Please review the
 * following information to ensure the GNU General Public License version 3.0
 * requirements will be met: http://www.gnu.org/copyleft/gpl.html.
 * 
 * If you do not wish to use this file under the terms of the GPL version 3.0
 * then you may purchase a commercial license.  For more information contact
 * info@riverbankcomputing.com.
 * 
 * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
 * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
 */

#include "sipAPIQtCore.h"

#line 29 "/build/pyqt6/src/pyqt6-6.11.0/sip/QtCore/qpermissions.sip"
#include <qpermissions.h>
#line 29 "/build/pyqt6/src/pyqt6-6.11.0/build/QtCore/sipQtCoreQPermission.cpp"

#line 26 "/build/pyqt6/src/pyqt6-6.11.0/sip/QtCore/qmetatype.sip"
#include <qmetatype.h>
#line 33 "/build/pyqt6/src/pyqt6-6.11.0/build/QtCore/sipQtCoreQPermission.cpp"
#line 26 "/build/pyqt6/src/pyqt6-6.11.0/sip/QtCore/qnamespace.sip"
#include <qnamespace.h>
#line 154 "/build/pyqt6/src/pyqt6-6.11.0/sip/QtCore/qtextstream.sip"
#include <qtextstream.h>
#line 38 "/build/pyqt6/src/pyqt6-6.11.0/build/QtCore/sipQtCoreQPermission.cpp"


PyDoc_STRVAR(doc_QPermission_status, "status(self) -> Qt.PermissionStatus");

extern "C" {static PyObject *meth_QPermission_status(PyObject *, PyObject *);}
static PyObject *meth_QPermission_status(PyObject *sipSelf, PyObject *sipArgs)
{
    PyObject *sipParseErr = SIP_NULLPTR;

    {
        const ::QPermission *sipCpp;

        if (sipParseArgs(&sipParseErr, sipArgs, "B", &sipSelf, sipType_QPermission, &sipCpp))
        {
            ::Qt::PermissionStatus sipRes;

            sipRes = sipCpp->status();

            return sipConvertFromEnum(static_cast<int>(sipRes), sipType_Qt_PermissionStatus);
        }
    }

    sipNoMethod(sipParseErr, sipName_QPermission, sipName_status, doc_QPermission_status);

    return SIP_NULLPTR;
}


PyDoc_STRVAR(doc_QPermission_type, "type(self) -> QMetaType");

extern "C" {static PyObject *meth_QPermission_type(PyObject *, PyObject *);}
static PyObject *meth_QPermission_type(PyObject *sipSelf, PyObject *sipArgs)
{
    PyObject *sipParseErr = SIP_NULLPTR;

    {
        const ::QPermission *sipCpp;

        if (sipParseArgs(&sipParseErr, sipArgs, "B", &sipSelf, sipType_QPermission, &sipCpp))
        {
            ::QMetaType*sipRes;

            sipRes = reinterpret_cast< ::QMetaType *>(::operator new(sizeof (::QMetaType)));
            *sipRes = sipCpp->type();

            return sipConvertFromNewType(sipRes, sipType_QMetaType, SIP_NULLPTR);
        }
    }

    sipNoMethod(sipParseErr, sipName_QPermission, sipName_type, doc_QPermission_type);

    return SIP_NULLPTR;
}


PyDoc_STRVAR(doc_QPermission_value, "value(self) -> Any");

extern "C" {static PyObject *meth_QPermission_value(PyObject *, PyObject *);}
static PyObject *meth_QPermission_value(PyObject *sipSelf, PyObject *sipArgs)
{
    PyObject *sipParseErr = SIP_NULLPTR;

    {
        const ::QPermission *sipCpp;

        if (sipParseArgs(&sipParseErr, sipArgs, "B", &sipSelf, sipType_QPermission, &sipCpp))
        {
            PyObject * sipRes = SIP_NULLPTR;

#line 76 "/build/pyqt6/src/pyqt6-6.11.0/sip/QtCore/qpermissions.sip"
        const sipTypeDef *td = SIP_NULLPTR;
        void *perm = SIP_NULLPTR;
        QMetaType mt = sipCpp->type();
        
        if (mt == QMetaType::fromType<QBluetoothPermission>())
        {
            std::optional<QBluetoothPermission> opt_perm = sipCpp->value<QBluetoothPermission>();
        
            if (opt_perm)
            {
                perm = new QBluetoothPermission(opt_perm.value());
                td = sipType_QBluetoothPermission;
            }
        }
        else if (mt == QMetaType::fromType<QCalendarPermission>())
        {
            std::optional<QCalendarPermission> opt_perm = sipCpp->value<QCalendarPermission>();
        
            if (opt_perm)
            {
                perm = new QCalendarPermission(opt_perm.value());
                td = sipType_QCalendarPermission;
            }
        }
        else if (mt == QMetaType::fromType<QCameraPermission>())
        {
            std::optional<QCameraPermission> opt_perm = sipCpp->value<QCameraPermission>();
        
            if (opt_perm)
            {
                perm = new QCameraPermission(opt_perm.value());
                td = sipType_QCameraPermission;
            }
        }
        else if (mt == QMetaType::fromType<QContactsPermission>())
        {
            std::optional<QContactsPermission> opt_perm = sipCpp->value<QContactsPermission>();
        
            if (opt_perm)
            {
                perm = new QContactsPermission(opt_perm.value());
                td = sipType_QContactsPermission;
            }
        }
        else if (mt == QMetaType::fromType<QLocationPermission>())
        {
            std::optional<QLocationPermission> opt_perm = sipCpp->value<QLocationPermission>();
        
            if (opt_perm)
            {
                perm = new QLocationPermission(opt_perm.value());
                td = sipType_QLocationPermission;
            }
        }
        else if (mt == QMetaType::fromType<QMicrophonePermission>())
        {
            std::optional<QMicrophonePermission> opt_perm = sipCpp->value<QMicrophonePermission>();
        
            if (opt_perm)
            {
                perm = new QMicrophonePermission(opt_perm.value());
                td = sipType_QMicrophonePermission;
            }
        }
        
        if (perm)
        {
            sipRes = sipConvertFromNewType(perm, td, SIP_NULLPTR);
        }
        else
        {
            sipRes = Py_None;
            Py_INCREF(sipRes);
        }
#line 183 "/build/pyqt6/src/pyqt6-6.11.0/build/QtCore/sipQtCoreQPermission.cpp"

            return sipRes;
        }
    }

    sipNoMethod(sipParseErr, sipName_QPermission, sipName_value, doc_QPermission_value);

    return SIP_NULLPTR;
}


/* Call the instance's destructor. */
extern "C" {static void release_QPermission(void *, int);}
static void release_QPermission(void *sipCppV, int)
{
    delete reinterpret_cast< ::QPermission *>(sipCppV);
}


extern "C" {static void *array_QPermission(Py_ssize_t);}
static void *array_QPermission(Py_ssize_t sipNrElem)
{
    return new ::QPermission[sipNrElem];
}


extern "C" {static void array_delete_QPermission(void *);}
static void array_delete_QPermission(void *sipCpp)
{
    delete[] reinterpret_cast< ::QPermission *>(sipCpp);
}


extern "C" {static void assign_QPermission(void *, Py_ssize_t, void *);}
static void assign_QPermission(void *sipDst, Py_ssize_t sipDstIdx, void *sipSrc)
{
    reinterpret_cast< ::QPermission *>(sipDst)[sipDstIdx] = *reinterpret_cast< ::QPermission *>(sipSrc);
}


extern "C" {static void *copy_QPermission(const void *, Py_ssize_t);}
static void *copy_QPermission(const void *sipSrc, Py_ssize_t sipSrcIdx)
{
    return new ::QPermission(reinterpret_cast<const ::QPermission *>(sipSrc)[sipSrcIdx]);
}


extern "C" {static void dealloc_QPermission(sipSimpleWrapper *);}
static void dealloc_QPermission(sipSimpleWrapper *sipSelf)
{
    if (sipIsOwnedByPython(sipSelf))
    {
        release_QPermission(sipGetAddress(sipSelf), 0);
    }
}


extern "C" {static void *init_type_QPermission(sipSimpleWrapper *, PyObject *, PyObject *, PyObject **, PyObject **, PyObject **);}
static void *init_type_QPermission(sipSimpleWrapper *, PyObject *sipArgs, PyObject *sipKwds, PyObject **sipUnused, PyObject **, PyObject **sipParseErr)
{
    ::QPermission *sipCpp = SIP_NULLPTR;

    {
        if (sipParseKwdArgs(sipParseErr, sipArgs, sipKwds, SIP_NULLPTR, sipUnused, ""))
        {
            sipCpp = new ::QPermission();

            return sipCpp;
        }
    }

    {
        const ::QPermission* a0;
        int a0State = 0;

        if (sipParseKwdArgs(sipParseErr, sipArgs, sipKwds, SIP_NULLPTR, sipUnused, "J1", sipType_QPermission, &a0, &a0State))
        {
            sipCpp = new ::QPermission(*a0);
            sipReleaseType(const_cast< ::QPermission *>(a0), sipType_QPermission, a0State);

            return sipCpp;
        }
    }

    return SIP_NULLPTR;
}


extern "C" {static int convertTo_QPermission(PyObject *, void **, int *, PyObject *, void **);}
static int convertTo_QPermission(PyObject *sipPy, void **sipCppPtrV, int *sipIsErr, PyObject *sipTransferObj, void **)
{
    ::QPermission **sipCppPtr = reinterpret_cast< ::QPermission **>(sipCppPtrV);

#line 33 "/build/pyqt6/src/pyqt6-6.11.0/sip/QtCore/qpermissions.sip"
// Note that we don't allow sub-classes of the typed permissions.
const sipTypeDef *td = sipTypeFromPyTypeObject(Py_TYPE(sipPy));

if (!sipIsErr)
    return (td == sipType_QBluetoothPermission ||
            td == sipType_QCalendarPermission ||
            td == sipType_QCameraPermission ||
            td == sipType_QContactsPermission ||
            td == sipType_QLocationPermission ||
            td == sipType_QMicrophonePermission);

void *cpp = sipConvertToType(sipPy, td, sipTransferObj, SIP_NOT_NONE, NULL, sipIsErr);

if (*sipIsErr)
    return 0;

if (td == sipType_QBluetoothPermission)
    *sipCppPtr = new QPermission(*reinterpret_cast<QBluetoothPermission *>(cpp));

else if (td == sipType_QCalendarPermission)
    *sipCppPtr = new QPermission(*reinterpret_cast<QCalendarPermission *>(cpp));

else if (td == sipType_QCameraPermission)
    *sipCppPtr = new QPermission(*reinterpret_cast<QCameraPermission *>(cpp));

else if (td == sipType_QContactsPermission)
    *sipCppPtr = new QPermission(*reinterpret_cast<QContactsPermission *>(cpp));

else if (td == sipType_QLocationPermission)
    *sipCppPtr = new QPermission(*reinterpret_cast<QLocationPermission *>(cpp));

else if (td == sipType_QMicrophonePermission)
    *sipCppPtr = new QPermission(*reinterpret_cast<QMicrophonePermission *>(cpp));

return sipGetState(sipTransferObj);
#line 313 "/build/pyqt6/src/pyqt6-6.11.0/build/QtCore/sipQtCoreQPermission.cpp"
}


static PyMethodDef methods_QPermission[] = {
    {sipName_status, meth_QPermission_status, METH_VARARGS, doc_QPermission_status},
    {sipName_type, meth_QPermission_type, METH_VARARGS, doc_QPermission_type},
    {sipName_value, meth_QPermission_value, METH_VARARGS, doc_QPermission_value}
};

PyDoc_STRVAR(doc_QPermission, "\1QPermission()\n"
"QPermission(a0: QPermission)");


sipClassTypeDef sipTypeDef_QtCore_QPermission = {
    {
        SIP_NULLPTR,
        SIP_TYPE_SUPER_INIT|SIP_TYPE_LIMITED_API|SIP_TYPE_CLASS,
        sipNameNr_QPermission,
        SIP_NULLPTR,
        SIP_NULLPTR,
    },
    {
        sipNameNr_QPermission,
        {0, 0, 1},
        3, methods_QPermission,
        0, SIP_NULLPTR,
        {SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR},
    },
    doc_QPermission,
    -1,
    sipNameNr_PyQt6_sip_simplewrapper,
    SIP_NULLPTR,
    SIP_NULLPTR,
    init_type_QPermission,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    dealloc_QPermission,
    assign_QPermission,
    array_QPermission,
    copy_QPermission,
    release_QPermission,
    SIP_NULLPTR,
    convertTo_QPermission,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    array_delete_QPermission,
    sizeof (::QPermission),
};
