// WARNING: Please don't edit this file. It was generated by Python/WinRT v1.0.0-beta.9

#include "pybase.h"
#include "py.Windows.ApplicationModel.Resources.Management.h"


namespace py::cpp::Windows::ApplicationModel::Resources::Management
{
    struct module_state
    {
        PyObject* type_IndexedResourceType;
        PyTypeObject* type_IndexedResourceCandidate;
        PyTypeObject* type_IndexedResourceQualifier;
        PyTypeObject* type_ResourceIndexer;
    };

    static PyObject* register_IndexedResourceType(PyObject* module, PyObject* type) noexcept
    {
        auto state = reinterpret_cast<module_state*>(PyModule_GetState(module));
        assert(state);

        if (state->type_IndexedResourceType)
        {
            PyErr_SetString(PyExc_RuntimeError, "type has already been registered");
            return nullptr;
        }

        if (!PyType_Check(type))
        {
            PyErr_SetString(PyExc_TypeError, "argument is not a type");
            return nullptr;
        }

        state->type_IndexedResourceType = type;
        Py_INCREF(state->type_IndexedResourceType);


        Py_RETURN_NONE;
    }

    // ----- IndexedResourceCandidate class --------------------
    static constexpr const char* const type_name_IndexedResourceCandidate = "IndexedResourceCandidate";

    static PyObject* _new_IndexedResourceCandidate(PyTypeObject* type, PyObject* args, PyObject* kwds) noexcept
    {
        py::set_invalid_activation_error(type_name_IndexedResourceCandidate);
        return nullptr;
    }

    static void _dealloc_IndexedResourceCandidate(py::wrapper::Windows::ApplicationModel::Resources::Management::IndexedResourceCandidate* self) noexcept
    {
        auto tp = Py_TYPE(self);

        if (PyType_IS_GC(tp))
        {
            PyObject_GC_UnTrack(self);
        }

        std::destroy_at(&self->obj);
        tp->tp_free(self);
        Py_DECREF(tp);
    }

