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

#include "py.Windows.Networking.Proximity.h"


namespace py::cpp::Windows::Networking::Proximity
{
    // ----- ConnectionRequestedEventArgs class --------------------

    static PyObject* _new_ConnectionRequestedEventArgs(PyTypeObject* /*unused*/, PyObject* /*unused*/, PyObject* /*unused*/) noexcept
    {
        static_assert(py::py_type<winrt::Windows::Networking::Proximity::ConnectionRequestedEventArgs>::type_name);
        py::set_invalid_activation_error(py::py_type<winrt::Windows::Networking::Proximity::ConnectionRequestedEventArgs>::type_name);
        return nullptr;
    }

    static void _dealloc_ConnectionRequestedEventArgs(py::wrapper::Windows::Networking::Proximity::ConnectionRequestedEventArgs* self) noexcept
    {
        auto tp = Py_TYPE(self);
        std::destroy_at(&self->obj);
        tp->tp_free(self);
        Py_DECREF(tp);
    }

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

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

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

    static PyObject* _from_ConnectionRequestedEventArgs(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::Networking::Proximity::ConnectionRequestedEventArgs>());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyMethodDef _methods_ConnectionRequestedEventArgs[] = {
        { "_assign_array_", _assign_array_ConnectionRequestedEventArgs, METH_O | METH_STATIC, nullptr },
        { "_from", reinterpret_cast<PyCFunction>(_from_ConnectionRequestedEventArgs), METH_O | METH_STATIC, nullptr },
        { }
    };

    static PyGetSetDef _getset_ConnectionRequestedEventArgs[] = {
        { "peer_information", reinterpret_cast<getter>(ConnectionRequestedEventArgs_get_PeerInformation), nullptr, nullptr, nullptr },
        { }
    };

