// WARNING: Please don't edit this file. It was generated by Python/WinRT v2.1.0

#include "py.Windows.Foundation.Collections.h"

namespace py::cpp::Windows::Foundation::Collections
{
    // ----- PropertySet class --------------------

    static PyObject* _new_PropertySet(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 == 0)
        {
            try
            {
                winrt::Windows::Foundation::Collections::PropertySet instance{  };
                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_PropertySet(py::wrapper::Windows::Foundation::Collections::PropertySet* self) noexcept
    {
        auto tp = Py_TYPE(self);
        std::destroy_at(&self->obj);
        tp->tp_free(self);
        Py_DECREF(tp);
    }

    static PyObject* PropertySet_Clear(py::wrapper::Windows::Foundation::Collections::PropertySet* self, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_Size(args);

        if (arg_count == 0)
        {
            try
            {
                if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Foundation.Collections.PropertySet", L"Clear", 0))
                {
                    py::set_arg_count_version_error(0);
                    return nullptr;
                }

                self->obj.Clear();
                Py_RETURN_NONE;
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* PropertySet_First(py::wrapper::Windows::Foundation::Collections::PropertySet* self, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_Size(args);

        if (arg_count == 0)
        {
            try
            {
                if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Foundation.Collections.PropertySet", L"First", 0))
                {
                    py::set_arg_count_version_error(0);
                    return nullptr;
                }

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

    static PyObject* PropertySet_GetView(py::wrapper::Windows::Foundation::Collections::PropertySet* self, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_Size(args);

        if (arg_count == 0)
        {
            try
            {
                if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Foundation.Collections.PropertySet", L"GetView", 0))
                {
                    py::set_arg_count_version_error(0);
                    return nullptr;
                }

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

    static PyObject* PropertySet_HasKey(py::wrapper::Windows::Foundation::Collections::PropertySet* self, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_Size(args);

        if (arg_count == 1)
        {
            try
            {
                if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Foundation.Collections.PropertySet", L"HasKey", 1))
                {
                    py::set_arg_count_version_error(1);
                    return nullptr;
                }

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

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

    static PyObject* PropertySet_Insert(py::wrapper::Windows::Foundation::Collections::PropertySet* self, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_Size(args);

        if (arg_count == 2)
        {
            try
            {
                if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Foundation.Collections.PropertySet", L"Insert", 2))
                {
                    py::set_arg_count_version_error(2);
                    return nullptr;
                }

                auto param0 = py::convert_to<winrt::hstring>(args, 0);
                auto param1 = py::convert_to<winrt::Windows::Foundation::IInspectable>(args, 1);

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

    static PyObject* PropertySet_Lookup(py::wrapper::Windows::Foundation::Collections::PropertySet* self, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_Size(args);

        if (arg_count == 1)
        {
            try
            {
                if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Foundation.Collections.PropertySet", L"Lookup", 1))
                {
                    py::set_arg_count_version_error(1);
                    return nullptr;
                }

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

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

    static PyObject* PropertySet_Remove(py::wrapper::Windows::Foundation::Collections::PropertySet* self, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_Size(args);

        if (arg_count == 1)
        {
            try
            {
                if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Foundation.Collections.PropertySet", L"Remove", 1))
                {
                    py::set_arg_count_version_error(1);
                    return nullptr;
                }

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

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

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

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

    static PyObject* PropertySet_add_MapChanged(py::wrapper::Windows::Foundation::Collections::PropertySet* self, PyObject* arg) noexcept
    {
        try
        {
            if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsEventPresent(L"Windows.Foundation.Collections.PropertySet", L"MapChanged"))
            {
                PyErr_SetString(PyExc_AttributeError, "event is not available in this version of Windows");
                return nullptr;
            }

            auto param0 = py::convert_to<winrt::Windows::Foundation::Collections::MapChangedEventHandler<winrt::hstring, winrt::Windows::Foundation::IInspectable>>(arg);

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

    static PyObject* PropertySet_remove_MapChanged(py::wrapper::Windows::Foundation::Collections::PropertySet* self, PyObject* arg) noexcept
    {
        try
        {
            if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsEventPresent(L"Windows.Foundation.Collections.PropertySet", L"MapChanged"))
            {
                PyErr_SetString(PyExc_AttributeError, "event is not available in this version of Windows");
                return nullptr;
            }

            auto param0 = py::convert_to<winrt::event_token>(arg);

            self->obj.MapChanged(param0);
            Py_RETURN_NONE;
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* _assign_array_PropertySet(PyObject* /*unused*/, PyObject* arg) noexcept
    {
        auto array = std::make_unique<py::ComArray<winrt::Windows::Foundation::Collections::PropertySet>>();
        if (!py::cpp::_winrt::Array_Assign(arg, std::move(array)))
        {
            return nullptr;
        }
        Py_RETURN_NONE;
    }

    static PyObject* _from_PropertySet(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::Foundation::Collections::PropertySet>());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* _iterator_PropertySet(py::wrapper::Windows::Foundation::Collections::PropertySet* self) noexcept
    {
        try
        {
            py::pyobj_handle iter{py::convert(self->obj.First())};

            if (!iter)
            {
                return nullptr;
            }

            return py::wrap_mapping_iter(iter.get());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static int _map_contains_PropertySet(py::wrapper::Windows::Foundation::Collections::PropertySet* self, PyObject* key) noexcept
    {
        try
        {
            return static_cast<int>(self->obj.HasKey(py::convert_to<winrt::hstring>(key)));
        }
        catch (...)
        {
            py::to_PyErr();
            return -1;
        }
    }

    static Py_ssize_t _map_length_PropertySet(py::wrapper::Windows::Foundation::Collections::PropertySet* self) noexcept
    {
        try
        {
            return static_cast<Py_ssize_t>(self->obj.Size());
        }
        catch (...)
        {
            py::to_PyErr();
            return -1;
        }
    }

    static PyObject* _map_subscript_PropertySet(py::wrapper::Windows::Foundation::Collections::PropertySet* self, PyObject* key) noexcept
    {
        try
        {
            auto _key = py::convert_to<winrt::hstring>(key);
            auto value = self->obj.TryLookup(_key);

            if (!value) {
                if constexpr (std::is_base_of_v<winrt::Windows::Foundation::IUnknown, decltype(value)>)
                {
                    if (self->obj.HasKey(_key))
                    {
                        Py_RETURN_NONE;
                    }
                }

                PyErr_SetObject(PyExc_KeyError, key);
                return nullptr;
            }

            return py::convert(value);
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static int _map_assign_PropertySet(py::wrapper::Windows::Foundation::Collections::PropertySet* self, PyObject* key, PyObject* value) noexcept
    {
        try
        {
            auto _key = py::convert_to<winrt::hstring>(key);

            if (value == nullptr) {
                if (!self->obj.TryRemove(_key)) {
                    PyErr_SetObject(PyExc_KeyError, key);
                    return -1;
                }

                return 0;
            }

            self->obj.Insert(_key, py::convert_to<winrt::Windows::Foundation::IInspectable>(value));

            return 0;
        }
        catch (...)
        {
            py::to_PyErr();
            return -1;
        }
    }

    static PyMethodDef _methods_PropertySet[] = {
        { "clear", reinterpret_cast<PyCFunction>(PropertySet_Clear), METH_VARARGS, nullptr },
        { "first", reinterpret_cast<PyCFunction>(PropertySet_First), METH_VARARGS, nullptr },
        { "get_view", reinterpret_cast<PyCFunction>(PropertySet_GetView), METH_VARARGS, nullptr },
        { "has_key", reinterpret_cast<PyCFunction>(PropertySet_HasKey), METH_VARARGS, nullptr },
        { "insert", reinterpret_cast<PyCFunction>(PropertySet_Insert), METH_VARARGS, nullptr },
        { "lookup", reinterpret_cast<PyCFunction>(PropertySet_Lookup), METH_VARARGS, nullptr },
        { "remove", reinterpret_cast<PyCFunction>(PropertySet_Remove), METH_VARARGS, nullptr },
        { "add_map_changed", reinterpret_cast<PyCFunction>(PropertySet_add_MapChanged), METH_O, nullptr },
        { "remove_map_changed", reinterpret_cast<PyCFunction>(PropertySet_remove_MapChanged), METH_O, nullptr },
        { "_assign_array_", _assign_array_PropertySet, METH_O | METH_STATIC, nullptr },
        { "_from", reinterpret_cast<PyCFunction>(_from_PropertySet), METH_O | METH_STATIC, nullptr },
        { }
    };

    static PyGetSetDef _getset_PropertySet[] = {
        { "size", reinterpret_cast<getter>(PropertySet_get_Size), nullptr, nullptr, nullptr },
        { }
    };

    static PyType_Slot _type_slots_PropertySet[] = {
        { Py_tp_new, reinterpret_cast<void*>(_new_PropertySet) },
        { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_PropertySet) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_PropertySet) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_PropertySet) },
        { Py_tp_iter, reinterpret_cast<void*>(_iterator_PropertySet) },
        { Py_sq_contains, reinterpret_cast<void*>(_map_contains_PropertySet) },
        { Py_mp_length, reinterpret_cast<void*>(_map_length_PropertySet) },
        { Py_mp_subscript, reinterpret_cast<void*>(_map_subscript_PropertySet) },
        { Py_mp_ass_subscript, reinterpret_cast<void*>(_map_assign_PropertySet) },
        { }
    };

    static PyType_Spec type_spec_PropertySet = {
        "winrt._winrt_windows_foundation_collections.PropertySet",
        sizeof(py::wrapper::Windows::Foundation::Collections::PropertySet),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_PropertySet};

    // ----- StringMap class --------------------

    static PyObject* _new_StringMap(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 == 0)
        {
            try
            {
                winrt::Windows::Foundation::Collections::StringMap instance{  };
                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_StringMap(py::wrapper::Windows::Foundation::Collections::StringMap* self) noexcept
    {
        auto tp = Py_TYPE(self);
        std::destroy_at(&self->obj);
        tp->tp_free(self);
        Py_DECREF(tp);
    }

    static PyObject* StringMap_Clear(py::wrapper::Windows::Foundation::Collections::StringMap* self, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_Size(args);

        if (arg_count == 0)
        {
            try
            {
                if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Foundation.Collections.StringMap", L"Clear", 0))
                {
                    py::set_arg_count_version_error(0);
                    return nullptr;
                }

                self->obj.Clear();
                Py_RETURN_NONE;
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* StringMap_First(py::wrapper::Windows::Foundation::Collections::StringMap* self, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_Size(args);

        if (arg_count == 0)
        {
            try
            {
                if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Foundation.Collections.StringMap", L"First", 0))
                {
                    py::set_arg_count_version_error(0);
                    return nullptr;
                }

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

    static PyObject* StringMap_GetView(py::wrapper::Windows::Foundation::Collections::StringMap* self, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_Size(args);

        if (arg_count == 0)
        {
            try
            {
                if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Foundation.Collections.StringMap", L"GetView", 0))
                {
                    py::set_arg_count_version_error(0);
                    return nullptr;
                }

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

    static PyObject* StringMap_HasKey(py::wrapper::Windows::Foundation::Collections::StringMap* self, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_Size(args);

        if (arg_count == 1)
        {
            try
            {
                if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Foundation.Collections.StringMap", L"HasKey", 1))
                {
                    py::set_arg_count_version_error(1);
                    return nullptr;
                }

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

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

    static PyObject* StringMap_Insert(py::wrapper::Windows::Foundation::Collections::StringMap* self, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_Size(args);

        if (arg_count == 2)
        {
            try
            {
                if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Foundation.Collections.StringMap", L"Insert", 2))
                {
                    py::set_arg_count_version_error(2);
                    return nullptr;
                }

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

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

    static PyObject* StringMap_Lookup(py::wrapper::Windows::Foundation::Collections::StringMap* self, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_Size(args);

        if (arg_count == 1)
        {
            try
            {
                if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Foundation.Collections.StringMap", L"Lookup", 1))
                {
                    py::set_arg_count_version_error(1);
                    return nullptr;
                }

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

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

    static PyObject* StringMap_Remove(py::wrapper::Windows::Foundation::Collections::StringMap* self, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_Size(args);

        if (arg_count == 1)
        {
            try
            {
                if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Foundation.Collections.StringMap", L"Remove", 1))
                {
                    py::set_arg_count_version_error(1);
                    return nullptr;
                }

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

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

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

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

    static PyObject* StringMap_add_MapChanged(py::wrapper::Windows::Foundation::Collections::StringMap* self, PyObject* arg) noexcept
    {
        try
        {
            if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsEventPresent(L"Windows.Foundation.Collections.StringMap", L"MapChanged"))
            {
                PyErr_SetString(PyExc_AttributeError, "event is not available in this version of Windows");
                return nullptr;
            }

            auto param0 = py::convert_to<winrt::Windows::Foundation::Collections::MapChangedEventHandler<winrt::hstring, winrt::hstring>>(arg);

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

    static PyObject* StringMap_remove_MapChanged(py::wrapper::Windows::Foundation::Collections::StringMap* self, PyObject* arg) noexcept
    {
        try
        {
            if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsEventPresent(L"Windows.Foundation.Collections.StringMap", L"MapChanged"))
            {
                PyErr_SetString(PyExc_AttributeError, "event is not available in this version of Windows");
                return nullptr;
            }

            auto param0 = py::convert_to<winrt::event_token>(arg);

            self->obj.MapChanged(param0);
            Py_RETURN_NONE;
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* _assign_array_StringMap(PyObject* /*unused*/, PyObject* arg) noexcept
    {
        auto array = std::make_unique<py::ComArray<winrt::Windows::Foundation::Collections::StringMap>>();
        if (!py::cpp::_winrt::Array_Assign(arg, std::move(array)))
        {
            return nullptr;
        }
        Py_RETURN_NONE;
    }

    static PyObject* _from_StringMap(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::Foundation::Collections::StringMap>());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* _iterator_StringMap(py::wrapper::Windows::Foundation::Collections::StringMap* self) noexcept
    {
        try
        {
            py::pyobj_handle iter{py::convert(self->obj.First())};

            if (!iter)
            {
                return nullptr;
            }

            return py::wrap_mapping_iter(iter.get());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static int _map_contains_StringMap(py::wrapper::Windows::Foundation::Collections::StringMap* self, PyObject* key) noexcept
    {
        try
        {
            return static_cast<int>(self->obj.HasKey(py::convert_to<winrt::hstring>(key)));
        }
        catch (...)
        {
            py::to_PyErr();
            return -1;
        }
    }

    static Py_ssize_t _map_length_StringMap(py::wrapper::Windows::Foundation::Collections::StringMap* self) noexcept
    {
        try
        {
            return static_cast<Py_ssize_t>(self->obj.Size());
        }
        catch (...)
        {
            py::to_PyErr();
            return -1;
        }
    }

    static PyObject* _map_subscript_StringMap(py::wrapper::Windows::Foundation::Collections::StringMap* self, PyObject* key) noexcept
    {
        try
        {
            auto _key = py::convert_to<winrt::hstring>(key);
            auto value = self->obj.TryLookup(_key);

            if (!value) {
                if constexpr (std::is_base_of_v<winrt::Windows::Foundation::IUnknown, decltype(value)>)
                {
                    if (self->obj.HasKey(_key))
                    {
                        Py_RETURN_NONE;
                    }
                }

                PyErr_SetObject(PyExc_KeyError, key);
                return nullptr;
            }

            return py::convert(value);
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static int _map_assign_StringMap(py::wrapper::Windows::Foundation::Collections::StringMap* self, PyObject* key, PyObject* value) noexcept
    {
        try
        {
            auto _key = py::convert_to<winrt::hstring>(key);

            if (value == nullptr) {
                if (!self->obj.TryRemove(_key)) {
                    PyErr_SetObject(PyExc_KeyError, key);
                    return -1;
                }

                return 0;
            }

            self->obj.Insert(_key, py::convert_to<winrt::hstring>(value));

            return 0;
        }
        catch (...)
        {
            py::to_PyErr();
            return -1;
        }
    }

    static PyMethodDef _methods_StringMap[] = {
        { "clear", reinterpret_cast<PyCFunction>(StringMap_Clear), METH_VARARGS, nullptr },
        { "first", reinterpret_cast<PyCFunction>(StringMap_First), METH_VARARGS, nullptr },
        { "get_view", reinterpret_cast<PyCFunction>(StringMap_GetView), METH_VARARGS, nullptr },
        { "has_key", reinterpret_cast<PyCFunction>(StringMap_HasKey), METH_VARARGS, nullptr },
        { "insert", reinterpret_cast<PyCFunction>(StringMap_Insert), METH_VARARGS, nullptr },
        { "lookup", reinterpret_cast<PyCFunction>(StringMap_Lookup), METH_VARARGS, nullptr },
        { "remove", reinterpret_cast<PyCFunction>(StringMap_Remove), METH_VARARGS, nullptr },
        { "add_map_changed", reinterpret_cast<PyCFunction>(StringMap_add_MapChanged), METH_O, nullptr },
        { "remove_map_changed", reinterpret_cast<PyCFunction>(StringMap_remove_MapChanged), METH_O, nullptr },
        { "_assign_array_", _assign_array_StringMap, METH_O | METH_STATIC, nullptr },
        { "_from", reinterpret_cast<PyCFunction>(_from_StringMap), METH_O | METH_STATIC, nullptr },
        { }
    };

    static PyGetSetDef _getset_StringMap[] = {
        { "size", reinterpret_cast<getter>(StringMap_get_Size), nullptr, nullptr, nullptr },
        { }
    };

    static PyType_Slot _type_slots_StringMap[] = {
        { Py_tp_new, reinterpret_cast<void*>(_new_StringMap) },
        { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_StringMap) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_StringMap) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_StringMap) },
        { Py_tp_iter, reinterpret_cast<void*>(_iterator_StringMap) },
        { Py_sq_contains, reinterpret_cast<void*>(_map_contains_StringMap) },
        { Py_mp_length, reinterpret_cast<void*>(_map_length_StringMap) },
        { Py_mp_subscript, reinterpret_cast<void*>(_map_subscript_StringMap) },
        { Py_mp_ass_subscript, reinterpret_cast<void*>(_map_assign_StringMap) },
        { }
    };

    static PyType_Spec type_spec_StringMap = {
        "winrt._winrt_windows_foundation_collections.StringMap",
        sizeof(py::wrapper::Windows::Foundation::Collections::StringMap),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_StringMap};

    // ----- ValueSet class --------------------

    static PyObject* _new_ValueSet(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 == 0)
        {
            try
            {
                winrt::Windows::Foundation::Collections::ValueSet instance{  };
                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_ValueSet(py::wrapper::Windows::Foundation::Collections::ValueSet* self) noexcept
    {
        auto tp = Py_TYPE(self);
        std::destroy_at(&self->obj);
        tp->tp_free(self);
        Py_DECREF(tp);
    }

    static PyObject* ValueSet_Clear(py::wrapper::Windows::Foundation::Collections::ValueSet* self, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_Size(args);

        if (arg_count == 0)
        {
            try
            {
                if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Foundation.Collections.ValueSet", L"Clear", 0))
                {
                    py::set_arg_count_version_error(0);
                    return nullptr;
                }

                self->obj.Clear();
                Py_RETURN_NONE;
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* ValueSet_First(py::wrapper::Windows::Foundation::Collections::ValueSet* self, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_Size(args);

        if (arg_count == 0)
        {
            try
            {
                if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Foundation.Collections.ValueSet", L"First", 0))
                {
                    py::set_arg_count_version_error(0);
                    return nullptr;
                }

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

    static PyObject* ValueSet_GetView(py::wrapper::Windows::Foundation::Collections::ValueSet* self, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_Size(args);

        if (arg_count == 0)
        {
            try
            {
                if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Foundation.Collections.ValueSet", L"GetView", 0))
                {
                    py::set_arg_count_version_error(0);
                    return nullptr;
                }

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

    static PyObject* ValueSet_HasKey(py::wrapper::Windows::Foundation::Collections::ValueSet* self, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_Size(args);

        if (arg_count == 1)
        {
            try
            {
                if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Foundation.Collections.ValueSet", L"HasKey", 1))
                {
                    py::set_arg_count_version_error(1);
                    return nullptr;
                }

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

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

    static PyObject* ValueSet_Insert(py::wrapper::Windows::Foundation::Collections::ValueSet* self, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_Size(args);

        if (arg_count == 2)
        {
            try
            {
                if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Foundation.Collections.ValueSet", L"Insert", 2))
                {
                    py::set_arg_count_version_error(2);
                    return nullptr;
                }

                auto param0 = py::convert_to<winrt::hstring>(args, 0);
                auto param1 = py::convert_to<winrt::Windows::Foundation::IInspectable>(args, 1);

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

    static PyObject* ValueSet_Lookup(py::wrapper::Windows::Foundation::Collections::ValueSet* self, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_Size(args);

        if (arg_count == 1)
        {
            try
            {
                if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Foundation.Collections.ValueSet", L"Lookup", 1))
                {
                    py::set_arg_count_version_error(1);
                    return nullptr;
                }

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

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

    static PyObject* ValueSet_Remove(py::wrapper::Windows::Foundation::Collections::ValueSet* self, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_Size(args);

        if (arg_count == 1)
        {
            try
            {
                if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Foundation.Collections.ValueSet", L"Remove", 1))
                {
                    py::set_arg_count_version_error(1);
                    return nullptr;
                }

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

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

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

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

    static PyObject* ValueSet_add_MapChanged(py::wrapper::Windows::Foundation::Collections::ValueSet* self, PyObject* arg) noexcept
    {
        try
        {
            if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsEventPresent(L"Windows.Foundation.Collections.ValueSet", L"MapChanged"))
            {
                PyErr_SetString(PyExc_AttributeError, "event is not available in this version of Windows");
                return nullptr;
            }

            auto param0 = py::convert_to<winrt::Windows::Foundation::Collections::MapChangedEventHandler<winrt::hstring, winrt::Windows::Foundation::IInspectable>>(arg);

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

    static PyObject* ValueSet_remove_MapChanged(py::wrapper::Windows::Foundation::Collections::ValueSet* self, PyObject* arg) noexcept
    {
        try
        {
            if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsEventPresent(L"Windows.Foundation.Collections.ValueSet", L"MapChanged"))
            {
                PyErr_SetString(PyExc_AttributeError, "event is not available in this version of Windows");
                return nullptr;
            }

            auto param0 = py::convert_to<winrt::event_token>(arg);

            self->obj.MapChanged(param0);
            Py_RETURN_NONE;
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* _assign_array_ValueSet(PyObject* /*unused*/, PyObject* arg) noexcept
    {
        auto array = std::make_unique<py::ComArray<winrt::Windows::Foundation::Collections::ValueSet>>();
        if (!py::cpp::_winrt::Array_Assign(arg, std::move(array)))
        {
            return nullptr;
        }
        Py_RETURN_NONE;
    }

    static PyObject* _from_ValueSet(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::Foundation::Collections::ValueSet>());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* _iterator_ValueSet(py::wrapper::Windows::Foundation::Collections::ValueSet* self) noexcept
    {
        try
        {
            py::pyobj_handle iter{py::convert(self->obj.First())};

            if (!iter)
            {
                return nullptr;
            }

            return py::wrap_mapping_iter(iter.get());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static int _map_contains_ValueSet(py::wrapper::Windows::Foundation::Collections::ValueSet* self, PyObject* key) noexcept
    {
        try
        {
            return static_cast<int>(self->obj.HasKey(py::convert_to<winrt::hstring>(key)));
        }
        catch (...)
        {
            py::to_PyErr();
            return -1;
        }
    }

    static Py_ssize_t _map_length_ValueSet(py::wrapper::Windows::Foundation::Collections::ValueSet* self) noexcept
    {
        try
        {
            return static_cast<Py_ssize_t>(self->obj.Size());
        }
        catch (...)
        {
            py::to_PyErr();
            return -1;
        }
    }

    static PyObject* _map_subscript_ValueSet(py::wrapper::Windows::Foundation::Collections::ValueSet* self, PyObject* key) noexcept
    {
        try
        {
            auto _key = py::convert_to<winrt::hstring>(key);
            auto value = self->obj.TryLookup(_key);

            if (!value) {
                if constexpr (std::is_base_of_v<winrt::Windows::Foundation::IUnknown, decltype(value)>)
                {
                    if (self->obj.HasKey(_key))
                    {
                        Py_RETURN_NONE;
                    }
                }

                PyErr_SetObject(PyExc_KeyError, key);
                return nullptr;
            }

            return py::convert(value);
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static int _map_assign_ValueSet(py::wrapper::Windows::Foundation::Collections::ValueSet* self, PyObject* key, PyObject* value) noexcept
    {
        try
        {
            auto _key = py::convert_to<winrt::hstring>(key);

            if (value == nullptr) {
                if (!self->obj.TryRemove(_key)) {
                    PyErr_SetObject(PyExc_KeyError, key);
                    return -1;
                }

                return 0;
            }

            self->obj.Insert(_key, py::convert_to<winrt::Windows::Foundation::IInspectable>(value));

            return 0;
        }
        catch (...)
        {
            py::to_PyErr();
            return -1;
        }
    }

    static PyMethodDef _methods_ValueSet[] = {
        { "clear", reinterpret_cast<PyCFunction>(ValueSet_Clear), METH_VARARGS, nullptr },
        { "first", reinterpret_cast<PyCFunction>(ValueSet_First), METH_VARARGS, nullptr },
        { "get_view", reinterpret_cast<PyCFunction>(ValueSet_GetView), METH_VARARGS, nullptr },
        { "has_key", reinterpret_cast<PyCFunction>(ValueSet_HasKey), METH_VARARGS, nullptr },
        { "insert", reinterpret_cast<PyCFunction>(ValueSet_Insert), METH_VARARGS, nullptr },
        { "lookup", reinterpret_cast<PyCFunction>(ValueSet_Lookup), METH_VARARGS, nullptr },
        { "remove", reinterpret_cast<PyCFunction>(ValueSet_Remove), METH_VARARGS, nullptr },
        { "add_map_changed", reinterpret_cast<PyCFunction>(ValueSet_add_MapChanged), METH_O, nullptr },
        { "remove_map_changed", reinterpret_cast<PyCFunction>(ValueSet_remove_MapChanged), METH_O, nullptr },
        { "_assign_array_", _assign_array_ValueSet, METH_O | METH_STATIC, nullptr },
        { "_from", reinterpret_cast<PyCFunction>(_from_ValueSet), METH_O | METH_STATIC, nullptr },
        { }
    };

    static PyGetSetDef _getset_ValueSet[] = {
        { "size", reinterpret_cast<getter>(ValueSet_get_Size), nullptr, nullptr, nullptr },
        { }
    };

    static PyType_Slot _type_slots_ValueSet[] = {
        { Py_tp_new, reinterpret_cast<void*>(_new_ValueSet) },
        { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_ValueSet) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_ValueSet) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_ValueSet) },
        { Py_tp_iter, reinterpret_cast<void*>(_iterator_ValueSet) },
        { Py_sq_contains, reinterpret_cast<void*>(_map_contains_ValueSet) },
        { Py_mp_length, reinterpret_cast<void*>(_map_length_ValueSet) },
        { Py_mp_subscript, reinterpret_cast<void*>(_map_subscript_ValueSet) },
        { Py_mp_ass_subscript, reinterpret_cast<void*>(_map_assign_ValueSet) },
        { }
    };

    static PyType_Spec type_spec_ValueSet = {
        "winrt._winrt_windows_foundation_collections.ValueSet",
        sizeof(py::wrapper::Windows::Foundation::Collections::ValueSet),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_ValueSet};

    // ----- IIterable interface --------------------

    static PyObject* _new_IIterable(PyTypeObject* /*unused*/, PyObject* /*unused*/, PyObject* /*unused*/) noexcept
    {
        static_assert(py::py_type<py::proj::Windows::Foundation::Collections::IIterable>::type_name);
        py::set_invalid_activation_error(py::py_type<py::proj::Windows::Foundation::Collections::IIterable>::type_name);
        return nullptr;
    }

    static void _dealloc_IIterable(py::wrapper::Windows::Foundation::Collections::IIterable* self) noexcept
    {
        auto tp = Py_TYPE(self);
        std::destroy_at(&self->obj);
        std::destroy_at(&self->impl);
        tp->tp_free(self);
        Py_DECREF(tp);
    }

    static PyObject* IIterable_First(py::wrapper::Windows::Foundation::Collections::IIterable* self, PyObject* args) noexcept
    {
        return self->impl->First(args);
    }

    static PyObject* _iterator_IIterable(py::wrapper::Windows::Foundation::Collections::IIterable* self) noexcept
    {
        return self->impl->dunder_iter();
    }

    static PyMethodDef _methods_IIterable[] = {
        { "first", reinterpret_cast<PyCFunction>(IIterable_First), METH_VARARGS, nullptr },
        { "__class_getitem__", Py_GenericAlias, METH_O | METH_CLASS, PyDoc_STR("See PEP 585") },
        { }
    };

    static PyGetSetDef _getset_IIterable[] = {
        { }
    };

    static PyType_Slot _type_slots_IIterable[] = {
        { Py_tp_new, reinterpret_cast<void*>(_new_IIterable) },
        { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_IIterable) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_IIterable) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_IIterable) },
        { Py_tp_iter, reinterpret_cast<void*>(_iterator_IIterable) },
        { }
    };

    static PyType_Spec type_spec_IIterable = {
        "winrt._winrt_windows_foundation_collections.IIterable",
        sizeof(py::wrapper::Windows::Foundation::Collections::IIterable),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_IIterable};

    // ----- IIterator interface --------------------

    static PyObject* _new_IIterator(PyTypeObject* /*unused*/, PyObject* /*unused*/, PyObject* /*unused*/) noexcept
    {
        static_assert(py::py_type<py::proj::Windows::Foundation::Collections::IIterator>::type_name);
        py::set_invalid_activation_error(py::py_type<py::proj::Windows::Foundation::Collections::IIterator>::type_name);
        return nullptr;
    }

    static void _dealloc_IIterator(py::wrapper::Windows::Foundation::Collections::IIterator* self) noexcept
    {
        auto tp = Py_TYPE(self);
        std::destroy_at(&self->obj);
        std::destroy_at(&self->impl);
        tp->tp_free(self);
        Py_DECREF(tp);
    }

    static PyObject* IIterator_GetMany(py::wrapper::Windows::Foundation::Collections::IIterator* self, PyObject* args) noexcept
    {
        return self->impl->GetMany(args);
    }

    static PyObject* IIterator_MoveNext(py::wrapper::Windows::Foundation::Collections::IIterator* self, PyObject* args) noexcept
    {
        return self->impl->MoveNext(args);
    }

    static PyObject* IIterator_get_Current(py::wrapper::Windows::Foundation::Collections::IIterator* self, void* /*unused*/) noexcept
    {
        try
        {
            if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Foundation.Collections.IIterator`1", L"Current"))
            {
                PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
                return nullptr;
            }

            return self->impl->get_Current();
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* IIterator_get_HasCurrent(py::wrapper::Windows::Foundation::Collections::IIterator* self, void* /*unused*/) noexcept
    {
        try
        {
            if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Foundation.Collections.IIterator`1", L"HasCurrent"))
            {
                PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
                return nullptr;
            }

            return self->impl->get_HasCurrent();
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* _iterator_IIterator(py::wrapper::Windows::Foundation::Collections::IIterator* self) noexcept
    {
        return self->impl->dunder_iter();
    }

    static PyObject* _iterator_next_IIterator(py::wrapper::Windows::Foundation::Collections::IIterator* self) noexcept
    {
        return self->impl->dunder_iternext();
    }

    static PyMethodDef _methods_IIterator[] = {
        { "get_many", reinterpret_cast<PyCFunction>(IIterator_GetMany), METH_VARARGS, nullptr },
        { "move_next", reinterpret_cast<PyCFunction>(IIterator_MoveNext), METH_VARARGS, nullptr },
        { "__class_getitem__", Py_GenericAlias, METH_O | METH_CLASS, PyDoc_STR("See PEP 585") },
        { }
    };

    static PyGetSetDef _getset_IIterator[] = {
        { "current", reinterpret_cast<getter>(IIterator_get_Current), nullptr, nullptr, nullptr },
        { "has_current", reinterpret_cast<getter>(IIterator_get_HasCurrent), nullptr, nullptr, nullptr },
        { }
    };

    static PyType_Slot _type_slots_IIterator[] = {
        { Py_tp_new, reinterpret_cast<void*>(_new_IIterator) },
        { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_IIterator) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_IIterator) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_IIterator) },
        { Py_tp_iter, reinterpret_cast<void*>(_iterator_IIterator) },
        { Py_tp_iternext, reinterpret_cast<void*>(_iterator_next_IIterator) },
        { }
    };

    static PyType_Spec type_spec_IIterator = {
        "winrt._winrt_windows_foundation_collections.IIterator",
        sizeof(py::wrapper::Windows::Foundation::Collections::IIterator),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_IIterator};

    // ----- IKeyValuePair interface --------------------

    static PyObject* _new_IKeyValuePair(PyTypeObject* /*unused*/, PyObject* /*unused*/, PyObject* /*unused*/) noexcept
    {
        static_assert(py::py_type<py::proj::Windows::Foundation::Collections::IKeyValuePair>::type_name);
        py::set_invalid_activation_error(py::py_type<py::proj::Windows::Foundation::Collections::IKeyValuePair>::type_name);
        return nullptr;
    }

    static void _dealloc_IKeyValuePair(py::wrapper::Windows::Foundation::Collections::IKeyValuePair* self) noexcept
    {
        auto tp = Py_TYPE(self);
        std::destroy_at(&self->obj);
        std::destroy_at(&self->impl);
        tp->tp_free(self);
        Py_DECREF(tp);
    }

    static PyObject* IKeyValuePair_get_Key(py::wrapper::Windows::Foundation::Collections::IKeyValuePair* self, void* /*unused*/) noexcept
    {
        try
        {
            if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Foundation.Collections.IKeyValuePair`2", L"Key"))
            {
                PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
                return nullptr;
            }

            return self->impl->get_Key();
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* IKeyValuePair_get_Value(py::wrapper::Windows::Foundation::Collections::IKeyValuePair* self, void* /*unused*/) noexcept
    {
        try
        {
            if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Foundation.Collections.IKeyValuePair`2", L"Value"))
            {
                PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
                return nullptr;
            }

            return self->impl->get_Value();
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyMethodDef _methods_IKeyValuePair[] = {
        { "__class_getitem__", Py_GenericAlias, METH_O | METH_CLASS, PyDoc_STR("See PEP 585") },
        { }
    };

    static PyGetSetDef _getset_IKeyValuePair[] = {
        { "key", reinterpret_cast<getter>(IKeyValuePair_get_Key), nullptr, nullptr, nullptr },
        { "value", reinterpret_cast<getter>(IKeyValuePair_get_Value), nullptr, nullptr, nullptr },
        { }
    };

    static PyType_Slot _type_slots_IKeyValuePair[] = {
        { Py_tp_new, reinterpret_cast<void*>(_new_IKeyValuePair) },
        { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_IKeyValuePair) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_IKeyValuePair) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_IKeyValuePair) },
        { }
    };

    static PyType_Spec type_spec_IKeyValuePair = {
        "winrt._winrt_windows_foundation_collections.IKeyValuePair",
        sizeof(py::wrapper::Windows::Foundation::Collections::IKeyValuePair),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_IKeyValuePair};

    // ----- IMapChangedEventArgs interface --------------------

    static PyObject* _new_IMapChangedEventArgs(PyTypeObject* /*unused*/, PyObject* /*unused*/, PyObject* /*unused*/) noexcept
    {
        static_assert(py::py_type<py::proj::Windows::Foundation::Collections::IMapChangedEventArgs>::type_name);
        py::set_invalid_activation_error(py::py_type<py::proj::Windows::Foundation::Collections::IMapChangedEventArgs>::type_name);
        return nullptr;
    }

    static void _dealloc_IMapChangedEventArgs(py::wrapper::Windows::Foundation::Collections::IMapChangedEventArgs* self) noexcept
    {
        auto tp = Py_TYPE(self);
        std::destroy_at(&self->obj);
        std::destroy_at(&self->impl);
        tp->tp_free(self);
        Py_DECREF(tp);
    }

    static PyObject* IMapChangedEventArgs_get_CollectionChange(py::wrapper::Windows::Foundation::Collections::IMapChangedEventArgs* self, void* /*unused*/) noexcept
    {
        try
        {
            if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Foundation.Collections.IMapChangedEventArgs`1", L"CollectionChange"))
            {
                PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
                return nullptr;
            }

            return self->impl->get_CollectionChange();
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* IMapChangedEventArgs_get_Key(py::wrapper::Windows::Foundation::Collections::IMapChangedEventArgs* self, void* /*unused*/) noexcept
    {
        try
        {
            if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Foundation.Collections.IMapChangedEventArgs`1", L"Key"))
            {
                PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
                return nullptr;
            }

            return self->impl->get_Key();
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyMethodDef _methods_IMapChangedEventArgs[] = {
        { "__class_getitem__", Py_GenericAlias, METH_O | METH_CLASS, PyDoc_STR("See PEP 585") },
        { }
    };

    static PyGetSetDef _getset_IMapChangedEventArgs[] = {
        { "collection_change", reinterpret_cast<getter>(IMapChangedEventArgs_get_CollectionChange), nullptr, nullptr, nullptr },
        { "key", reinterpret_cast<getter>(IMapChangedEventArgs_get_Key), nullptr, nullptr, nullptr },
        { }
    };

    static PyType_Slot _type_slots_IMapChangedEventArgs[] = {
        { Py_tp_new, reinterpret_cast<void*>(_new_IMapChangedEventArgs) },
        { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_IMapChangedEventArgs) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_IMapChangedEventArgs) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_IMapChangedEventArgs) },
        { }
    };

    static PyType_Spec type_spec_IMapChangedEventArgs = {
        "winrt._winrt_windows_foundation_collections.IMapChangedEventArgs",
        sizeof(py::wrapper::Windows::Foundation::Collections::IMapChangedEventArgs),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_IMapChangedEventArgs};

    // ----- IMapView interface --------------------

    static PyObject* _new_IMapView(PyTypeObject* /*unused*/, PyObject* /*unused*/, PyObject* /*unused*/) noexcept
    {
        static_assert(py::py_type<py::proj::Windows::Foundation::Collections::IMapView>::type_name);
        py::set_invalid_activation_error(py::py_type<py::proj::Windows::Foundation::Collections::IMapView>::type_name);
        return nullptr;
    }

    static void _dealloc_IMapView(py::wrapper::Windows::Foundation::Collections::IMapView* self) noexcept
    {
        auto tp = Py_TYPE(self);
        std::destroy_at(&self->obj);
        std::destroy_at(&self->impl);
        tp->tp_free(self);
        Py_DECREF(tp);
    }

    static PyObject* IMapView_First(py::wrapper::Windows::Foundation::Collections::IMapView* self, PyObject* args) noexcept
    {
        return self->impl->First(args);
    }

    static PyObject* IMapView_HasKey(py::wrapper::Windows::Foundation::Collections::IMapView* self, PyObject* args) noexcept
    {
        return self->impl->HasKey(args);
    }

    static PyObject* IMapView_Lookup(py::wrapper::Windows::Foundation::Collections::IMapView* self, PyObject* args) noexcept
    {
        return self->impl->Lookup(args);
    }

    static PyObject* IMapView_Split(py::wrapper::Windows::Foundation::Collections::IMapView* self, PyObject* args) noexcept
    {
        return self->impl->Split(args);
    }

    static PyObject* IMapView_get_Size(py::wrapper::Windows::Foundation::Collections::IMapView* self, void* /*unused*/) noexcept
    {
        try
        {
            if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Foundation.Collections.IMapView`2", L"Size"))
            {
                PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
                return nullptr;
            }

            return self->impl->get_Size();
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* _iterator_IMapView(py::wrapper::Windows::Foundation::Collections::IMapView* self) noexcept
    {
        return self->impl->dunder_iter();
    }

    static int _map_contains_IMapView(py::wrapper::Windows::Foundation::Collections::IMapView* self, PyObject* key) noexcept
    {
        return self->impl->map_contains(key);
    }

    static Py_ssize_t _map_length_IMapView(py::wrapper::Windows::Foundation::Collections::IMapView* self) noexcept
    {
        return self->impl->map_length();
    }

    static PyObject* _map_subscript_IMapView(py::wrapper::Windows::Foundation::Collections::IMapView* self, PyObject* key) noexcept
    {
        return self->impl->map_subscript(key);
    }

    static PyMethodDef _methods_IMapView[] = {
        { "first", reinterpret_cast<PyCFunction>(IMapView_First), METH_VARARGS, nullptr },
        { "has_key", reinterpret_cast<PyCFunction>(IMapView_HasKey), METH_VARARGS, nullptr },
        { "lookup", reinterpret_cast<PyCFunction>(IMapView_Lookup), METH_VARARGS, nullptr },
        { "split", reinterpret_cast<PyCFunction>(IMapView_Split), METH_VARARGS, nullptr },
        { "__class_getitem__", Py_GenericAlias, METH_O | METH_CLASS, PyDoc_STR("See PEP 585") },
        { }
    };

    static PyGetSetDef _getset_IMapView[] = {
        { "size", reinterpret_cast<getter>(IMapView_get_Size), nullptr, nullptr, nullptr },
        { }
    };

    static PyType_Slot _type_slots_IMapView[] = {
        { Py_tp_new, reinterpret_cast<void*>(_new_IMapView) },
        { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_IMapView) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_IMapView) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_IMapView) },
        { Py_tp_iter, reinterpret_cast<void*>(_iterator_IMapView) },
        { Py_sq_contains, reinterpret_cast<void*>(_map_contains_IMapView) },
        { Py_mp_length, reinterpret_cast<void*>(_map_length_IMapView) },
        { Py_mp_subscript, reinterpret_cast<void*>(_map_subscript_IMapView) },
        { }
    };

    static PyType_Spec type_spec_IMapView = {
        "winrt._winrt_windows_foundation_collections.IMapView",
        sizeof(py::wrapper::Windows::Foundation::Collections::IMapView),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_IMapView};

    // ----- IMap interface --------------------

    static PyObject* _new_IMap(PyTypeObject* /*unused*/, PyObject* /*unused*/, PyObject* /*unused*/) noexcept
    {
        static_assert(py::py_type<py::proj::Windows::Foundation::Collections::IMap>::type_name);
        py::set_invalid_activation_error(py::py_type<py::proj::Windows::Foundation::Collections::IMap>::type_name);
        return nullptr;
    }

    static void _dealloc_IMap(py::wrapper::Windows::Foundation::Collections::IMap* self) noexcept
    {
        auto tp = Py_TYPE(self);
        std::destroy_at(&self->obj);
        std::destroy_at(&self->impl);
        tp->tp_free(self);
        Py_DECREF(tp);
    }

    static PyObject* IMap_Clear(py::wrapper::Windows::Foundation::Collections::IMap* self, PyObject* args) noexcept
    {
        return self->impl->Clear(args);
    }

    static PyObject* IMap_First(py::wrapper::Windows::Foundation::Collections::IMap* self, PyObject* args) noexcept
    {
        return self->impl->First(args);
    }

    static PyObject* IMap_GetView(py::wrapper::Windows::Foundation::Collections::IMap* self, PyObject* args) noexcept
    {
        return self->impl->GetView(args);
    }

    static PyObject* IMap_HasKey(py::wrapper::Windows::Foundation::Collections::IMap* self, PyObject* args) noexcept
    {
        return self->impl->HasKey(args);
    }

    static PyObject* IMap_Insert(py::wrapper::Windows::Foundation::Collections::IMap* self, PyObject* args) noexcept
    {
        return self->impl->Insert(args);
    }

    static PyObject* IMap_Lookup(py::wrapper::Windows::Foundation::Collections::IMap* self, PyObject* args) noexcept
    {
        return self->impl->Lookup(args);
    }

    static PyObject* IMap_Remove(py::wrapper::Windows::Foundation::Collections::IMap* self, PyObject* args) noexcept
    {
        return self->impl->Remove(args);
    }

    static PyObject* IMap_get_Size(py::wrapper::Windows::Foundation::Collections::IMap* self, void* /*unused*/) noexcept
    {
        try
        {
            if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Foundation.Collections.IMap`2", L"Size"))
            {
                PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
                return nullptr;
            }

            return self->impl->get_Size();
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* _iterator_IMap(py::wrapper::Windows::Foundation::Collections::IMap* self) noexcept
    {
        return self->impl->dunder_iter();
    }

    static int _map_contains_IMap(py::wrapper::Windows::Foundation::Collections::IMap* self, PyObject* key) noexcept
    {
        return self->impl->map_contains(key);
    }

    static Py_ssize_t _map_length_IMap(py::wrapper::Windows::Foundation::Collections::IMap* self) noexcept
    {
        return self->impl->map_length();
    }

    static PyObject* _map_subscript_IMap(py::wrapper::Windows::Foundation::Collections::IMap* self, PyObject* key) noexcept
    {
        return self->impl->map_subscript(key);
    }

    static int _map_assign_IMap(py::wrapper::Windows::Foundation::Collections::IMap* self, PyObject* key, PyObject* value) noexcept
    {
        return self->impl->map_assign(key, value);
    }

    static PyMethodDef _methods_IMap[] = {
        { "clear", reinterpret_cast<PyCFunction>(IMap_Clear), METH_VARARGS, nullptr },
        { "first", reinterpret_cast<PyCFunction>(IMap_First), METH_VARARGS, nullptr },
        { "get_view", reinterpret_cast<PyCFunction>(IMap_GetView), METH_VARARGS, nullptr },
        { "has_key", reinterpret_cast<PyCFunction>(IMap_HasKey), METH_VARARGS, nullptr },
        { "insert", reinterpret_cast<PyCFunction>(IMap_Insert), METH_VARARGS, nullptr },
        { "lookup", reinterpret_cast<PyCFunction>(IMap_Lookup), METH_VARARGS, nullptr },
        { "remove", reinterpret_cast<PyCFunction>(IMap_Remove), METH_VARARGS, nullptr },
        { "__class_getitem__", Py_GenericAlias, METH_O | METH_CLASS, PyDoc_STR("See PEP 585") },
        { }
    };

    static PyGetSetDef _getset_IMap[] = {
        { "size", reinterpret_cast<getter>(IMap_get_Size), nullptr, nullptr, nullptr },
        { }
    };

    static PyType_Slot _type_slots_IMap[] = {
        { Py_tp_new, reinterpret_cast<void*>(_new_IMap) },
        { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_IMap) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_IMap) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_IMap) },
        { Py_tp_iter, reinterpret_cast<void*>(_iterator_IMap) },
        { Py_sq_contains, reinterpret_cast<void*>(_map_contains_IMap) },
        { Py_mp_length, reinterpret_cast<void*>(_map_length_IMap) },
        { Py_mp_subscript, reinterpret_cast<void*>(_map_subscript_IMap) },
        { Py_mp_ass_subscript, reinterpret_cast<void*>(_map_assign_IMap) },
        { }
    };

    static PyType_Spec type_spec_IMap = {
        "winrt._winrt_windows_foundation_collections.IMap",
        sizeof(py::wrapper::Windows::Foundation::Collections::IMap),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_IMap};

    // ----- IObservableMap interface --------------------

    static PyObject* _new_IObservableMap(PyTypeObject* /*unused*/, PyObject* /*unused*/, PyObject* /*unused*/) noexcept
    {
        static_assert(py::py_type<py::proj::Windows::Foundation::Collections::IObservableMap>::type_name);
        py::set_invalid_activation_error(py::py_type<py::proj::Windows::Foundation::Collections::IObservableMap>::type_name);
        return nullptr;
    }

    static void _dealloc_IObservableMap(py::wrapper::Windows::Foundation::Collections::IObservableMap* self) noexcept
    {
        auto tp = Py_TYPE(self);
        std::destroy_at(&self->obj);
        std::destroy_at(&self->impl);
        tp->tp_free(self);
        Py_DECREF(tp);
    }

    static PyObject* IObservableMap_Clear(py::wrapper::Windows::Foundation::Collections::IObservableMap* self, PyObject* args) noexcept
    {
        return self->impl->Clear(args);
    }

    static PyObject* IObservableMap_First(py::wrapper::Windows::Foundation::Collections::IObservableMap* self, PyObject* args) noexcept
    {
        return self->impl->First(args);
    }

    static PyObject* IObservableMap_GetView(py::wrapper::Windows::Foundation::Collections::IObservableMap* self, PyObject* args) noexcept
    {
        return self->impl->GetView(args);
    }

    static PyObject* IObservableMap_HasKey(py::wrapper::Windows::Foundation::Collections::IObservableMap* self, PyObject* args) noexcept
    {
        return self->impl->HasKey(args);
    }

    static PyObject* IObservableMap_Insert(py::wrapper::Windows::Foundation::Collections::IObservableMap* self, PyObject* args) noexcept
    {
        return self->impl->Insert(args);
    }

    static PyObject* IObservableMap_Lookup(py::wrapper::Windows::Foundation::Collections::IObservableMap* self, PyObject* args) noexcept
    {
        return self->impl->Lookup(args);
    }

    static PyObject* IObservableMap_Remove(py::wrapper::Windows::Foundation::Collections::IObservableMap* self, PyObject* args) noexcept
    {
        return self->impl->Remove(args);
    }

    static PyObject* IObservableMap_get_Size(py::wrapper::Windows::Foundation::Collections::IObservableMap* self, void* /*unused*/) noexcept
    {
        try
        {
            if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Foundation.Collections.IMap`2", L"Size"))
            {
                PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
                return nullptr;
            }

            return self->impl->get_Size();
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* IObservableMap_add_MapChanged(py::wrapper::Windows::Foundation::Collections::IObservableMap* self, PyObject* arg) noexcept
    {
        try
        {
            if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsEventPresent(L"Windows.Foundation.Collections.IObservableMap`2", L"MapChanged"))
            {
                PyErr_SetString(PyExc_AttributeError, "event is not available in this version of Windows");
                return nullptr;
            }

            return self->impl->add_MapChanged(arg);
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* IObservableMap_remove_MapChanged(py::wrapper::Windows::Foundation::Collections::IObservableMap* self, PyObject* arg) noexcept
    {
        try
        {
            if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsEventPresent(L"Windows.Foundation.Collections.IObservableMap`2", L"MapChanged"))
            {
                PyErr_SetString(PyExc_AttributeError, "event is not available in this version of Windows");
                return nullptr;
            }

            return self->impl->remove_MapChanged(arg);
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* _iterator_IObservableMap(py::wrapper::Windows::Foundation::Collections::IObservableMap* self) noexcept
    {
        return self->impl->dunder_iter();
    }

    static int _map_contains_IObservableMap(py::wrapper::Windows::Foundation::Collections::IObservableMap* self, PyObject* key) noexcept
    {
        return self->impl->map_contains(key);
    }

    static Py_ssize_t _map_length_IObservableMap(py::wrapper::Windows::Foundation::Collections::IObservableMap* self) noexcept
    {
        return self->impl->map_length();
    }

    static PyObject* _map_subscript_IObservableMap(py::wrapper::Windows::Foundation::Collections::IObservableMap* self, PyObject* key) noexcept
    {
        return self->impl->map_subscript(key);
    }

    static int _map_assign_IObservableMap(py::wrapper::Windows::Foundation::Collections::IObservableMap* self, PyObject* key, PyObject* value) noexcept
    {
        return self->impl->map_assign(key, value);
    }

    static PyMethodDef _methods_IObservableMap[] = {
        { "clear", reinterpret_cast<PyCFunction>(IObservableMap_Clear), METH_VARARGS, nullptr },
        { "first", reinterpret_cast<PyCFunction>(IObservableMap_First), METH_VARARGS, nullptr },
        { "get_view", reinterpret_cast<PyCFunction>(IObservableMap_GetView), METH_VARARGS, nullptr },
        { "has_key", reinterpret_cast<PyCFunction>(IObservableMap_HasKey), METH_VARARGS, nullptr },
        { "insert", reinterpret_cast<PyCFunction>(IObservableMap_Insert), METH_VARARGS, nullptr },
        { "lookup", reinterpret_cast<PyCFunction>(IObservableMap_Lookup), METH_VARARGS, nullptr },
        { "remove", reinterpret_cast<PyCFunction>(IObservableMap_Remove), METH_VARARGS, nullptr },
        { "add_map_changed", reinterpret_cast<PyCFunction>(IObservableMap_add_MapChanged), METH_O, nullptr },
        { "remove_map_changed", reinterpret_cast<PyCFunction>(IObservableMap_remove_MapChanged), METH_O, nullptr },
        { "__class_getitem__", Py_GenericAlias, METH_O | METH_CLASS, PyDoc_STR("See PEP 585") },
        { }
    };

    static PyGetSetDef _getset_IObservableMap[] = {
        { "size", reinterpret_cast<getter>(IObservableMap_get_Size), nullptr, nullptr, nullptr },
        { }
    };

    static PyType_Slot _type_slots_IObservableMap[] = {
        { Py_tp_new, reinterpret_cast<void*>(_new_IObservableMap) },
        { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_IObservableMap) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_IObservableMap) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_IObservableMap) },
        { Py_tp_iter, reinterpret_cast<void*>(_iterator_IObservableMap) },
        { Py_sq_contains, reinterpret_cast<void*>(_map_contains_IObservableMap) },
        { Py_mp_length, reinterpret_cast<void*>(_map_length_IObservableMap) },
        { Py_mp_subscript, reinterpret_cast<void*>(_map_subscript_IObservableMap) },
        { Py_mp_ass_subscript, reinterpret_cast<void*>(_map_assign_IObservableMap) },
        { }
    };

    static PyType_Spec type_spec_IObservableMap = {
        "winrt._winrt_windows_foundation_collections.IObservableMap",
        sizeof(py::wrapper::Windows::Foundation::Collections::IObservableMap),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_IObservableMap};

    // ----- IObservableVector interface --------------------

    static PyObject* _new_IObservableVector(PyTypeObject* /*unused*/, PyObject* /*unused*/, PyObject* /*unused*/) noexcept
    {
        static_assert(py::py_type<py::proj::Windows::Foundation::Collections::IObservableVector>::type_name);
        py::set_invalid_activation_error(py::py_type<py::proj::Windows::Foundation::Collections::IObservableVector>::type_name);
        return nullptr;
    }

    static void _dealloc_IObservableVector(py::wrapper::Windows::Foundation::Collections::IObservableVector* self) noexcept
    {
        auto tp = Py_TYPE(self);
        std::destroy_at(&self->obj);
        std::destroy_at(&self->impl);
        tp->tp_free(self);
        Py_DECREF(tp);
    }

    static PyObject* IObservableVector_Append(py::wrapper::Windows::Foundation::Collections::IObservableVector* self, PyObject* args) noexcept
    {
        return self->impl->Append(args);
    }

    static PyObject* IObservableVector_Clear(py::wrapper::Windows::Foundation::Collections::IObservableVector* self, PyObject* args) noexcept
    {
        return self->impl->Clear(args);
    }

    static PyObject* IObservableVector_First(py::wrapper::Windows::Foundation::Collections::IObservableVector* self, PyObject* args) noexcept
    {
        return self->impl->First(args);
    }

    static PyObject* IObservableVector_GetAt(py::wrapper::Windows::Foundation::Collections::IObservableVector* self, PyObject* args) noexcept
    {
        return self->impl->GetAt(args);
    }

    static PyObject* IObservableVector_GetMany(py::wrapper::Windows::Foundation::Collections::IObservableVector* self, PyObject* args) noexcept
    {
        return self->impl->GetMany(args);
    }

    static PyObject* IObservableVector_GetView(py::wrapper::Windows::Foundation::Collections::IObservableVector* self, PyObject* args) noexcept
    {
        return self->impl->GetView(args);
    }

    static PyObject* IObservableVector_IndexOf(py::wrapper::Windows::Foundation::Collections::IObservableVector* self, PyObject* args) noexcept
    {
        return self->impl->IndexOf(args);
    }

    static PyObject* IObservableVector_InsertAt(py::wrapper::Windows::Foundation::Collections::IObservableVector* self, PyObject* args) noexcept
    {
        return self->impl->InsertAt(args);
    }

    static PyObject* IObservableVector_RemoveAt(py::wrapper::Windows::Foundation::Collections::IObservableVector* self, PyObject* args) noexcept
    {
        return self->impl->RemoveAt(args);
    }

    static PyObject* IObservableVector_RemoveAtEnd(py::wrapper::Windows::Foundation::Collections::IObservableVector* self, PyObject* args) noexcept
    {
        return self->impl->RemoveAtEnd(args);
    }

    static PyObject* IObservableVector_ReplaceAll(py::wrapper::Windows::Foundation::Collections::IObservableVector* self, PyObject* args) noexcept
    {
        return self->impl->ReplaceAll(args);
    }

    static PyObject* IObservableVector_SetAt(py::wrapper::Windows::Foundation::Collections::IObservableVector* self, PyObject* args) noexcept
    {
        return self->impl->SetAt(args);
    }

    static PyObject* IObservableVector_get_Size(py::wrapper::Windows::Foundation::Collections::IObservableVector* self, void* /*unused*/) noexcept
    {
        try
        {
            if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Foundation.Collections.IVector`1", L"Size"))
            {
                PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
                return nullptr;
            }

            return self->impl->get_Size();
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* IObservableVector_add_VectorChanged(py::wrapper::Windows::Foundation::Collections::IObservableVector* self, PyObject* arg) noexcept
    {
        try
        {
            if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsEventPresent(L"Windows.Foundation.Collections.IObservableVector`1", L"VectorChanged"))
            {
                PyErr_SetString(PyExc_AttributeError, "event is not available in this version of Windows");
                return nullptr;
            }

            return self->impl->add_VectorChanged(arg);
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* IObservableVector_remove_VectorChanged(py::wrapper::Windows::Foundation::Collections::IObservableVector* self, PyObject* arg) noexcept
    {
        try
        {
            if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsEventPresent(L"Windows.Foundation.Collections.IObservableVector`1", L"VectorChanged"))
            {
                PyErr_SetString(PyExc_AttributeError, "event is not available in this version of Windows");
                return nullptr;
            }

            return self->impl->remove_VectorChanged(arg);
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* _iterator_IObservableVector(py::wrapper::Windows::Foundation::Collections::IObservableVector* self) noexcept
    {
        return self->impl->dunder_iter();
    }

    static Py_ssize_t _seq_length_IObservableVector(py::wrapper::Windows::Foundation::Collections::IObservableVector* self) noexcept
    {
        return self->impl->seq_length();
    }

    static PyObject* _seq_item_IObservableVector(py::wrapper::Windows::Foundation::Collections::IObservableVector* self, Py_ssize_t i) noexcept
    {
        return self->impl->seq_item(i);
    }

    static PyObject* _seq_subscript_IObservableVector(py::wrapper::Windows::Foundation::Collections::IObservableVector* self, PyObject* slice) noexcept
    {
        return self->impl->seq_subscript(slice);
    }

    static int _seq_assign_IObservableVector(py::wrapper::Windows::Foundation::Collections::IObservableVector* self, Py_ssize_t i, PyObject* value) noexcept
    {
        return self->impl->seq_assign(i, value);
    }

    static PyMethodDef _methods_IObservableVector[] = {
        { "append", reinterpret_cast<PyCFunction>(IObservableVector_Append), METH_VARARGS, nullptr },
        { "clear", reinterpret_cast<PyCFunction>(IObservableVector_Clear), METH_VARARGS, nullptr },
        { "first", reinterpret_cast<PyCFunction>(IObservableVector_First), METH_VARARGS, nullptr },
        { "get_at", reinterpret_cast<PyCFunction>(IObservableVector_GetAt), METH_VARARGS, nullptr },
        { "get_many", reinterpret_cast<PyCFunction>(IObservableVector_GetMany), METH_VARARGS, nullptr },
        { "get_view", reinterpret_cast<PyCFunction>(IObservableVector_GetView), METH_VARARGS, nullptr },
        { "index_of", reinterpret_cast<PyCFunction>(IObservableVector_IndexOf), METH_VARARGS, nullptr },
        { "insert_at", reinterpret_cast<PyCFunction>(IObservableVector_InsertAt), METH_VARARGS, nullptr },
        { "remove_at", reinterpret_cast<PyCFunction>(IObservableVector_RemoveAt), METH_VARARGS, nullptr },
        { "remove_at_end", reinterpret_cast<PyCFunction>(IObservableVector_RemoveAtEnd), METH_VARARGS, nullptr },
        { "replace_all", reinterpret_cast<PyCFunction>(IObservableVector_ReplaceAll), METH_VARARGS, nullptr },
        { "set_at", reinterpret_cast<PyCFunction>(IObservableVector_SetAt), METH_VARARGS, nullptr },
        { "add_vector_changed", reinterpret_cast<PyCFunction>(IObservableVector_add_VectorChanged), METH_O, nullptr },
        { "remove_vector_changed", reinterpret_cast<PyCFunction>(IObservableVector_remove_VectorChanged), METH_O, nullptr },
        { "__class_getitem__", Py_GenericAlias, METH_O | METH_CLASS, PyDoc_STR("See PEP 585") },
        { }
    };

    static PyGetSetDef _getset_IObservableVector[] = {
        { "size", reinterpret_cast<getter>(IObservableVector_get_Size), nullptr, nullptr, nullptr },
        { }
    };

    static PyType_Slot _type_slots_IObservableVector[] = {
        { Py_tp_new, reinterpret_cast<void*>(_new_IObservableVector) },
        { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_IObservableVector) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_IObservableVector) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_IObservableVector) },
        { Py_tp_iter, reinterpret_cast<void*>(_iterator_IObservableVector) },
        { Py_sq_length, reinterpret_cast<void*>(_seq_length_IObservableVector) },
        { Py_sq_item, reinterpret_cast<void*>(_seq_item_IObservableVector) },
        { Py_mp_subscript, reinterpret_cast<void*>(_seq_subscript_IObservableVector) },
        { Py_sq_ass_item, reinterpret_cast<void*>(_seq_assign_IObservableVector) },
        { }
    };

    static PyType_Spec type_spec_IObservableVector = {
        "winrt._winrt_windows_foundation_collections.IObservableVector",
        sizeof(py::wrapper::Windows::Foundation::Collections::IObservableVector),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_IObservableVector};

    // ----- IPropertySet interface --------------------

    static PyObject* _new_IPropertySet(PyTypeObject* /*unused*/, PyObject* /*unused*/, PyObject* /*unused*/) noexcept
    {
        static_assert(py::py_type<winrt::Windows::Foundation::Collections::IPropertySet>::type_name);
        py::set_invalid_activation_error(py::py_type<winrt::Windows::Foundation::Collections::IPropertySet>::type_name);
        return nullptr;
    }

    static void _dealloc_IPropertySet(py::wrapper::Windows::Foundation::Collections::IPropertySet* self) noexcept
    {
        auto tp = Py_TYPE(self);
        std::destroy_at(&self->obj);
        tp->tp_free(self);
        Py_DECREF(tp);
    }

    static PyObject* IPropertySet_Clear(py::wrapper::Windows::Foundation::Collections::IPropertySet* self, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_Size(args);

        if (arg_count == 0)
        {
            try
            {
                if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Foundation.Collections.IMap`2", L"Clear", 0))
                {
                    py::set_arg_count_version_error(0);
                    return nullptr;
                }

                self->obj.Clear();
                Py_RETURN_NONE;
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* IPropertySet_First(py::wrapper::Windows::Foundation::Collections::IPropertySet* self, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_Size(args);

        if (arg_count == 0)
        {
            try
            {
                if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Foundation.Collections.IIterable`1", L"First", 0))
                {
                    py::set_arg_count_version_error(0);
                    return nullptr;
                }

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

    static PyObject* IPropertySet_GetView(py::wrapper::Windows::Foundation::Collections::IPropertySet* self, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_Size(args);

        if (arg_count == 0)
        {
            try
            {
                if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Foundation.Collections.IMap`2", L"GetView", 0))
                {
                    py::set_arg_count_version_error(0);
                    return nullptr;
                }

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

    static PyObject* IPropertySet_HasKey(py::wrapper::Windows::Foundation::Collections::IPropertySet* self, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_Size(args);

        if (arg_count == 1)
        {
            try
            {
                if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Foundation.Collections.IMap`2", L"HasKey", 1))
                {
                    py::set_arg_count_version_error(1);
                    return nullptr;
                }

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

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

    static PyObject* IPropertySet_Insert(py::wrapper::Windows::Foundation::Collections::IPropertySet* self, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_Size(args);

        if (arg_count == 2)
        {
            try
            {
                if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Foundation.Collections.IMap`2", L"Insert", 2))
                {
                    py::set_arg_count_version_error(2);
                    return nullptr;
                }

                auto param0 = py::convert_to<winrt::hstring>(args, 0);
                auto param1 = py::convert_to<winrt::Windows::Foundation::IInspectable>(args, 1);

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

    static PyObject* IPropertySet_Lookup(py::wrapper::Windows::Foundation::Collections::IPropertySet* self, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_Size(args);

        if (arg_count == 1)
        {
            try
            {
                if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Foundation.Collections.IMap`2", L"Lookup", 1))
                {
                    py::set_arg_count_version_error(1);
                    return nullptr;
                }

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

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

    static PyObject* IPropertySet_Remove(py::wrapper::Windows::Foundation::Collections::IPropertySet* self, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_Size(args);

        if (arg_count == 1)
        {
            try
            {
                if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Foundation.Collections.IMap`2", L"Remove", 1))
                {
                    py::set_arg_count_version_error(1);
                    return nullptr;
                }

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

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

    static PyObject* IPropertySet_get_Size(py::wrapper::Windows::Foundation::Collections::IPropertySet* self, void* /*unused*/) noexcept
    {
        try
        {
            if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Foundation.Collections.IMap`2", L"Size"))
            {
                PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
                return nullptr;
            }

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

    static PyObject* IPropertySet_add_MapChanged(py::wrapper::Windows::Foundation::Collections::IPropertySet* self, PyObject* arg) noexcept
    {
        try
        {
            if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsEventPresent(L"Windows.Foundation.Collections.IObservableMap`2", L"MapChanged"))
            {
                PyErr_SetString(PyExc_AttributeError, "event is not available in this version of Windows");
                return nullptr;
            }

            auto param0 = py::convert_to<winrt::Windows::Foundation::Collections::MapChangedEventHandler<winrt::hstring, winrt::Windows::Foundation::IInspectable>>(arg);

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

    static PyObject* IPropertySet_remove_MapChanged(py::wrapper::Windows::Foundation::Collections::IPropertySet* self, PyObject* arg) noexcept
    {
        try
        {
            if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsEventPresent(L"Windows.Foundation.Collections.IObservableMap`2", L"MapChanged"))
            {
                PyErr_SetString(PyExc_AttributeError, "event is not available in this version of Windows");
                return nullptr;
            }

            auto param0 = py::convert_to<winrt::event_token>(arg);

            self->obj.MapChanged(param0);
            Py_RETURN_NONE;
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* _assign_array_IPropertySet(PyObject* /*unused*/, PyObject* arg) noexcept
    {
        auto array = std::make_unique<py::ComArray<winrt::Windows::Foundation::Collections::IPropertySet>>();
        if (!py::cpp::_winrt::Array_Assign(arg, std::move(array)))
        {
            return nullptr;
        }
        Py_RETURN_NONE;
    }

    static PyObject* _from_IPropertySet(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::Foundation::Collections::IPropertySet>());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* _iterator_IPropertySet(py::wrapper::Windows::Foundation::Collections::IPropertySet* self) noexcept
    {
        try
        {
            py::pyobj_handle iter{py::convert(self->obj.First())};

            if (!iter)
            {
                return nullptr;
            }

            return py::wrap_mapping_iter(iter.get());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static int _map_contains_IPropertySet(py::wrapper::Windows::Foundation::Collections::IPropertySet* self, PyObject* key) noexcept
    {
        try
        {
            return static_cast<int>(self->obj.HasKey(py::convert_to<winrt::hstring>(key)));
        }
        catch (...)
        {
            py::to_PyErr();
            return -1;
        }
    }

    static Py_ssize_t _map_length_IPropertySet(py::wrapper::Windows::Foundation::Collections::IPropertySet* self) noexcept
    {
        try
        {
            return static_cast<Py_ssize_t>(self->obj.Size());
        }
        catch (...)
        {
            py::to_PyErr();
            return -1;
        }
    }

    static PyObject* _map_subscript_IPropertySet(py::wrapper::Windows::Foundation::Collections::IPropertySet* self, PyObject* key) noexcept
    {
        try
        {
            auto _key = py::convert_to<winrt::hstring>(key);
            auto value = self->obj.TryLookup(_key);

            if (!value) {
                if constexpr (std::is_base_of_v<winrt::Windows::Foundation::IUnknown, decltype(value)>)
                {
                    if (self->obj.HasKey(_key))
                    {
                        Py_RETURN_NONE;
                    }
                }

                PyErr_SetObject(PyExc_KeyError, key);
                return nullptr;
            }

            return py::convert(value);
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static int _map_assign_IPropertySet(py::wrapper::Windows::Foundation::Collections::IPropertySet* self, PyObject* key, PyObject* value) noexcept
    {
        try
        {
            auto _key = py::convert_to<winrt::hstring>(key);

            if (value == nullptr) {
                if (!self->obj.TryRemove(_key)) {
                    PyErr_SetObject(PyExc_KeyError, key);
                    return -1;
                }

                return 0;
            }

            self->obj.Insert(_key, py::convert_to<winrt::Windows::Foundation::IInspectable>(value));

            return 0;
        }
        catch (...)
        {
            py::to_PyErr();
            return -1;
        }
    }

    static PyMethodDef _methods_IPropertySet[] = {
        { "clear", reinterpret_cast<PyCFunction>(IPropertySet_Clear), METH_VARARGS, nullptr },
        { "first", reinterpret_cast<PyCFunction>(IPropertySet_First), METH_VARARGS, nullptr },
        { "get_view", reinterpret_cast<PyCFunction>(IPropertySet_GetView), METH_VARARGS, nullptr },
        { "has_key", reinterpret_cast<PyCFunction>(IPropertySet_HasKey), METH_VARARGS, nullptr },
        { "insert", reinterpret_cast<PyCFunction>(IPropertySet_Insert), METH_VARARGS, nullptr },
        { "lookup", reinterpret_cast<PyCFunction>(IPropertySet_Lookup), METH_VARARGS, nullptr },
        { "remove", reinterpret_cast<PyCFunction>(IPropertySet_Remove), METH_VARARGS, nullptr },
        { "add_map_changed", reinterpret_cast<PyCFunction>(IPropertySet_add_MapChanged), METH_O, nullptr },
        { "remove_map_changed", reinterpret_cast<PyCFunction>(IPropertySet_remove_MapChanged), METH_O, nullptr },
        { "_assign_array_", _assign_array_IPropertySet, METH_O | METH_STATIC, nullptr },
        { "_from", reinterpret_cast<PyCFunction>(_from_IPropertySet), METH_O | METH_STATIC, nullptr },
        { }
    };

    static PyGetSetDef _getset_IPropertySet[] = {
        { "size", reinterpret_cast<getter>(IPropertySet_get_Size), nullptr, nullptr, nullptr },
        { }
    };

    static PyType_Slot _type_slots_IPropertySet[] = {
        { Py_tp_new, reinterpret_cast<void*>(_new_IPropertySet) },
        { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_IPropertySet) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_IPropertySet) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_IPropertySet) },
        { Py_tp_iter, reinterpret_cast<void*>(_iterator_IPropertySet) },
        { Py_sq_contains, reinterpret_cast<void*>(_map_contains_IPropertySet) },
        { Py_mp_length, reinterpret_cast<void*>(_map_length_IPropertySet) },
        { Py_mp_subscript, reinterpret_cast<void*>(_map_subscript_IPropertySet) },
        { Py_mp_ass_subscript, reinterpret_cast<void*>(_map_assign_IPropertySet) },
        { }
    };

    static PyType_Spec type_spec_IPropertySet = {
        "winrt._winrt_windows_foundation_collections.IPropertySet",
        sizeof(py::wrapper::Windows::Foundation::Collections::IPropertySet),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_IPropertySet};

    // ----- IVectorChangedEventArgs interface --------------------

    static PyObject* _new_IVectorChangedEventArgs(PyTypeObject* /*unused*/, PyObject* /*unused*/, PyObject* /*unused*/) noexcept
    {
        static_assert(py::py_type<winrt::Windows::Foundation::Collections::IVectorChangedEventArgs>::type_name);
        py::set_invalid_activation_error(py::py_type<winrt::Windows::Foundation::Collections::IVectorChangedEventArgs>::type_name);
        return nullptr;
    }

    static void _dealloc_IVectorChangedEventArgs(py::wrapper::Windows::Foundation::Collections::IVectorChangedEventArgs* self) noexcept
    {
        auto tp = Py_TYPE(self);
        std::destroy_at(&self->obj);
        tp->tp_free(self);
        Py_DECREF(tp);
    }

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

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

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

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

    static PyObject* _assign_array_IVectorChangedEventArgs(PyObject* /*unused*/, PyObject* arg) noexcept
    {
        auto array = std::make_unique<py::ComArray<winrt::Windows::Foundation::Collections::IVectorChangedEventArgs>>();
        if (!py::cpp::_winrt::Array_Assign(arg, std::move(array)))
        {
            return nullptr;
        }
        Py_RETURN_NONE;
    }

    static PyObject* _from_IVectorChangedEventArgs(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::Foundation::Collections::IVectorChangedEventArgs>());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyMethodDef _methods_IVectorChangedEventArgs[] = {
        { "_assign_array_", _assign_array_IVectorChangedEventArgs, METH_O | METH_STATIC, nullptr },
        { "_from", reinterpret_cast<PyCFunction>(_from_IVectorChangedEventArgs), METH_O | METH_STATIC, nullptr },
        { }
    };

    static PyGetSetDef _getset_IVectorChangedEventArgs[] = {
        { "collection_change", reinterpret_cast<getter>(IVectorChangedEventArgs_get_CollectionChange), nullptr, nullptr, nullptr },
        { "index", reinterpret_cast<getter>(IVectorChangedEventArgs_get_Index), nullptr, nullptr, nullptr },
        { }
    };

    static PyType_Slot _type_slots_IVectorChangedEventArgs[] = {
        { Py_tp_new, reinterpret_cast<void*>(_new_IVectorChangedEventArgs) },
        { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_IVectorChangedEventArgs) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_IVectorChangedEventArgs) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_IVectorChangedEventArgs) },
        { }
    };

    static PyType_Spec type_spec_IVectorChangedEventArgs = {
        "winrt._winrt_windows_foundation_collections.IVectorChangedEventArgs",
        sizeof(py::wrapper::Windows::Foundation::Collections::IVectorChangedEventArgs),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_IVectorChangedEventArgs};

    // ----- IVectorView interface --------------------

    static PyObject* _new_IVectorView(PyTypeObject* /*unused*/, PyObject* /*unused*/, PyObject* /*unused*/) noexcept
    {
        static_assert(py::py_type<py::proj::Windows::Foundation::Collections::IVectorView>::type_name);
        py::set_invalid_activation_error(py::py_type<py::proj::Windows::Foundation::Collections::IVectorView>::type_name);
        return nullptr;
    }

    static void _dealloc_IVectorView(py::wrapper::Windows::Foundation::Collections::IVectorView* self) noexcept
    {
        auto tp = Py_TYPE(self);
        std::destroy_at(&self->obj);
        std::destroy_at(&self->impl);
        tp->tp_free(self);
        Py_DECREF(tp);
    }

    static PyObject* IVectorView_First(py::wrapper::Windows::Foundation::Collections::IVectorView* self, PyObject* args) noexcept
    {
        return self->impl->First(args);
    }

    static PyObject* IVectorView_GetAt(py::wrapper::Windows::Foundation::Collections::IVectorView* self, PyObject* args) noexcept
    {
        return self->impl->GetAt(args);
    }

    static PyObject* IVectorView_GetMany(py::wrapper::Windows::Foundation::Collections::IVectorView* self, PyObject* args) noexcept
    {
        return self->impl->GetMany(args);
    }

    static PyObject* IVectorView_IndexOf(py::wrapper::Windows::Foundation::Collections::IVectorView* self, PyObject* args) noexcept
    {
        return self->impl->IndexOf(args);
    }

    static PyObject* IVectorView_get_Size(py::wrapper::Windows::Foundation::Collections::IVectorView* self, void* /*unused*/) noexcept
    {
        try
        {
            if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Foundation.Collections.IVectorView`1", L"Size"))
            {
                PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
                return nullptr;
            }

            return self->impl->get_Size();
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* _iterator_IVectorView(py::wrapper::Windows::Foundation::Collections::IVectorView* self) noexcept
    {
        return self->impl->dunder_iter();
    }

    static Py_ssize_t _seq_length_IVectorView(py::wrapper::Windows::Foundation::Collections::IVectorView* self) noexcept
    {
        return self->impl->seq_length();
    }

    static PyObject* _seq_item_IVectorView(py::wrapper::Windows::Foundation::Collections::IVectorView* self, Py_ssize_t i) noexcept
    {
        return self->impl->seq_item(i);
    }

    static PyObject* _seq_subscript_IVectorView(py::wrapper::Windows::Foundation::Collections::IVectorView* self, PyObject* slice) noexcept
    {
        return self->impl->seq_subscript(slice);
    }

    static PyMethodDef _methods_IVectorView[] = {
        { "first", reinterpret_cast<PyCFunction>(IVectorView_First), METH_VARARGS, nullptr },
        { "get_at", reinterpret_cast<PyCFunction>(IVectorView_GetAt), METH_VARARGS, nullptr },
        { "get_many", reinterpret_cast<PyCFunction>(IVectorView_GetMany), METH_VARARGS, nullptr },
        { "index_of", reinterpret_cast<PyCFunction>(IVectorView_IndexOf), METH_VARARGS, nullptr },
        { "__class_getitem__", Py_GenericAlias, METH_O | METH_CLASS, PyDoc_STR("See PEP 585") },
        { }
    };

    static PyGetSetDef _getset_IVectorView[] = {
        { "size", reinterpret_cast<getter>(IVectorView_get_Size), nullptr, nullptr, nullptr },
        { }
    };

    static PyType_Slot _type_slots_IVectorView[] = {
        { Py_tp_new, reinterpret_cast<void*>(_new_IVectorView) },
        { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_IVectorView) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_IVectorView) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_IVectorView) },
        { Py_tp_iter, reinterpret_cast<void*>(_iterator_IVectorView) },
        { Py_sq_length, reinterpret_cast<void*>(_seq_length_IVectorView) },
        { Py_sq_item, reinterpret_cast<void*>(_seq_item_IVectorView) },
        { Py_mp_subscript, reinterpret_cast<void*>(_seq_subscript_IVectorView) },
        { }
    };

    static PyType_Spec type_spec_IVectorView = {
        "winrt._winrt_windows_foundation_collections.IVectorView",
        sizeof(py::wrapper::Windows::Foundation::Collections::IVectorView),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_IVectorView};

    // ----- IVector interface --------------------

    static PyObject* _new_IVector(PyTypeObject* /*unused*/, PyObject* /*unused*/, PyObject* /*unused*/) noexcept
    {
        static_assert(py::py_type<py::proj::Windows::Foundation::Collections::IVector>::type_name);
        py::set_invalid_activation_error(py::py_type<py::proj::Windows::Foundation::Collections::IVector>::type_name);
        return nullptr;
    }

    static void _dealloc_IVector(py::wrapper::Windows::Foundation::Collections::IVector* self) noexcept
    {
        auto tp = Py_TYPE(self);
        std::destroy_at(&self->obj);
        std::destroy_at(&self->impl);
        tp->tp_free(self);
        Py_DECREF(tp);
    }

    static PyObject* IVector_Append(py::wrapper::Windows::Foundation::Collections::IVector* self, PyObject* args) noexcept
    {
        return self->impl->Append(args);
    }

    static PyObject* IVector_Clear(py::wrapper::Windows::Foundation::Collections::IVector* self, PyObject* args) noexcept
    {
        return self->impl->Clear(args);
    }

    static PyObject* IVector_First(py::wrapper::Windows::Foundation::Collections::IVector* self, PyObject* args) noexcept
    {
        return self->impl->First(args);
    }

    static PyObject* IVector_GetAt(py::wrapper::Windows::Foundation::Collections::IVector* self, PyObject* args) noexcept
    {
        return self->impl->GetAt(args);
    }

    static PyObject* IVector_GetMany(py::wrapper::Windows::Foundation::Collections::IVector* self, PyObject* args) noexcept
    {
        return self->impl->GetMany(args);
    }

    static PyObject* IVector_GetView(py::wrapper::Windows::Foundation::Collections::IVector* self, PyObject* args) noexcept
    {
        return self->impl->GetView(args);
    }

    static PyObject* IVector_IndexOf(py::wrapper::Windows::Foundation::Collections::IVector* self, PyObject* args) noexcept
    {
        return self->impl->IndexOf(args);
    }

    static PyObject* IVector_InsertAt(py::wrapper::Windows::Foundation::Collections::IVector* self, PyObject* args) noexcept
    {
        return self->impl->InsertAt(args);
    }

    static PyObject* IVector_RemoveAt(py::wrapper::Windows::Foundation::Collections::IVector* self, PyObject* args) noexcept
    {
        return self->impl->RemoveAt(args);
    }

    static PyObject* IVector_RemoveAtEnd(py::wrapper::Windows::Foundation::Collections::IVector* self, PyObject* args) noexcept
    {
        return self->impl->RemoveAtEnd(args);
    }

    static PyObject* IVector_ReplaceAll(py::wrapper::Windows::Foundation::Collections::IVector* self, PyObject* args) noexcept
    {
        return self->impl->ReplaceAll(args);
    }

    static PyObject* IVector_SetAt(py::wrapper::Windows::Foundation::Collections::IVector* self, PyObject* args) noexcept
    {
        return self->impl->SetAt(args);
    }

    static PyObject* IVector_get_Size(py::wrapper::Windows::Foundation::Collections::IVector* self, void* /*unused*/) noexcept
    {
        try
        {
            if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Foundation.Collections.IVector`1", L"Size"))
            {
                PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
                return nullptr;
            }

            return self->impl->get_Size();
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* _iterator_IVector(py::wrapper::Windows::Foundation::Collections::IVector* self) noexcept
    {
        return self->impl->dunder_iter();
    }

    static Py_ssize_t _seq_length_IVector(py::wrapper::Windows::Foundation::Collections::IVector* self) noexcept
    {
        return self->impl->seq_length();
    }

    static PyObject* _seq_item_IVector(py::wrapper::Windows::Foundation::Collections::IVector* self, Py_ssize_t i) noexcept
    {
        return self->impl->seq_item(i);
    }

    static PyObject* _seq_subscript_IVector(py::wrapper::Windows::Foundation::Collections::IVector* self, PyObject* slice) noexcept
    {
        return self->impl->seq_subscript(slice);
    }

    static int _seq_assign_IVector(py::wrapper::Windows::Foundation::Collections::IVector* self, Py_ssize_t i, PyObject* value) noexcept
    {
        return self->impl->seq_assign(i, value);
    }

    static PyMethodDef _methods_IVector[] = {
        { "append", reinterpret_cast<PyCFunction>(IVector_Append), METH_VARARGS, nullptr },
        { "clear", reinterpret_cast<PyCFunction>(IVector_Clear), METH_VARARGS, nullptr },
        { "first", reinterpret_cast<PyCFunction>(IVector_First), METH_VARARGS, nullptr },
        { "get_at", reinterpret_cast<PyCFunction>(IVector_GetAt), METH_VARARGS, nullptr },
        { "get_many", reinterpret_cast<PyCFunction>(IVector_GetMany), METH_VARARGS, nullptr },
        { "get_view", reinterpret_cast<PyCFunction>(IVector_GetView), METH_VARARGS, nullptr },
        { "index_of", reinterpret_cast<PyCFunction>(IVector_IndexOf), METH_VARARGS, nullptr },
        { "insert_at", reinterpret_cast<PyCFunction>(IVector_InsertAt), METH_VARARGS, nullptr },
        { "remove_at", reinterpret_cast<PyCFunction>(IVector_RemoveAt), METH_VARARGS, nullptr },
        { "remove_at_end", reinterpret_cast<PyCFunction>(IVector_RemoveAtEnd), METH_VARARGS, nullptr },
        { "replace_all", reinterpret_cast<PyCFunction>(IVector_ReplaceAll), METH_VARARGS, nullptr },
        { "set_at", reinterpret_cast<PyCFunction>(IVector_SetAt), METH_VARARGS, nullptr },
        { "__class_getitem__", Py_GenericAlias, METH_O | METH_CLASS, PyDoc_STR("See PEP 585") },
        { }
    };

    static PyGetSetDef _getset_IVector[] = {
        { "size", reinterpret_cast<getter>(IVector_get_Size), nullptr, nullptr, nullptr },
        { }
    };

    static PyType_Slot _type_slots_IVector[] = {
        { Py_tp_new, reinterpret_cast<void*>(_new_IVector) },
        { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_IVector) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_IVector) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_IVector) },
        { Py_tp_iter, reinterpret_cast<void*>(_iterator_IVector) },
        { Py_sq_length, reinterpret_cast<void*>(_seq_length_IVector) },
        { Py_sq_item, reinterpret_cast<void*>(_seq_item_IVector) },
        { Py_mp_subscript, reinterpret_cast<void*>(_seq_subscript_IVector) },
        { Py_sq_ass_item, reinterpret_cast<void*>(_seq_assign_IVector) },
        { }
    };

    static PyType_Spec type_spec_IVector = {
        "winrt._winrt_windows_foundation_collections.IVector",
        sizeof(py::wrapper::Windows::Foundation::Collections::IVector),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_IVector};

    // ----- Windows.Foundation.Collections Initialization --------------------

    PyDoc_STRVAR(module_doc, "Windows.Foundation.Collections");

    static PyModuleDef module_def = {
        PyModuleDef_HEAD_INIT,
        "_winrt_windows_foundation_collections",
        module_doc,
        0,
        nullptr,
        nullptr,
        nullptr,
        nullptr,
        nullptr};
} // py::cpp::Windows::Foundation::Collections

PyMODINIT_FUNC PyInit__winrt_windows_foundation_collections(void) noexcept
{
    using namespace py::cpp::Windows::Foundation::Collections;

    if (py::import_winrt_runtime() == -1)
    {
        return nullptr;
    }

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

    if (!module)
    {
        return nullptr;
    }

    auto object_type = py::get_object_type();
    if (!object_type)
    {
        return nullptr;
    }

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

    if (!object_bases)
    {
        return nullptr;
    }

    if (py::register_python_type(module.get(), &type_spec_PropertySet, object_bases.get(), nullptr) == -1)
    {
        return nullptr;
    }

    if (py::register_python_type(module.get(), &type_spec_StringMap, object_bases.get(), nullptr) == -1)
    {
        return nullptr;
    }

    if (py::register_python_type(module.get(), &type_spec_ValueSet, object_bases.get(), nullptr) == -1)
    {
        return nullptr;
    }

    if (py::register_python_type(module.get(), &type_spec_IIterable, object_bases.get(), nullptr) == -1)
    {
        return nullptr;
    }

    if (py::register_python_type(module.get(), &type_spec_IIterator, object_bases.get(), nullptr) == -1)
    {
        return nullptr;
    }

    if (py::register_python_type(module.get(), &type_spec_IKeyValuePair, object_bases.get(), nullptr) == -1)
    {
        return nullptr;
    }

    if (py::register_python_type(module.get(), &type_spec_IMapChangedEventArgs, object_bases.get(), nullptr) == -1)
    {
        return nullptr;
    }

    if (py::register_python_type(module.get(), &type_spec_IMapView, object_bases.get(), nullptr) == -1)
    {
        return nullptr;
    }

    if (py::register_python_type(module.get(), &type_spec_IMap, object_bases.get(), nullptr) == -1)
    {
        return nullptr;
    }

    if (py::register_python_type(module.get(), &type_spec_IObservableMap, object_bases.get(), nullptr) == -1)
    {
        return nullptr;
    }

    if (py::register_python_type(module.get(), &type_spec_IObservableVector, object_bases.get(), nullptr) == -1)
    {
        return nullptr;
    }

    if (py::register_python_type(module.get(), &type_spec_IPropertySet, object_bases.get(), nullptr) == -1)
    {
        return nullptr;
    }

    if (py::register_python_type(module.get(), &type_spec_IVectorChangedEventArgs, object_bases.get(), nullptr) == -1)
    {
        return nullptr;
    }

    if (py::register_python_type(module.get(), &type_spec_IVectorView, object_bases.get(), nullptr) == -1)
    {
        return nullptr;
    }

    if (py::register_python_type(module.get(), &type_spec_IVector, object_bases.get(), nullptr) == -1)
    {
        return nullptr;
    }


    return module.detach();
}