    static PyObject* IndexedResourceCandidate_GetQualifierValue(py::wrapper::Windows::ApplicationModel::Resources::Management::IndexedResourceCandidate* self, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_Size(args);

        if (arg_count == 1)
        {
            if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.ApplicationModel.Resources.Management.IndexedResourceCandidate", L"GetQualifierValue", 1))
            {
                py::set_arg_count_version_error(1);
                return nullptr;
            }

            try
            {
                auto param0 = py::convert_to<winrt::hstring>(args, 0);

                return py::convert(self->obj.GetQualifierValue(param0));
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* IndexedResourceCandidate_get_Metadata(py::wrapper::Windows::ApplicationModel::Resources::Management::IndexedResourceCandidate* self, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.ApplicationModel.Resources.Management.IndexedResourceCandidate", L"Metadata"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return nullptr;
        }

        try
        {
            return py::convert(self->obj.Metadata());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* IndexedResourceCandidate_get_Qualifiers(py::wrapper::Windows::ApplicationModel::Resources::Management::IndexedResourceCandidate* self, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.ApplicationModel.Resources.Management.IndexedResourceCandidate", L"Qualifiers"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return nullptr;
        }

        try
        {
            return py::convert(self->obj.Qualifiers());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* IndexedResourceCandidate_get_Type(py::wrapper::Windows::ApplicationModel::Resources::Management::IndexedResourceCandidate* self, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.ApplicationModel.Resources.Management.IndexedResourceCandidate", L"Type"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return nullptr;
        }

        try
        {
            return py::convert(self->obj.Type());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* IndexedResourceCandidate_get_Uri(py::wrapper::Windows::ApplicationModel::Resources::Management::IndexedResourceCandidate* self, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.ApplicationModel.Resources.Management.IndexedResourceCandidate", L"Uri"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return nullptr;
        }

        try
        {
            return py::convert(self->obj.Uri());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* IndexedResourceCandidate_get_ValueAsString(py::wrapper::Windows::ApplicationModel::Resources::Management::IndexedResourceCandidate* self, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.ApplicationModel.Resources.Management.IndexedResourceCandidate", L"ValueAsString"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return nullptr;
        }

        try
        {
            return py::convert(self->obj.ValueAsString());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* _assign_array_IndexedResourceCandidate(PyObject* /*unused*/, PyObject* arg) noexcept
    {
        auto array = std::make_unique<py::ComArray<winrt::Windows::ApplicationModel::Resources::Management::IndexedResourceCandidate>>();
        if (!py::cpp::_winrt::Array_Assign(arg, std::move(array)))
        {
            return nullptr;
        }
        Py_RETURN_NONE;
    }

    static PyObject* _from_IndexedResourceCandidate(PyObject* /*unused*/, PyObject* arg) noexcept
    {
        try
        {
            auto return_value = py::convert_to<winrt::Windows::Foundation::IInspectable>(arg);
            return py::convert(return_value.as<winrt::Windows::ApplicationModel::Resources::Management::IndexedResourceCandidate>());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyMethodDef _methods_IndexedResourceCandidate[] = {
        { "get_qualifier_value", reinterpret_cast<PyCFunction>(IndexedResourceCandidate_GetQualifierValue), METH_VARARGS, nullptr },
        { "_assign_array_", _assign_array_IndexedResourceCandidate, METH_O | METH_STATIC, nullptr },
        { "_from", reinterpret_cast<PyCFunction>(_from_IndexedResourceCandidate), METH_O | METH_STATIC, nullptr },
        { }
    };

    static PyGetSetDef _getset_IndexedResourceCandidate[] = {
        { "metadata", reinterpret_cast<getter>(IndexedResourceCandidate_get_Metadata), nullptr, nullptr, nullptr },
        { "qualifiers", reinterpret_cast<getter>(IndexedResourceCandidate_get_Qualifiers), nullptr, nullptr, nullptr },
        { "type", reinterpret_cast<getter>(IndexedResourceCandidate_get_Type), nullptr, nullptr, nullptr },
        { "uri", reinterpret_cast<getter>(IndexedResourceCandidate_get_Uri), nullptr, nullptr, nullptr },
        { "value_as_string", reinterpret_cast<getter>(IndexedResourceCandidate_get_ValueAsString), nullptr, nullptr, nullptr },
        { }
    };

    static PyType_Slot _type_slots_IndexedResourceCandidate[] = 
    {
        { Py_tp_new, reinterpret_cast<void*>(_new_IndexedResourceCandidate) },
        { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_IndexedResourceCandidate) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_IndexedResourceCandidate) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_IndexedResourceCandidate) },
        { },
    };

    static PyType_Spec type_spec_IndexedResourceCandidate =
    {
        "_winsdk_Windows_ApplicationModel_Resources_Management.IndexedResourceCandidate",
        sizeof(py::wrapper::Windows::ApplicationModel::Resources::Management::IndexedResourceCandidate),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_IndexedResourceCandidate
    };

    // ----- IndexedResourceQualifier class --------------------
    static constexpr const char* const type_name_IndexedResourceQualifier = "IndexedResourceQualifier";

    static PyObject* _new_IndexedResourceQualifier(PyTypeObject* type, PyObject* args, PyObject* kwds) noexcept
    {
        py::set_invalid_activation_error(type_name_IndexedResourceQualifier);
        return nullptr;
    }

    static void _dealloc_IndexedResourceQualifier(py::wrapper::Windows::ApplicationModel::Resources::Management::IndexedResourceQualifier* self) noexcept
    {
        auto tp = Py_TYPE(self);

        if (PyType_IS_GC(tp))
        {
            PyObject_GC_UnTrack(self);
        }

        std::destroy_at(&self->obj);
        tp->tp_free(self);
        Py_DECREF(tp);
    }

    static PyObject* IndexedResourceQualifier_get_QualifierName(py::wrapper::Windows::ApplicationModel::Resources::Management::IndexedResourceQualifier* self, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.ApplicationModel.Resources.Management.IndexedResourceQualifier", L"QualifierName"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return nullptr;
        }

        try
        {
            return py::convert(self->obj.QualifierName());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* IndexedResourceQualifier_get_QualifierValue(py::wrapper::Windows::ApplicationModel::Resources::Management::IndexedResourceQualifier* self, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.ApplicationModel.Resources.Management.IndexedResourceQualifier", L"QualifierValue"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return nullptr;
        }

        try
        {
            return py::convert(self->obj.QualifierValue());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* _assign_array_IndexedResourceQualifier(PyObject* /*unused*/, PyObject* arg) noexcept
    {
        auto array = std::make_unique<py::ComArray<winrt::Windows::ApplicationModel::Resources::Management::IndexedResourceQualifier>>();
        if (!py::cpp::_winrt::Array_Assign(arg, std::move(array)))
        {
            return nullptr;
        }
        Py_RETURN_NONE;
    }

    static PyObject* _from_IndexedResourceQualifier(PyObject* /*unused*/, PyObject* arg) noexcept
    {
        try
        {
            auto return_value = py::convert_to<winrt::Windows::Foundation::IInspectable>(arg);
            return py::convert(return_value.as<winrt::Windows::ApplicationModel::Resources::Management::IndexedResourceQualifier>());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyMethodDef _methods_IndexedResourceQualifier[] = {
        { "_assign_array_", _assign_array_IndexedResourceQualifier, METH_O | METH_STATIC, nullptr },
        { "_from", reinterpret_cast<PyCFunction>(_from_IndexedResourceQualifier), METH_O | METH_STATIC, nullptr },
        { }
    };

    static PyGetSetDef _getset_IndexedResourceQualifier[] = {
        { "qualifier_name", reinterpret_cast<getter>(IndexedResourceQualifier_get_QualifierName), nullptr, nullptr, nullptr },
        { "qualifier_value", reinterpret_cast<getter>(IndexedResourceQualifier_get_QualifierValue), nullptr, nullptr, nullptr },
        { }
    };

    static PyType_Slot _type_slots_IndexedResourceQualifier[] = 
    {
        { Py_tp_new, reinterpret_cast<void*>(_new_IndexedResourceQualifier) },
        { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_IndexedResourceQualifier) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_IndexedResourceQualifier) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_IndexedResourceQualifier) },
        { },
    };

    static PyType_Spec type_spec_IndexedResourceQualifier =
    {
        "_winsdk_Windows_ApplicationModel_Resources_Management.IndexedResourceQualifier",
        sizeof(py::wrapper::Windows::ApplicationModel::Resources::Management::IndexedResourceQualifier),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_IndexedResourceQualifier
    };

    // ----- ResourceIndexer class --------------------
    static constexpr const char* const type_name_ResourceIndexer = "ResourceIndexer";

    static PyObject* _new_ResourceIndexer(PyTypeObject* type, PyObject* args, PyObject* kwds) noexcept
    {
        if (kwds != nullptr)
        {
            py::set_invalid_kwd_args_error();
            return nullptr;
        }

        auto arg_count = PyTuple_Size(args);
        if (arg_count == 2)
        {
            try
            {
                auto param0 = py::convert_to<winrt::Windows::Foundation::Uri>(args, 0);
                auto param1 = py::convert_to<winrt::Windows::Foundation::Uri>(args, 1);

                winrt::Windows::ApplicationModel::Resources::Management::ResourceIndexer instance{ param0, param1 };
                return py::wrap(instance, type);
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else if (arg_count == 1)
        {
            try
            {
                auto param0 = py::convert_to<winrt::Windows::Foundation::Uri>(args, 0);

                winrt::Windows::ApplicationModel::Resources::Management::ResourceIndexer instance{ param0 };
                return py::wrap(instance, type);
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static void _dealloc_ResourceIndexer(py::wrapper::Windows::ApplicationModel::Resources::Management::ResourceIndexer* self) noexcept
    {
        auto tp = Py_TYPE(self);

        if (PyType_IS_GC(tp))
        {
            PyObject_GC_UnTrack(self);
        }

        std::destroy_at(&self->obj);
        tp->tp_free(self);
        Py_DECREF(tp);
    }

    static PyObject* ResourceIndexer_IndexFileContentsAsync(py::wrapper::Windows::ApplicationModel::Resources::Management::ResourceIndexer* self, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_Size(args);

        if (arg_count == 1)
        {
            if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.ApplicationModel.Resources.Management.ResourceIndexer", L"IndexFileContentsAsync", 1))
            {
                py::set_arg_count_version_error(1);
                return nullptr;
            }

            try
            {
                auto param0 = py::convert_to<winrt::Windows::Foundation::Uri>(args, 0);

                return py::convert(self->obj.IndexFileContentsAsync(param0));
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* ResourceIndexer_IndexFilePath(py::wrapper::Windows::ApplicationModel::Resources::Management::ResourceIndexer* self, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_Size(args);

        if (arg_count == 1)
        {
            if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.ApplicationModel.Resources.Management.ResourceIndexer", L"IndexFilePath", 1))
            {
                py::set_arg_count_version_error(1);
                return nullptr;
            }

            try
            {
                auto param0 = py::convert_to<winrt::Windows::Foundation::Uri>(args, 0);

                return py::convert(self->obj.IndexFilePath(param0));
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* _assign_array_ResourceIndexer(PyObject* /*unused*/, PyObject* arg) noexcept
    {
        auto array = std::make_unique<py::ComArray<winrt::Windows::ApplicationModel::Resources::Management::ResourceIndexer>>();
        if (!py::cpp::_winrt::Array_Assign(arg, std::move(array)))
        {
            return nullptr;
        }
        Py_RETURN_NONE;
    }

    static PyObject* _from_ResourceIndexer(PyObject* /*unused*/, PyObject* arg) noexcept
    {
        try
        {
            auto return_value = py::convert_to<winrt::Windows::Foundation::IInspectable>(arg);
            return py::convert(return_value.as<winrt::Windows::ApplicationModel::Resources::Management::ResourceIndexer>());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyMethodDef _methods_ResourceIndexer[] = {
        { "index_file_contents_async", reinterpret_cast<PyCFunction>(ResourceIndexer_IndexFileContentsAsync), METH_VARARGS, nullptr },
        { "index_file_path", reinterpret_cast<PyCFunction>(ResourceIndexer_IndexFilePath), METH_VARARGS, nullptr },
        { "_assign_array_", _assign_array_ResourceIndexer, METH_O | METH_STATIC, nullptr },
        { "_from", reinterpret_cast<PyCFunction>(_from_ResourceIndexer), METH_O | METH_STATIC, nullptr },
        { }
    };

    static PyGetSetDef _getset_ResourceIndexer[] = {
        { }
    };

    static PyType_Slot _type_slots_ResourceIndexer[] = 
    {
        { Py_tp_new, reinterpret_cast<void*>(_new_ResourceIndexer) },
        { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_ResourceIndexer) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_ResourceIndexer) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_ResourceIndexer) },
        { },
    };

    static PyType_Spec type_spec_ResourceIndexer =
    {
        "_winsdk_Windows_ApplicationModel_Resources_Management.ResourceIndexer",
        sizeof(py::wrapper::Windows::ApplicationModel::Resources::Management::ResourceIndexer),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_ResourceIndexer
    };

    // ----- Windows.ApplicationModel.Resources.Management Initialization --------------------
    PyDoc_STRVAR(module_doc, "Windows::ApplicationModel::Resources::Management");

    static PyMethodDef module_methods[] = {
        {"_register_IndexedResourceType", register_IndexedResourceType, METH_O, "registers type"},
        {}};


    static int module_traverse(PyObject* module, visitproc visit, void* arg) noexcept
    {
        auto state = reinterpret_cast<module_state*>(PyModule_GetState(module));

        if (!state)
        {
            return 0;
        }

        Py_VISIT(state->type_IndexedResourceType);
        Py_VISIT(state->type_IndexedResourceCandidate);
        Py_VISIT(state->type_IndexedResourceQualifier);
        Py_VISIT(state->type_ResourceIndexer);

        return 0;
    }

    static int module_clear(PyObject* module) noexcept
    {
        auto state = reinterpret_cast<module_state*>(PyModule_GetState(module));

        if (!state)
        {
            return 0;
        }

        Py_CLEAR(state->type_IndexedResourceType);
        Py_CLEAR(state->type_IndexedResourceCandidate);
        Py_CLEAR(state->type_IndexedResourceQualifier);
        Py_CLEAR(state->type_ResourceIndexer);

        return 0;
    }


    static PyModuleDef module_def
        = {PyModuleDef_HEAD_INIT,
           "_winsdk_Windows_ApplicationModel_Resources_Management",
           module_doc,
           sizeof(module_state),
           module_methods,
           nullptr,
           module_traverse,
           module_clear,
           nullptr};

} // py::cpp::Windows::ApplicationModel::Resources::Management

PyMODINIT_FUNC PyInit__winsdk_Windows_ApplicationModel_Resources_Management(void) noexcept
{
    using namespace py::cpp::Windows::ApplicationModel::Resources::Management;

    py::pyobj_handle module{PyModule_Create(&module_def)};

    if (!module)
    {
        return nullptr;
    }

    auto object_type = py::get_python_type<py::Object>();
    if (!object_type)
    {
        return nullptr;
    }

    py::pyobj_handle bases{PyTuple_Pack(1, object_type)};

    if (!bases)
    {
        return nullptr;
    }

    py::pyobj_handle collections_abc_module{PyImport_ImportModule("collections.abc")};

    if (!collections_abc_module)
    {
        return nullptr;
    }

    py::pyobj_handle sequence_type{PyObject_GetAttrString(collections_abc_module.get(), "Sequence")};

    if (!sequence_type)
    {
        return nullptr;
    }

    py::pyobj_handle sequence_bases{PyTuple_Pack(2, object_type, sequence_type.get())};

    if (!sequence_bases)
    {
        return nullptr;
    }

    py::pyobj_handle mutable_sequence_type{PyObject_GetAttrString(collections_abc_module.get(), "MutableSequence")};

    if (!mutable_sequence_type)
    {
        return nullptr;
    }

    py::pyobj_handle mutable_sequence_bases{PyTuple_Pack(2, object_type, mutable_sequence_type.get())};

    if (!mutable_sequence_bases)
    {
        return nullptr;
    }

    py::pyobj_handle mapping_type{PyObject_GetAttrString(collections_abc_module.get(), "Mapping")};

    if (!mapping_type)
    {
        return nullptr;
    }

    py::pyobj_handle mapping_bases{PyTuple_Pack(2, object_type, mapping_type.get())};

    if (!mapping_bases)
    {
        return nullptr;
    }

    py::pyobj_handle mutable_mapping_type{PyObject_GetAttrString(collections_abc_module.get(), "MutableMapping")};

    if (!mutable_mapping_type)
    {
        return nullptr;
    }

    py::pyobj_handle mutable_mapping_bases{PyTuple_Pack(2, object_type, mutable_mapping_type.get())};

    if (!mutable_mapping_bases)
    {
        return nullptr;
    }

    auto state = reinterpret_cast<module_state*>(PyModule_GetState(module.get()));
    assert(state);

    state->type_IndexedResourceCandidate = py::register_python_type(module.get(), type_name_IndexedResourceCandidate, &type_spec_IndexedResourceCandidate, bases.get(), nullptr);
    if (!state->type_IndexedResourceCandidate)
    {
        return nullptr;
    }

    state->type_IndexedResourceQualifier = py::register_python_type(module.get(), type_name_IndexedResourceQualifier, &type_spec_IndexedResourceQualifier, bases.get(), nullptr);
    if (!state->type_IndexedResourceQualifier)
    {
        return nullptr;
    }

    state->type_ResourceIndexer = py::register_python_type(module.get(), type_name_ResourceIndexer, &type_spec_ResourceIndexer, bases.get(), nullptr);
    if (!state->type_ResourceIndexer)
    {
        return nullptr;
    }


    return module.detach();
}

PyObject* py::py_type<winrt::Windows::ApplicationModel::Resources::Management::IndexedResourceType>::get_python_type() noexcept {
    using namespace py::cpp::Windows::ApplicationModel::Resources::Management;

    PyObject* module = PyState_FindModule(&module_def);

    if (!module) {
        PyErr_SetString(PyExc_RuntimeError, "could not find module for Windows::ApplicationModel::Resources::Management");
        return nullptr;
    }

    auto state = reinterpret_cast<module_state*>(PyModule_GetState(module));
    assert(state);

    auto python_type = state->type_IndexedResourceType;

    if (!python_type) {
        PyErr_SetString(PyExc_RuntimeError, "type winrt::Windows::ApplicationModel::Resources::Management::IndexedResourceType is not registered");
        return nullptr;
    }

    return python_type;
}

PyTypeObject* py::winrt_type<winrt::Windows::ApplicationModel::Resources::Management::IndexedResourceCandidate>::get_python_type() noexcept {
    using namespace py::cpp::Windows::ApplicationModel::Resources::Management;

    PyObject* module = PyState_FindModule(&module_def);

    if (!module) {
        PyErr_SetString(PyExc_RuntimeError, "could not find module for Windows::ApplicationModel::Resources::Management");
        return nullptr;
    }

    auto state = reinterpret_cast<module_state*>(PyModule_GetState(module));
    assert(state);

    auto python_type = state->type_IndexedResourceCandidate;

    if (!python_type) {
        PyErr_SetString(PyExc_RuntimeError, "type winrt::Windows::ApplicationModel::Resources::Management::IndexedResourceCandidate is not registered");
        return nullptr;
    }

    return python_type;
}

PyTypeObject* py::winrt_type<winrt::Windows::ApplicationModel::Resources::Management::IndexedResourceQualifier>::get_python_type() noexcept {
    using namespace py::cpp::Windows::ApplicationModel::Resources::Management;

    PyObject* module = PyState_FindModule(&module_def);

    if (!module) {
        PyErr_SetString(PyExc_RuntimeError, "could not find module for Windows::ApplicationModel::Resources::Management");
        return nullptr;
    }

    auto state = reinterpret_cast<module_state*>(PyModule_GetState(module));
    assert(state);

    auto python_type = state->type_IndexedResourceQualifier;

    if (!python_type) {
        PyErr_SetString(PyExc_RuntimeError, "type winrt::Windows::ApplicationModel::Resources::Management::IndexedResourceQualifier is not registered");
        return nullptr;
    }

    return python_type;
}

PyTypeObject* py::winrt_type<winrt::Windows::ApplicationModel::Resources::Management::ResourceIndexer>::get_python_type() noexcept {
    using namespace py::cpp::Windows::ApplicationModel::Resources::Management;

    PyObject* module = PyState_FindModule(&module_def);

    if (!module) {
        PyErr_SetString(PyExc_RuntimeError, "could not find module for Windows::ApplicationModel::Resources::Management");
        return nullptr;
    }

    auto state = reinterpret_cast<module_state*>(PyModule_GetState(module));
    assert(state);

    auto python_type = state->type_ResourceIndexer;

    if (!python_type) {
        PyErr_SetString(PyExc_RuntimeError, "type winrt::Windows::ApplicationModel::Resources::Management::ResourceIndexer is not registered");
        return nullptr;
    }

    return python_type;
}