    static PyType_Slot _type_slots_ConnectionRequestedEventArgs[] = 
    {
        { Py_tp_new, reinterpret_cast<void*>(_new_ConnectionRequestedEventArgs) },
        { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_ConnectionRequestedEventArgs) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_ConnectionRequestedEventArgs) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_ConnectionRequestedEventArgs) },
        { },
    };

    static PyType_Spec type_spec_ConnectionRequestedEventArgs =
    {
        "winrt._winrt_windows_networking_proximity.ConnectionRequestedEventArgs",
        sizeof(py::wrapper::Windows::Networking::Proximity::ConnectionRequestedEventArgs),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_ConnectionRequestedEventArgs
    };

    // ----- PeerFinder class --------------------

    static PyObject* _new_PeerFinder(PyTypeObject* /*unused*/, PyObject* /*unused*/, PyObject* /*unused*/) noexcept
    {
        static_assert(py::py_type<winrt::Windows::Networking::Proximity::PeerFinder>::type_name);
        py::set_invalid_activation_error(py::py_type<winrt::Windows::Networking::Proximity::PeerFinder>::type_name);
        return nullptr;
    }

    static PyObject* PeerFinder_ConnectAsync(PyObject* /*unused*/, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_Size(args);

        if (arg_count == 1)
        {
            if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Networking.Proximity.PeerFinder", L"ConnectAsync", 1))
            {
                py::set_arg_count_version_error(1);
                return nullptr;
            }

            try
            {
                auto param0 = py::convert_to<winrt::Windows::Networking::Proximity::PeerInformation>(args, 0);

                return py::convert(winrt::Windows::Networking::Proximity::PeerFinder::ConnectAsync(param0));
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* PeerFinder_CreateWatcher(PyObject* /*unused*/, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_Size(args);

        if (arg_count == 0)
        {
            if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Networking.Proximity.PeerFinder", L"CreateWatcher", 0))
            {
                py::set_arg_count_version_error(0);
                return nullptr;
            }

            try
            {
                return py::convert(winrt::Windows::Networking::Proximity::PeerFinder::CreateWatcher());
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* PeerFinder_FindAllPeersAsync(PyObject* /*unused*/, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_Size(args);

        if (arg_count == 0)
        {
            if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Networking.Proximity.PeerFinder", L"FindAllPeersAsync", 0))
            {
                py::set_arg_count_version_error(0);
                return nullptr;
            }

            try
            {
                return py::convert(winrt::Windows::Networking::Proximity::PeerFinder::FindAllPeersAsync());
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* PeerFinder_Start(PyObject* /*unused*/, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_Size(args);

        if (arg_count == 0)
        {
            if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Networking.Proximity.PeerFinder", L"Start", 0))
            {
                py::set_arg_count_version_error(0);
                return nullptr;
            }

            try
            {
                winrt::Windows::Networking::Proximity::PeerFinder::Start();
                Py_RETURN_NONE;
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else if (arg_count == 1)
        {
            if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Networking.Proximity.PeerFinder", L"Start", 1))
            {
                py::set_arg_count_version_error(1);
                return nullptr;
            }

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

                winrt::Windows::Networking::Proximity::PeerFinder::Start(param0);
                Py_RETURN_NONE;
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* PeerFinder_Stop(PyObject* /*unused*/, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_Size(args);

        if (arg_count == 0)
        {
            if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Networking.Proximity.PeerFinder", L"Stop", 0))
            {
                py::set_arg_count_version_error(0);
                return nullptr;
            }

            try
            {
                winrt::Windows::Networking::Proximity::PeerFinder::Stop();
                Py_RETURN_NONE;
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* PeerFinder_get_DisplayName(PyObject* /*unused*/, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Networking.Proximity.PeerFinder", L"DisplayName"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return nullptr;
        }

        try
        {
            return py::convert(winrt::Windows::Networking::Proximity::PeerFinder::DisplayName());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static int PeerFinder_put_DisplayName(PyObject* /*unused*/, PyObject* arg, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Networking.Proximity.PeerFinder", L"DisplayName"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return -1;
        }

        if (arg == nullptr)
        {
            PyErr_SetString(PyExc_AttributeError, "can't delete attribute");
            return -1;
        }

        try
        {
            auto param0 = py::convert_to<winrt::hstring>(arg);

            winrt::Windows::Networking::Proximity::PeerFinder::DisplayName(param0);
            return 0;
        }
        catch (...)
        {
            py::to_PyErr();
            return -1;
        }
    }

    static PyObject* PeerFinder_get_AllowWiFiDirect(PyObject* /*unused*/, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Networking.Proximity.PeerFinder", L"AllowWiFiDirect"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return nullptr;
        }

        try
        {
            return py::convert(winrt::Windows::Networking::Proximity::PeerFinder::AllowWiFiDirect());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static int PeerFinder_put_AllowWiFiDirect(PyObject* /*unused*/, PyObject* arg, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Networking.Proximity.PeerFinder", L"AllowWiFiDirect"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return -1;
        }

        if (arg == nullptr)
        {
            PyErr_SetString(PyExc_AttributeError, "can't delete attribute");
            return -1;
        }

        try
        {
            auto param0 = py::convert_to<bool>(arg);

            winrt::Windows::Networking::Proximity::PeerFinder::AllowWiFiDirect(param0);
            return 0;
        }
        catch (...)
        {
            py::to_PyErr();
            return -1;
        }
    }

    static PyObject* PeerFinder_get_AllowInfrastructure(PyObject* /*unused*/, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Networking.Proximity.PeerFinder", L"AllowInfrastructure"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return nullptr;
        }

        try
        {
            return py::convert(winrt::Windows::Networking::Proximity::PeerFinder::AllowInfrastructure());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static int PeerFinder_put_AllowInfrastructure(PyObject* /*unused*/, PyObject* arg, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Networking.Proximity.PeerFinder", L"AllowInfrastructure"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return -1;
        }

        if (arg == nullptr)
        {
            PyErr_SetString(PyExc_AttributeError, "can't delete attribute");
            return -1;
        }

        try
        {
            auto param0 = py::convert_to<bool>(arg);

            winrt::Windows::Networking::Proximity::PeerFinder::AllowInfrastructure(param0);
            return 0;
        }
        catch (...)
        {
            py::to_PyErr();
            return -1;
        }
    }

    static PyObject* PeerFinder_get_AllowBluetooth(PyObject* /*unused*/, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Networking.Proximity.PeerFinder", L"AllowBluetooth"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return nullptr;
        }

        try
        {
            return py::convert(winrt::Windows::Networking::Proximity::PeerFinder::AllowBluetooth());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static int PeerFinder_put_AllowBluetooth(PyObject* /*unused*/, PyObject* arg, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Networking.Proximity.PeerFinder", L"AllowBluetooth"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return -1;
        }

        if (arg == nullptr)
        {
            PyErr_SetString(PyExc_AttributeError, "can't delete attribute");
            return -1;
        }

        try
        {
            auto param0 = py::convert_to<bool>(arg);

            winrt::Windows::Networking::Proximity::PeerFinder::AllowBluetooth(param0);
            return 0;
        }
        catch (...)
        {
            py::to_PyErr();
            return -1;
        }
    }

    static PyObject* PeerFinder_get_AlternateIdentities(PyObject* /*unused*/, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Networking.Proximity.PeerFinder", L"AlternateIdentities"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return nullptr;
        }

        try
        {
            return py::convert(winrt::Windows::Networking::Proximity::PeerFinder::AlternateIdentities());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* PeerFinder_get_SupportedDiscoveryTypes(PyObject* /*unused*/, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Networking.Proximity.PeerFinder", L"SupportedDiscoveryTypes"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return nullptr;
        }

        try
        {
            return py::convert(winrt::Windows::Networking::Proximity::PeerFinder::SupportedDiscoveryTypes());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* PeerFinder_get_Role(PyObject* /*unused*/, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Networking.Proximity.PeerFinder", L"Role"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return nullptr;
        }

        try
        {
            return py::convert(winrt::Windows::Networking::Proximity::PeerFinder::Role());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static int PeerFinder_put_Role(PyObject* /*unused*/, PyObject* arg, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Networking.Proximity.PeerFinder", L"Role"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return -1;
        }

        if (arg == nullptr)
        {
            PyErr_SetString(PyExc_AttributeError, "can't delete attribute");
            return -1;
        }

        try
        {
            auto param0 = py::convert_to<winrt::Windows::Networking::Proximity::PeerRole>(arg);

            winrt::Windows::Networking::Proximity::PeerFinder::Role(param0);
            return 0;
        }
        catch (...)
        {
            py::to_PyErr();
            return -1;
        }
    }

    static PyObject* PeerFinder_get_DiscoveryData(PyObject* /*unused*/, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Networking.Proximity.PeerFinder", L"DiscoveryData"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return nullptr;
        }

        try
        {
            return py::convert(winrt::Windows::Networking::Proximity::PeerFinder::DiscoveryData());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static int PeerFinder_put_DiscoveryData(PyObject* /*unused*/, PyObject* arg, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Networking.Proximity.PeerFinder", L"DiscoveryData"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return -1;
        }

        if (arg == nullptr)
        {
            PyErr_SetString(PyExc_AttributeError, "can't delete attribute");
            return -1;
        }

        try
        {
            auto param0 = py::convert_to<winrt::Windows::Storage::Streams::IBuffer>(arg);

            winrt::Windows::Networking::Proximity::PeerFinder::DiscoveryData(param0);
            return 0;
        }
        catch (...)
        {
            py::to_PyErr();
            return -1;
        }
    }

    static PyObject* PeerFinder_add_ConnectionRequested(PyObject* /*unused*/, PyObject* arg) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsEventPresent(L"Windows.Networking.Proximity.PeerFinder", L"ConnectionRequested"))
        {
            PyErr_SetString(PyExc_AttributeError, "event is not available in this version of Windows");
            return nullptr;
        }

        try
        {
            auto param0 = py::convert_to<winrt::Windows::Foundation::TypedEventHandler<winrt::Windows::Foundation::IInspectable, winrt::Windows::Networking::Proximity::ConnectionRequestedEventArgs>>(arg);

            return py::convert(winrt::Windows::Networking::Proximity::PeerFinder::ConnectionRequested(param0));
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* PeerFinder_remove_ConnectionRequested(PyObject* /*unused*/, PyObject* arg) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsEventPresent(L"Windows.Networking.Proximity.PeerFinder", L"ConnectionRequested"))
        {
            PyErr_SetString(PyExc_AttributeError, "event is not available in this version of Windows");
            return nullptr;
        }

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

            winrt::Windows::Networking::Proximity::PeerFinder::ConnectionRequested(param0);
            Py_RETURN_NONE;
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* PeerFinder_add_TriggeredConnectionStateChanged(PyObject* /*unused*/, PyObject* arg) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsEventPresent(L"Windows.Networking.Proximity.PeerFinder", L"TriggeredConnectionStateChanged"))
        {
            PyErr_SetString(PyExc_AttributeError, "event is not available in this version of Windows");
            return nullptr;
        }

        try
        {
            auto param0 = py::convert_to<winrt::Windows::Foundation::TypedEventHandler<winrt::Windows::Foundation::IInspectable, winrt::Windows::Networking::Proximity::TriggeredConnectionStateChangedEventArgs>>(arg);

            return py::convert(winrt::Windows::Networking::Proximity::PeerFinder::TriggeredConnectionStateChanged(param0));
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* PeerFinder_remove_TriggeredConnectionStateChanged(PyObject* /*unused*/, PyObject* arg) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsEventPresent(L"Windows.Networking.Proximity.PeerFinder", L"TriggeredConnectionStateChanged"))
        {
            PyErr_SetString(PyExc_AttributeError, "event is not available in this version of Windows");
            return nullptr;
        }

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

            winrt::Windows::Networking::Proximity::PeerFinder::TriggeredConnectionStateChanged(param0);
            Py_RETURN_NONE;
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyMethodDef _methods_PeerFinder[] = {
        { "add_connection_requested", reinterpret_cast<PyCFunction>(PeerFinder_add_ConnectionRequested), METH_O | METH_STATIC, nullptr },
        { "remove_connection_requested", reinterpret_cast<PyCFunction>(PeerFinder_remove_ConnectionRequested), METH_O | METH_STATIC, nullptr },
        { "add_triggered_connection_state_changed", reinterpret_cast<PyCFunction>(PeerFinder_add_TriggeredConnectionStateChanged), METH_O | METH_STATIC, nullptr },
        { "remove_triggered_connection_state_changed", reinterpret_cast<PyCFunction>(PeerFinder_remove_TriggeredConnectionStateChanged), METH_O | METH_STATIC, nullptr },
        { }
    };

    static PyGetSetDef _getset_PeerFinder[] = {
        { }
    };

    static PyType_Slot _type_slots_PeerFinder[] = 
    {
        { Py_tp_new, reinterpret_cast<void*>(_new_PeerFinder) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_PeerFinder) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_PeerFinder) },
        { },
    };

    static PyType_Spec type_spec_PeerFinder =
    {
        "winrt._winrt_windows_networking_proximity.PeerFinder",
        0,
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_PeerFinder
    };

    static PyGetSetDef getset_PeerFinder_Static[] = {
        { "display_name", reinterpret_cast<getter>(PeerFinder_get_DisplayName), reinterpret_cast<setter>(PeerFinder_put_DisplayName), nullptr, nullptr },
        { "allow_wi_fi_direct", reinterpret_cast<getter>(PeerFinder_get_AllowWiFiDirect), reinterpret_cast<setter>(PeerFinder_put_AllowWiFiDirect), nullptr, nullptr },
        { "allow_infrastructure", reinterpret_cast<getter>(PeerFinder_get_AllowInfrastructure), reinterpret_cast<setter>(PeerFinder_put_AllowInfrastructure), nullptr, nullptr },
        { "allow_bluetooth", reinterpret_cast<getter>(PeerFinder_get_AllowBluetooth), reinterpret_cast<setter>(PeerFinder_put_AllowBluetooth), nullptr, nullptr },
        { "alternate_identities", reinterpret_cast<getter>(PeerFinder_get_AlternateIdentities), nullptr, nullptr, nullptr },
        { "supported_discovery_types", reinterpret_cast<getter>(PeerFinder_get_SupportedDiscoveryTypes), nullptr, nullptr, nullptr },
        { "role", reinterpret_cast<getter>(PeerFinder_get_Role), reinterpret_cast<setter>(PeerFinder_put_Role), nullptr, nullptr },
        { "discovery_data", reinterpret_cast<getter>(PeerFinder_get_DiscoveryData), reinterpret_cast<setter>(PeerFinder_put_DiscoveryData), nullptr, nullptr },
        { }
    };

    static PyMethodDef methods_PeerFinder_Static[] = {
        { "connect_async", reinterpret_cast<PyCFunction>(PeerFinder_ConnectAsync), METH_VARARGS, nullptr },
        { "create_watcher", reinterpret_cast<PyCFunction>(PeerFinder_CreateWatcher), METH_VARARGS, nullptr },
        { "find_all_peers_async", reinterpret_cast<PyCFunction>(PeerFinder_FindAllPeersAsync), METH_VARARGS, nullptr },
        { "start", reinterpret_cast<PyCFunction>(PeerFinder_Start), METH_VARARGS, nullptr },
        { "stop", reinterpret_cast<PyCFunction>(PeerFinder_Stop), METH_VARARGS, nullptr },
        { }
    };

    static PyType_Slot type_slots_PeerFinder_Static[] = 
    {
        { Py_tp_base, reinterpret_cast<void*>(&PyType_Type) },
        { Py_tp_getset, reinterpret_cast<void*>(getset_PeerFinder_Static) },
        { Py_tp_methods, reinterpret_cast<void*>(methods_PeerFinder_Static) },
        { }
    };

    static PyType_Spec type_spec_PeerFinder_Static =
    {
        "winrt._winrt_windows_networking_proximity.PeerFinder_Static",
        static_cast<int>(PyType_Type.tp_basicsize),
        static_cast<int>(PyType_Type.tp_itemsize),
        Py_TPFLAGS_DEFAULT,
        type_slots_PeerFinder_Static
    };

    // ----- PeerInformation class --------------------

    static PyObject* _new_PeerInformation(PyTypeObject* /*unused*/, PyObject* /*unused*/, PyObject* /*unused*/) noexcept
    {
        static_assert(py::py_type<winrt::Windows::Networking::Proximity::PeerInformation>::type_name);
        py::set_invalid_activation_error(py::py_type<winrt::Windows::Networking::Proximity::PeerInformation>::type_name);
        return nullptr;
    }

    static void _dealloc_PeerInformation(py::wrapper::Windows::Networking::Proximity::PeerInformation* self) noexcept
    {
        auto tp = Py_TYPE(self);
        std::destroy_at(&self->obj);
        tp->tp_free(self);
        Py_DECREF(tp);
    }

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

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

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

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

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

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

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

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

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

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

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

    static PyObject* _from_PeerInformation(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::Networking::Proximity::PeerInformation>());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyMethodDef _methods_PeerInformation[] = {
        { "_assign_array_", _assign_array_PeerInformation, METH_O | METH_STATIC, nullptr },
        { "_from", reinterpret_cast<PyCFunction>(_from_PeerInformation), METH_O | METH_STATIC, nullptr },
        { }
    };

    static PyGetSetDef _getset_PeerInformation[] = {
        { "display_name", reinterpret_cast<getter>(PeerInformation_get_DisplayName), nullptr, nullptr, nullptr },
        { "discovery_data", reinterpret_cast<getter>(PeerInformation_get_DiscoveryData), nullptr, nullptr, nullptr },
        { "id", reinterpret_cast<getter>(PeerInformation_get_Id), nullptr, nullptr, nullptr },
        { "host_name", reinterpret_cast<getter>(PeerInformation_get_HostName), nullptr, nullptr, nullptr },
        { "service_name", reinterpret_cast<getter>(PeerInformation_get_ServiceName), nullptr, nullptr, nullptr },
        { }
    };

    static PyType_Slot _type_slots_PeerInformation[] = 
    {
        { Py_tp_new, reinterpret_cast<void*>(_new_PeerInformation) },
        { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_PeerInformation) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_PeerInformation) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_PeerInformation) },
        { },
    };

    static PyType_Spec type_spec_PeerInformation =
    {
        "winrt._winrt_windows_networking_proximity.PeerInformation",
        sizeof(py::wrapper::Windows::Networking::Proximity::PeerInformation),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_PeerInformation
    };

    // ----- PeerWatcher class --------------------

    static PyObject* _new_PeerWatcher(PyTypeObject* /*unused*/, PyObject* /*unused*/, PyObject* /*unused*/) noexcept
    {
        static_assert(py::py_type<winrt::Windows::Networking::Proximity::PeerWatcher>::type_name);
        py::set_invalid_activation_error(py::py_type<winrt::Windows::Networking::Proximity::PeerWatcher>::type_name);
        return nullptr;
    }

    static void _dealloc_PeerWatcher(py::wrapper::Windows::Networking::Proximity::PeerWatcher* self) noexcept
    {
        auto tp = Py_TYPE(self);
        std::destroy_at(&self->obj);
        tp->tp_free(self);
        Py_DECREF(tp);
    }

    static PyObject* PeerWatcher_Start(py::wrapper::Windows::Networking::Proximity::PeerWatcher* self, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_Size(args);

        if (arg_count == 0)
        {
            if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Networking.Proximity.PeerWatcher", L"Start", 0))
            {
                py::set_arg_count_version_error(0);
                return nullptr;
            }

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

    static PyObject* PeerWatcher_Stop(py::wrapper::Windows::Networking::Proximity::PeerWatcher* self, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_Size(args);

        if (arg_count == 0)
        {
            if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Networking.Proximity.PeerWatcher", L"Stop", 0))
            {
                py::set_arg_count_version_error(0);
                return nullptr;
            }

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

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

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

    static PyObject* PeerWatcher_add_Added(py::wrapper::Windows::Networking::Proximity::PeerWatcher* self, PyObject* arg) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsEventPresent(L"Windows.Networking.Proximity.PeerWatcher", L"Added"))
        {
            PyErr_SetString(PyExc_AttributeError, "event is not available in this version of Windows");
            return nullptr;
        }

        try
        {
            auto param0 = py::convert_to<winrt::Windows::Foundation::TypedEventHandler<winrt::Windows::Networking::Proximity::PeerWatcher, winrt::Windows::Networking::Proximity::PeerInformation>>(arg);

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

    static PyObject* PeerWatcher_remove_Added(py::wrapper::Windows::Networking::Proximity::PeerWatcher* self, PyObject* arg) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsEventPresent(L"Windows.Networking.Proximity.PeerWatcher", L"Added"))
        {
            PyErr_SetString(PyExc_AttributeError, "event is not available in this version of Windows");
            return nullptr;
        }

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

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

    static PyObject* PeerWatcher_add_EnumerationCompleted(py::wrapper::Windows::Networking::Proximity::PeerWatcher* self, PyObject* arg) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsEventPresent(L"Windows.Networking.Proximity.PeerWatcher", L"EnumerationCompleted"))
        {
            PyErr_SetString(PyExc_AttributeError, "event is not available in this version of Windows");
            return nullptr;
        }

        try
        {
            auto param0 = py::convert_to<winrt::Windows::Foundation::TypedEventHandler<winrt::Windows::Networking::Proximity::PeerWatcher, winrt::Windows::Foundation::IInspectable>>(arg);

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

    static PyObject* PeerWatcher_remove_EnumerationCompleted(py::wrapper::Windows::Networking::Proximity::PeerWatcher* self, PyObject* arg) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsEventPresent(L"Windows.Networking.Proximity.PeerWatcher", L"EnumerationCompleted"))
        {
            PyErr_SetString(PyExc_AttributeError, "event is not available in this version of Windows");
            return nullptr;
        }

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

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

    static PyObject* PeerWatcher_add_Removed(py::wrapper::Windows::Networking::Proximity::PeerWatcher* self, PyObject* arg) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsEventPresent(L"Windows.Networking.Proximity.PeerWatcher", L"Removed"))
        {
            PyErr_SetString(PyExc_AttributeError, "event is not available in this version of Windows");
            return nullptr;
        }

        try
        {
            auto param0 = py::convert_to<winrt::Windows::Foundation::TypedEventHandler<winrt::Windows::Networking::Proximity::PeerWatcher, winrt::Windows::Networking::Proximity::PeerInformation>>(arg);

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

    static PyObject* PeerWatcher_remove_Removed(py::wrapper::Windows::Networking::Proximity::PeerWatcher* self, PyObject* arg) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsEventPresent(L"Windows.Networking.Proximity.PeerWatcher", L"Removed"))
        {
            PyErr_SetString(PyExc_AttributeError, "event is not available in this version of Windows");
            return nullptr;
        }

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

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

    static PyObject* PeerWatcher_add_Stopped(py::wrapper::Windows::Networking::Proximity::PeerWatcher* self, PyObject* arg) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsEventPresent(L"Windows.Networking.Proximity.PeerWatcher", L"Stopped"))
        {
            PyErr_SetString(PyExc_AttributeError, "event is not available in this version of Windows");
            return nullptr;
        }

        try
        {
            auto param0 = py::convert_to<winrt::Windows::Foundation::TypedEventHandler<winrt::Windows::Networking::Proximity::PeerWatcher, winrt::Windows::Foundation::IInspectable>>(arg);

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

    static PyObject* PeerWatcher_remove_Stopped(py::wrapper::Windows::Networking::Proximity::PeerWatcher* self, PyObject* arg) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsEventPresent(L"Windows.Networking.Proximity.PeerWatcher", L"Stopped"))
        {
            PyErr_SetString(PyExc_AttributeError, "event is not available in this version of Windows");
            return nullptr;
        }

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

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

    static PyObject* PeerWatcher_add_Updated(py::wrapper::Windows::Networking::Proximity::PeerWatcher* self, PyObject* arg) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsEventPresent(L"Windows.Networking.Proximity.PeerWatcher", L"Updated"))
        {
            PyErr_SetString(PyExc_AttributeError, "event is not available in this version of Windows");
            return nullptr;
        }

        try
        {
            auto param0 = py::convert_to<winrt::Windows::Foundation::TypedEventHandler<winrt::Windows::Networking::Proximity::PeerWatcher, winrt::Windows::Networking::Proximity::PeerInformation>>(arg);

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

    static PyObject* PeerWatcher_remove_Updated(py::wrapper::Windows::Networking::Proximity::PeerWatcher* self, PyObject* arg) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsEventPresent(L"Windows.Networking.Proximity.PeerWatcher", L"Updated"))
        {
            PyErr_SetString(PyExc_AttributeError, "event is not available in this version of Windows");
            return nullptr;
        }

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

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

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

    static PyObject* _from_PeerWatcher(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::Networking::Proximity::PeerWatcher>());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyMethodDef _methods_PeerWatcher[] = {
        { "start", reinterpret_cast<PyCFunction>(PeerWatcher_Start), METH_VARARGS, nullptr },
        { "stop", reinterpret_cast<PyCFunction>(PeerWatcher_Stop), METH_VARARGS, nullptr },
        { "add_added", reinterpret_cast<PyCFunction>(PeerWatcher_add_Added), METH_O, nullptr },
        { "remove_added", reinterpret_cast<PyCFunction>(PeerWatcher_remove_Added), METH_O, nullptr },
        { "add_enumeration_completed", reinterpret_cast<PyCFunction>(PeerWatcher_add_EnumerationCompleted), METH_O, nullptr },
        { "remove_enumeration_completed", reinterpret_cast<PyCFunction>(PeerWatcher_remove_EnumerationCompleted), METH_O, nullptr },
        { "add_removed", reinterpret_cast<PyCFunction>(PeerWatcher_add_Removed), METH_O, nullptr },
        { "remove_removed", reinterpret_cast<PyCFunction>(PeerWatcher_remove_Removed), METH_O, nullptr },
        { "add_stopped", reinterpret_cast<PyCFunction>(PeerWatcher_add_Stopped), METH_O, nullptr },
        { "remove_stopped", reinterpret_cast<PyCFunction>(PeerWatcher_remove_Stopped), METH_O, nullptr },
        { "add_updated", reinterpret_cast<PyCFunction>(PeerWatcher_add_Updated), METH_O, nullptr },
        { "remove_updated", reinterpret_cast<PyCFunction>(PeerWatcher_remove_Updated), METH_O, nullptr },
        { "_assign_array_", _assign_array_PeerWatcher, METH_O | METH_STATIC, nullptr },
        { "_from", reinterpret_cast<PyCFunction>(_from_PeerWatcher), METH_O | METH_STATIC, nullptr },
        { }
    };

    static PyGetSetDef _getset_PeerWatcher[] = {
        { "status", reinterpret_cast<getter>(PeerWatcher_get_Status), nullptr, nullptr, nullptr },
        { }
    };

    static PyType_Slot _type_slots_PeerWatcher[] = 
    {
        { Py_tp_new, reinterpret_cast<void*>(_new_PeerWatcher) },
        { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_PeerWatcher) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_PeerWatcher) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_PeerWatcher) },
        { },
    };

    static PyType_Spec type_spec_PeerWatcher =
    {
        "winrt._winrt_windows_networking_proximity.PeerWatcher",
        sizeof(py::wrapper::Windows::Networking::Proximity::PeerWatcher),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_PeerWatcher
    };

    // ----- ProximityDevice class --------------------

    static PyObject* _new_ProximityDevice(PyTypeObject* /*unused*/, PyObject* /*unused*/, PyObject* /*unused*/) noexcept
    {
        static_assert(py::py_type<winrt::Windows::Networking::Proximity::ProximityDevice>::type_name);
        py::set_invalid_activation_error(py::py_type<winrt::Windows::Networking::Proximity::ProximityDevice>::type_name);
        return nullptr;
    }

    static void _dealloc_ProximityDevice(py::wrapper::Windows::Networking::Proximity::ProximityDevice* self) noexcept
    {
        auto tp = Py_TYPE(self);
        std::destroy_at(&self->obj);
        tp->tp_free(self);
        Py_DECREF(tp);
    }

    static PyObject* ProximityDevice_FromId(PyObject* /*unused*/, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_Size(args);

        if (arg_count == 1)
        {
            if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Networking.Proximity.ProximityDevice", L"FromId", 1))
            {
                py::set_arg_count_version_error(1);
                return nullptr;
            }

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

                return py::convert(winrt::Windows::Networking::Proximity::ProximityDevice::FromId(param0));
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* ProximityDevice_GetDefault(PyObject* /*unused*/, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_Size(args);

        if (arg_count == 0)
        {
            if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Networking.Proximity.ProximityDevice", L"GetDefault", 0))
            {
                py::set_arg_count_version_error(0);
                return nullptr;
            }

            try
            {
                return py::convert(winrt::Windows::Networking::Proximity::ProximityDevice::GetDefault());
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* ProximityDevice_GetDeviceSelector(PyObject* /*unused*/, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_Size(args);

        if (arg_count == 0)
        {
            if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Networking.Proximity.ProximityDevice", L"GetDeviceSelector", 0))
            {
                py::set_arg_count_version_error(0);
                return nullptr;
            }

            try
            {
                return py::convert(winrt::Windows::Networking::Proximity::ProximityDevice::GetDeviceSelector());
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* ProximityDevice_PublishBinaryMessage(py::wrapper::Windows::Networking::Proximity::ProximityDevice* self, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_Size(args);

        if (arg_count == 2)
        {
            if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Networking.Proximity.ProximityDevice", L"PublishBinaryMessage", 2))
            {
                py::set_arg_count_version_error(2);
                return nullptr;
            }

            try
            {
                auto param0 = py::convert_to<winrt::hstring>(args, 0);
                auto param1 = py::convert_to<winrt::Windows::Storage::Streams::IBuffer>(args, 1);

                return py::convert(self->obj.PublishBinaryMessage(param0, param1));
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else if (arg_count == 3)
        {
            if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Networking.Proximity.ProximityDevice", L"PublishBinaryMessage", 3))
            {
                py::set_arg_count_version_error(3);
                return nullptr;
            }

            try
            {
                auto param0 = py::convert_to<winrt::hstring>(args, 0);
                auto param1 = py::convert_to<winrt::Windows::Storage::Streams::IBuffer>(args, 1);
                auto param2 = py::convert_to<winrt::Windows::Networking::Proximity::MessageTransmittedHandler>(args, 2);

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

    static PyObject* ProximityDevice_PublishMessage(py::wrapper::Windows::Networking::Proximity::ProximityDevice* self, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_Size(args);

        if (arg_count == 2)
        {
            if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Networking.Proximity.ProximityDevice", L"PublishMessage", 2))
            {
                py::set_arg_count_version_error(2);
                return nullptr;
            }

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

                return py::convert(self->obj.PublishMessage(param0, param1));
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else if (arg_count == 3)
        {
            if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Networking.Proximity.ProximityDevice", L"PublishMessage", 3))
            {
                py::set_arg_count_version_error(3);
                return nullptr;
            }

            try
            {
                auto param0 = py::convert_to<winrt::hstring>(args, 0);
                auto param1 = py::convert_to<winrt::hstring>(args, 1);
                auto param2 = py::convert_to<winrt::Windows::Networking::Proximity::MessageTransmittedHandler>(args, 2);

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

    static PyObject* ProximityDevice_PublishUriMessage(py::wrapper::Windows::Networking::Proximity::ProximityDevice* self, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_Size(args);

        if (arg_count == 1)
        {
            if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Networking.Proximity.ProximityDevice", L"PublishUriMessage", 1))
            {
                py::set_arg_count_version_error(1);
                return nullptr;
            }

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

                return py::convert(self->obj.PublishUriMessage(param0));
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else if (arg_count == 2)
        {
            if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Networking.Proximity.ProximityDevice", L"PublishUriMessage", 2))
            {
                py::set_arg_count_version_error(2);
                return nullptr;
            }

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

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

    static PyObject* ProximityDevice_StopPublishingMessage(py::wrapper::Windows::Networking::Proximity::ProximityDevice* self, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_Size(args);

        if (arg_count == 1)
        {
            if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Networking.Proximity.ProximityDevice", L"StopPublishingMessage", 1))
            {
                py::set_arg_count_version_error(1);
                return nullptr;
            }

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

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

    static PyObject* ProximityDevice_StopSubscribingForMessage(py::wrapper::Windows::Networking::Proximity::ProximityDevice* self, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_Size(args);

        if (arg_count == 1)
        {
            if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Networking.Proximity.ProximityDevice", L"StopSubscribingForMessage", 1))
            {
                py::set_arg_count_version_error(1);
                return nullptr;
            }

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

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

    static PyObject* ProximityDevice_SubscribeForMessage(py::wrapper::Windows::Networking::Proximity::ProximityDevice* self, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_Size(args);

        if (arg_count == 2)
        {
            if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Networking.Proximity.ProximityDevice", L"SubscribeForMessage", 2))
            {
                py::set_arg_count_version_error(2);
                return nullptr;
            }

            try
            {
                auto param0 = py::convert_to<winrt::hstring>(args, 0);
                auto param1 = py::convert_to<winrt::Windows::Networking::Proximity::MessageReceivedHandler>(args, 1);

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

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

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

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

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

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

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

    static PyObject* ProximityDevice_add_DeviceArrived(py::wrapper::Windows::Networking::Proximity::ProximityDevice* self, PyObject* arg) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsEventPresent(L"Windows.Networking.Proximity.ProximityDevice", L"DeviceArrived"))
        {
            PyErr_SetString(PyExc_AttributeError, "event is not available in this version of Windows");
            return nullptr;
        }

        try
        {
            auto param0 = py::convert_to<winrt::Windows::Networking::Proximity::DeviceArrivedEventHandler>(arg);

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

    static PyObject* ProximityDevice_remove_DeviceArrived(py::wrapper::Windows::Networking::Proximity::ProximityDevice* self, PyObject* arg) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsEventPresent(L"Windows.Networking.Proximity.ProximityDevice", L"DeviceArrived"))
        {
            PyErr_SetString(PyExc_AttributeError, "event is not available in this version of Windows");
            return nullptr;
        }

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

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

    static PyObject* ProximityDevice_add_DeviceDeparted(py::wrapper::Windows::Networking::Proximity::ProximityDevice* self, PyObject* arg) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsEventPresent(L"Windows.Networking.Proximity.ProximityDevice", L"DeviceDeparted"))
        {
            PyErr_SetString(PyExc_AttributeError, "event is not available in this version of Windows");
            return nullptr;
        }

        try
        {
            auto param0 = py::convert_to<winrt::Windows::Networking::Proximity::DeviceDepartedEventHandler>(arg);

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

    static PyObject* ProximityDevice_remove_DeviceDeparted(py::wrapper::Windows::Networking::Proximity::ProximityDevice* self, PyObject* arg) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsEventPresent(L"Windows.Networking.Proximity.ProximityDevice", L"DeviceDeparted"))
        {
            PyErr_SetString(PyExc_AttributeError, "event is not available in this version of Windows");
            return nullptr;
        }

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

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

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

    static PyObject* _from_ProximityDevice(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::Networking::Proximity::ProximityDevice>());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyMethodDef _methods_ProximityDevice[] = {
        { "publish_binary_message", reinterpret_cast<PyCFunction>(ProximityDevice_PublishBinaryMessage), METH_VARARGS, nullptr },
        { "publish_message", reinterpret_cast<PyCFunction>(ProximityDevice_PublishMessage), METH_VARARGS, nullptr },
        { "publish_uri_message", reinterpret_cast<PyCFunction>(ProximityDevice_PublishUriMessage), METH_VARARGS, nullptr },
        { "stop_publishing_message", reinterpret_cast<PyCFunction>(ProximityDevice_StopPublishingMessage), METH_VARARGS, nullptr },
        { "stop_subscribing_for_message", reinterpret_cast<PyCFunction>(ProximityDevice_StopSubscribingForMessage), METH_VARARGS, nullptr },
        { "subscribe_for_message", reinterpret_cast<PyCFunction>(ProximityDevice_SubscribeForMessage), METH_VARARGS, nullptr },
        { "add_device_arrived", reinterpret_cast<PyCFunction>(ProximityDevice_add_DeviceArrived), METH_O, nullptr },
        { "remove_device_arrived", reinterpret_cast<PyCFunction>(ProximityDevice_remove_DeviceArrived), METH_O, nullptr },
        { "add_device_departed", reinterpret_cast<PyCFunction>(ProximityDevice_add_DeviceDeparted), METH_O, nullptr },
        { "remove_device_departed", reinterpret_cast<PyCFunction>(ProximityDevice_remove_DeviceDeparted), METH_O, nullptr },
        { "_assign_array_", _assign_array_ProximityDevice, METH_O | METH_STATIC, nullptr },
        { "_from", reinterpret_cast<PyCFunction>(_from_ProximityDevice), METH_O | METH_STATIC, nullptr },
        { }
    };

    static PyGetSetDef _getset_ProximityDevice[] = {
        { "bits_per_second", reinterpret_cast<getter>(ProximityDevice_get_BitsPerSecond), nullptr, nullptr, nullptr },
        { "device_id", reinterpret_cast<getter>(ProximityDevice_get_DeviceId), nullptr, nullptr, nullptr },
        { "max_message_bytes", reinterpret_cast<getter>(ProximityDevice_get_MaxMessageBytes), nullptr, nullptr, nullptr },
        { }
    };

    static PyType_Slot _type_slots_ProximityDevice[] = 
    {
        { Py_tp_new, reinterpret_cast<void*>(_new_ProximityDevice) },
        { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_ProximityDevice) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_ProximityDevice) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_ProximityDevice) },
        { },
    };

    static PyType_Spec type_spec_ProximityDevice =
    {
        "winrt._winrt_windows_networking_proximity.ProximityDevice",
        sizeof(py::wrapper::Windows::Networking::Proximity::ProximityDevice),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_ProximityDevice
    };

    static PyGetSetDef getset_ProximityDevice_Static[] = {
        { }
    };

    static PyMethodDef methods_ProximityDevice_Static[] = {
        { "from_id", reinterpret_cast<PyCFunction>(ProximityDevice_FromId), METH_VARARGS, nullptr },
        { "get_default", reinterpret_cast<PyCFunction>(ProximityDevice_GetDefault), METH_VARARGS, nullptr },
        { "get_device_selector", reinterpret_cast<PyCFunction>(ProximityDevice_GetDeviceSelector), METH_VARARGS, nullptr },
        { }
    };

    static PyType_Slot type_slots_ProximityDevice_Static[] = 
    {
        { Py_tp_base, reinterpret_cast<void*>(&PyType_Type) },
        { Py_tp_getset, reinterpret_cast<void*>(getset_ProximityDevice_Static) },
        { Py_tp_methods, reinterpret_cast<void*>(methods_ProximityDevice_Static) },
        { }
    };

    static PyType_Spec type_spec_ProximityDevice_Static =
    {
        "winrt._winrt_windows_networking_proximity.ProximityDevice_Static",
        static_cast<int>(PyType_Type.tp_basicsize),
        static_cast<int>(PyType_Type.tp_itemsize),
        Py_TPFLAGS_DEFAULT,
        type_slots_ProximityDevice_Static
    };

    // ----- ProximityMessage class --------------------

    static PyObject* _new_ProximityMessage(PyTypeObject* /*unused*/, PyObject* /*unused*/, PyObject* /*unused*/) noexcept
    {
        static_assert(py::py_type<winrt::Windows::Networking::Proximity::ProximityMessage>::type_name);
        py::set_invalid_activation_error(py::py_type<winrt::Windows::Networking::Proximity::ProximityMessage>::type_name);
        return nullptr;
    }

    static void _dealloc_ProximityMessage(py::wrapper::Windows::Networking::Proximity::ProximityMessage* self) noexcept
    {
        auto tp = Py_TYPE(self);
        std::destroy_at(&self->obj);
        tp->tp_free(self);
        Py_DECREF(tp);
    }

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

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

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

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

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

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

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

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

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

    static PyObject* _from_ProximityMessage(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::Networking::Proximity::ProximityMessage>());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyMethodDef _methods_ProximityMessage[] = {
        { "_assign_array_", _assign_array_ProximityMessage, METH_O | METH_STATIC, nullptr },
        { "_from", reinterpret_cast<PyCFunction>(_from_ProximityMessage), METH_O | METH_STATIC, nullptr },
        { }
    };

    static PyGetSetDef _getset_ProximityMessage[] = {
        { "data", reinterpret_cast<getter>(ProximityMessage_get_Data), nullptr, nullptr, nullptr },
        { "data_as_string", reinterpret_cast<getter>(ProximityMessage_get_DataAsString), nullptr, nullptr, nullptr },
        { "message_type", reinterpret_cast<getter>(ProximityMessage_get_MessageType), nullptr, nullptr, nullptr },
        { "subscription_id", reinterpret_cast<getter>(ProximityMessage_get_SubscriptionId), nullptr, nullptr, nullptr },
        { }
    };

    static PyType_Slot _type_slots_ProximityMessage[] = 
    {
        { Py_tp_new, reinterpret_cast<void*>(_new_ProximityMessage) },
        { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_ProximityMessage) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_ProximityMessage) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_ProximityMessage) },
        { },
    };

    static PyType_Spec type_spec_ProximityMessage =
    {
        "winrt._winrt_windows_networking_proximity.ProximityMessage",
        sizeof(py::wrapper::Windows::Networking::Proximity::ProximityMessage),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_ProximityMessage
    };

    // ----- TriggeredConnectionStateChangedEventArgs class --------------------

    static PyObject* _new_TriggeredConnectionStateChangedEventArgs(PyTypeObject* /*unused*/, PyObject* /*unused*/, PyObject* /*unused*/) noexcept
    {
        static_assert(py::py_type<winrt::Windows::Networking::Proximity::TriggeredConnectionStateChangedEventArgs>::type_name);
        py::set_invalid_activation_error(py::py_type<winrt::Windows::Networking::Proximity::TriggeredConnectionStateChangedEventArgs>::type_name);
        return nullptr;
    }

    static void _dealloc_TriggeredConnectionStateChangedEventArgs(py::wrapper::Windows::Networking::Proximity::TriggeredConnectionStateChangedEventArgs* self) noexcept
    {
        auto tp = Py_TYPE(self);
        std::destroy_at(&self->obj);
        tp->tp_free(self);
        Py_DECREF(tp);
    }

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

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

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

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

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

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

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

    static PyObject* _from_TriggeredConnectionStateChangedEventArgs(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::Networking::Proximity::TriggeredConnectionStateChangedEventArgs>());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyMethodDef _methods_TriggeredConnectionStateChangedEventArgs[] = {
        { "_assign_array_", _assign_array_TriggeredConnectionStateChangedEventArgs, METH_O | METH_STATIC, nullptr },
        { "_from", reinterpret_cast<PyCFunction>(_from_TriggeredConnectionStateChangedEventArgs), METH_O | METH_STATIC, nullptr },
        { }
    };

    static PyGetSetDef _getset_TriggeredConnectionStateChangedEventArgs[] = {
        { "id", reinterpret_cast<getter>(TriggeredConnectionStateChangedEventArgs_get_Id), nullptr, nullptr, nullptr },
        { "socket", reinterpret_cast<getter>(TriggeredConnectionStateChangedEventArgs_get_Socket), nullptr, nullptr, nullptr },
        { "state", reinterpret_cast<getter>(TriggeredConnectionStateChangedEventArgs_get_State), nullptr, nullptr, nullptr },
        { }
    };

    static PyType_Slot _type_slots_TriggeredConnectionStateChangedEventArgs[] = 
    {
        { Py_tp_new, reinterpret_cast<void*>(_new_TriggeredConnectionStateChangedEventArgs) },
        { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_TriggeredConnectionStateChangedEventArgs) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_TriggeredConnectionStateChangedEventArgs) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_TriggeredConnectionStateChangedEventArgs) },
        { },
    };

    static PyType_Spec type_spec_TriggeredConnectionStateChangedEventArgs =
    {
        "winrt._winrt_windows_networking_proximity.TriggeredConnectionStateChangedEventArgs",
        sizeof(py::wrapper::Windows::Networking::Proximity::TriggeredConnectionStateChangedEventArgs),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_TriggeredConnectionStateChangedEventArgs
    };

    // ----- Windows.Networking.Proximity Initialization --------------------
    PyDoc_STRVAR(module_doc, "Windows::Networking::Proximity");


    static PyModuleDef module_def
        = {PyModuleDef_HEAD_INIT,
           "_winrt_windows_networking_proximity",
           module_doc,
           0,
           nullptr,
           nullptr,
           nullptr,
           nullptr,
           nullptr};

} // py::cpp::Windows::Networking::Proximity

PyMODINIT_FUNC PyInit__winrt_windows_networking_proximity(void) noexcept
{
    using namespace py::cpp::Windows::Networking::Proximity;

    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_ConnectionRequestedEventArgs, object_bases.get(), nullptr) == -1)
    {
        return nullptr;
    }

    py::pyobj_handle type_PeerFinder_Static{PyType_FromSpec(&type_spec_PeerFinder_Static)};
    if (!type_PeerFinder_Static)
    {
        return nullptr;
    }

    if (py::register_python_type(module.get(), &type_spec_PeerFinder, object_bases.get(), reinterpret_cast<PyTypeObject*>(type_PeerFinder_Static.get())) == -1)
    {
        return nullptr;
    }

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

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

    py::pyobj_handle type_ProximityDevice_Static{PyType_FromSpec(&type_spec_ProximityDevice_Static)};
    if (!type_ProximityDevice_Static)
    {
        return nullptr;
    }

    if (py::register_python_type(module.get(), &type_spec_ProximityDevice, object_bases.get(), reinterpret_cast<PyTypeObject*>(type_ProximityDevice_Static.get())) == -1)
    {
        return nullptr;
    }

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

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


    return module.detach();
}
