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

#include "py.Windows.Devices.WiFiDirect.h"


namespace py::cpp::Windows::Devices::WiFiDirect
{
    // ----- WiFiDirectAdvertisement class --------------------

    static PyObject* _new_WiFiDirectAdvertisement(PyTypeObject* /*unused*/, PyObject* /*unused*/, PyObject* /*unused*/) noexcept
    {
        static_assert(py::py_type<winrt::Windows::Devices::WiFiDirect::WiFiDirectAdvertisement>::type_name);
        py::set_invalid_activation_error(py::py_type<winrt::Windows::Devices::WiFiDirect::WiFiDirectAdvertisement>::type_name);
        return nullptr;
    }

    static void _dealloc_WiFiDirectAdvertisement(py::wrapper::Windows::Devices::WiFiDirect::WiFiDirectAdvertisement* self) noexcept
    {
        auto tp = Py_TYPE(self);
        std::destroy_at(&self->obj);
        tp->tp_free(self);
        Py_DECREF(tp);
    }

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

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

    static int WiFiDirectAdvertisement_put_ListenStateDiscoverability(py::wrapper::Windows::Devices::WiFiDirect::WiFiDirectAdvertisement* self, PyObject* arg, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Devices.WiFiDirect.WiFiDirectAdvertisement", L"ListenStateDiscoverability"))
        {
            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::Devices::WiFiDirect::WiFiDirectAdvertisementListenStateDiscoverability>(arg);

            self->obj.ListenStateDiscoverability(param0);
            return 0;
        }
        catch (...)
        {
            py::to_PyErr();
            return -1;
        }
    }

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

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

    static int WiFiDirectAdvertisement_put_IsAutonomousGroupOwnerEnabled(py::wrapper::Windows::Devices::WiFiDirect::WiFiDirectAdvertisement* self, PyObject* arg, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Devices.WiFiDirect.WiFiDirectAdvertisement", L"IsAutonomousGroupOwnerEnabled"))
        {
            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);

            self->obj.IsAutonomousGroupOwnerEnabled(param0);
            return 0;
        }
        catch (...)
        {
            py::to_PyErr();
            return -1;
        }
    }

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

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

    static int WiFiDirectAdvertisement_put_InformationElements(py::wrapper::Windows::Devices::WiFiDirect::WiFiDirectAdvertisement* self, PyObject* arg, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Devices.WiFiDirect.WiFiDirectAdvertisement", L"InformationElements"))
        {
            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::Foundation::Collections::IVector<winrt::Windows::Devices::WiFiDirect::WiFiDirectInformationElement>>(arg);

            self->obj.InformationElements(param0);
            return 0;
        }
        catch (...)
        {
            py::to_PyErr();
            return -1;
        }
    }

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

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

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

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

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

    static PyObject* _from_WiFiDirectAdvertisement(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::Devices::WiFiDirect::WiFiDirectAdvertisement>());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyMethodDef _methods_WiFiDirectAdvertisement[] = {
        { "_assign_array_", _assign_array_WiFiDirectAdvertisement, METH_O | METH_STATIC, nullptr },
        { "_from", reinterpret_cast<PyCFunction>(_from_WiFiDirectAdvertisement), METH_O | METH_STATIC, nullptr },
        { }
    };

    static PyGetSetDef _getset_WiFiDirectAdvertisement[] = {
        { "listen_state_discoverability", reinterpret_cast<getter>(WiFiDirectAdvertisement_get_ListenStateDiscoverability), reinterpret_cast<setter>(WiFiDirectAdvertisement_put_ListenStateDiscoverability), nullptr, nullptr },
        { "is_autonomous_group_owner_enabled", reinterpret_cast<getter>(WiFiDirectAdvertisement_get_IsAutonomousGroupOwnerEnabled), reinterpret_cast<setter>(WiFiDirectAdvertisement_put_IsAutonomousGroupOwnerEnabled), nullptr, nullptr },
        { "information_elements", reinterpret_cast<getter>(WiFiDirectAdvertisement_get_InformationElements), reinterpret_cast<setter>(WiFiDirectAdvertisement_put_InformationElements), nullptr, nullptr },
        { "legacy_settings", reinterpret_cast<getter>(WiFiDirectAdvertisement_get_LegacySettings), nullptr, nullptr, nullptr },
        { "supported_configuration_methods", reinterpret_cast<getter>(WiFiDirectAdvertisement_get_SupportedConfigurationMethods), nullptr, nullptr, nullptr },
        { }
    };

    static PyType_Slot _type_slots_WiFiDirectAdvertisement[] = 
    {
        { Py_tp_new, reinterpret_cast<void*>(_new_WiFiDirectAdvertisement) },
        { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_WiFiDirectAdvertisement) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_WiFiDirectAdvertisement) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_WiFiDirectAdvertisement) },
        { },
    };

    static PyType_Spec type_spec_WiFiDirectAdvertisement =
    {
        "winrt._winrt_windows_devices_wifidirect.WiFiDirectAdvertisement",
        sizeof(py::wrapper::Windows::Devices::WiFiDirect::WiFiDirectAdvertisement),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_WiFiDirectAdvertisement
    };

    // ----- WiFiDirectAdvertisementPublisher class --------------------

    static PyObject* _new_WiFiDirectAdvertisementPublisher(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::Devices::WiFiDirect::WiFiDirectAdvertisementPublisher 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_WiFiDirectAdvertisementPublisher(py::wrapper::Windows::Devices::WiFiDirect::WiFiDirectAdvertisementPublisher* self) noexcept
    {
        auto tp = Py_TYPE(self);
        std::destroy_at(&self->obj);
        tp->tp_free(self);
        Py_DECREF(tp);
    }

    static PyObject* WiFiDirectAdvertisementPublisher_Start(py::wrapper::Windows::Devices::WiFiDirect::WiFiDirectAdvertisementPublisher* self, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_Size(args);

        if (arg_count == 0)
        {
            if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Devices.WiFiDirect.WiFiDirectAdvertisementPublisher", 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* WiFiDirectAdvertisementPublisher_Stop(py::wrapper::Windows::Devices::WiFiDirect::WiFiDirectAdvertisementPublisher* self, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_Size(args);

        if (arg_count == 0)
        {
            if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Devices.WiFiDirect.WiFiDirectAdvertisementPublisher", 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* WiFiDirectAdvertisementPublisher_get_Advertisement(py::wrapper::Windows::Devices::WiFiDirect::WiFiDirectAdvertisementPublisher* self, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Devices.WiFiDirect.WiFiDirectAdvertisementPublisher", L"Advertisement"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return nullptr;
        }

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

    static PyObject* WiFiDirectAdvertisementPublisher_get_Status(py::wrapper::Windows::Devices::WiFiDirect::WiFiDirectAdvertisementPublisher* self, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Devices.WiFiDirect.WiFiDirectAdvertisementPublisher", 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* WiFiDirectAdvertisementPublisher_add_StatusChanged(py::wrapper::Windows::Devices::WiFiDirect::WiFiDirectAdvertisementPublisher* self, PyObject* arg) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsEventPresent(L"Windows.Devices.WiFiDirect.WiFiDirectAdvertisementPublisher", L"StatusChanged"))
        {
            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::Devices::WiFiDirect::WiFiDirectAdvertisementPublisher, winrt::Windows::Devices::WiFiDirect::WiFiDirectAdvertisementPublisherStatusChangedEventArgs>>(arg);

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

    static PyObject* WiFiDirectAdvertisementPublisher_remove_StatusChanged(py::wrapper::Windows::Devices::WiFiDirect::WiFiDirectAdvertisementPublisher* self, PyObject* arg) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsEventPresent(L"Windows.Devices.WiFiDirect.WiFiDirectAdvertisementPublisher", L"StatusChanged"))
        {
            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.StatusChanged(param0);
            Py_RETURN_NONE;
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

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

    static PyObject* _from_WiFiDirectAdvertisementPublisher(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::Devices::WiFiDirect::WiFiDirectAdvertisementPublisher>());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyMethodDef _methods_WiFiDirectAdvertisementPublisher[] = {
        { "start", reinterpret_cast<PyCFunction>(WiFiDirectAdvertisementPublisher_Start), METH_VARARGS, nullptr },
        { "stop", reinterpret_cast<PyCFunction>(WiFiDirectAdvertisementPublisher_Stop), METH_VARARGS, nullptr },
        { "add_status_changed", reinterpret_cast<PyCFunction>(WiFiDirectAdvertisementPublisher_add_StatusChanged), METH_O, nullptr },
        { "remove_status_changed", reinterpret_cast<PyCFunction>(WiFiDirectAdvertisementPublisher_remove_StatusChanged), METH_O, nullptr },
        { "_assign_array_", _assign_array_WiFiDirectAdvertisementPublisher, METH_O | METH_STATIC, nullptr },
        { "_from", reinterpret_cast<PyCFunction>(_from_WiFiDirectAdvertisementPublisher), METH_O | METH_STATIC, nullptr },
        { }
    };

    static PyGetSetDef _getset_WiFiDirectAdvertisementPublisher[] = {
        { "advertisement", reinterpret_cast<getter>(WiFiDirectAdvertisementPublisher_get_Advertisement), nullptr, nullptr, nullptr },
        { "status", reinterpret_cast<getter>(WiFiDirectAdvertisementPublisher_get_Status), nullptr, nullptr, nullptr },
        { }
    };

    static PyType_Slot _type_slots_WiFiDirectAdvertisementPublisher[] = 
    {
        { Py_tp_new, reinterpret_cast<void*>(_new_WiFiDirectAdvertisementPublisher) },
        { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_WiFiDirectAdvertisementPublisher) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_WiFiDirectAdvertisementPublisher) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_WiFiDirectAdvertisementPublisher) },
        { },
    };

    static PyType_Spec type_spec_WiFiDirectAdvertisementPublisher =
    {
        "winrt._winrt_windows_devices_wifidirect.WiFiDirectAdvertisementPublisher",
        sizeof(py::wrapper::Windows::Devices::WiFiDirect::WiFiDirectAdvertisementPublisher),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_WiFiDirectAdvertisementPublisher
    };

    // ----- WiFiDirectAdvertisementPublisherStatusChangedEventArgs class --------------------

    static PyObject* _new_WiFiDirectAdvertisementPublisherStatusChangedEventArgs(PyTypeObject* /*unused*/, PyObject* /*unused*/, PyObject* /*unused*/) noexcept
    {
        static_assert(py::py_type<winrt::Windows::Devices::WiFiDirect::WiFiDirectAdvertisementPublisherStatusChangedEventArgs>::type_name);
        py::set_invalid_activation_error(py::py_type<winrt::Windows::Devices::WiFiDirect::WiFiDirectAdvertisementPublisherStatusChangedEventArgs>::type_name);
        return nullptr;
    }

    static void _dealloc_WiFiDirectAdvertisementPublisherStatusChangedEventArgs(py::wrapper::Windows::Devices::WiFiDirect::WiFiDirectAdvertisementPublisherStatusChangedEventArgs* self) noexcept
    {
        auto tp = Py_TYPE(self);
        std::destroy_at(&self->obj);
        tp->tp_free(self);
        Py_DECREF(tp);
    }

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

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

    static PyObject* WiFiDirectAdvertisementPublisherStatusChangedEventArgs_get_Status(py::wrapper::Windows::Devices::WiFiDirect::WiFiDirectAdvertisementPublisherStatusChangedEventArgs* self, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Devices.WiFiDirect.WiFiDirectAdvertisementPublisherStatusChangedEventArgs", 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* _assign_array_WiFiDirectAdvertisementPublisherStatusChangedEventArgs(PyObject* /*unused*/, PyObject* arg) noexcept
    {
        auto array = std::make_unique<py::ComArray<winrt::Windows::Devices::WiFiDirect::WiFiDirectAdvertisementPublisherStatusChangedEventArgs>>();
        if (!py::cpp::_winrt::Array_Assign(arg, std::move(array)))
        {
            return nullptr;
        }
        Py_RETURN_NONE;
    }

    static PyObject* _from_WiFiDirectAdvertisementPublisherStatusChangedEventArgs(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::Devices::WiFiDirect::WiFiDirectAdvertisementPublisherStatusChangedEventArgs>());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyMethodDef _methods_WiFiDirectAdvertisementPublisherStatusChangedEventArgs[] = {
        { "_assign_array_", _assign_array_WiFiDirectAdvertisementPublisherStatusChangedEventArgs, METH_O | METH_STATIC, nullptr },
        { "_from", reinterpret_cast<PyCFunction>(_from_WiFiDirectAdvertisementPublisherStatusChangedEventArgs), METH_O | METH_STATIC, nullptr },
        { }
    };

    static PyGetSetDef _getset_WiFiDirectAdvertisementPublisherStatusChangedEventArgs[] = {
        { "error", reinterpret_cast<getter>(WiFiDirectAdvertisementPublisherStatusChangedEventArgs_get_Error), nullptr, nullptr, nullptr },
        { "status", reinterpret_cast<getter>(WiFiDirectAdvertisementPublisherStatusChangedEventArgs_get_Status), nullptr, nullptr, nullptr },
        { }
    };

    static PyType_Slot _type_slots_WiFiDirectAdvertisementPublisherStatusChangedEventArgs[] = 
    {
        { Py_tp_new, reinterpret_cast<void*>(_new_WiFiDirectAdvertisementPublisherStatusChangedEventArgs) },
        { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_WiFiDirectAdvertisementPublisherStatusChangedEventArgs) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_WiFiDirectAdvertisementPublisherStatusChangedEventArgs) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_WiFiDirectAdvertisementPublisherStatusChangedEventArgs) },
        { },
    };

    static PyType_Spec type_spec_WiFiDirectAdvertisementPublisherStatusChangedEventArgs =
    {
        "winrt._winrt_windows_devices_wifidirect.WiFiDirectAdvertisementPublisherStatusChangedEventArgs",
        sizeof(py::wrapper::Windows::Devices::WiFiDirect::WiFiDirectAdvertisementPublisherStatusChangedEventArgs),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_WiFiDirectAdvertisementPublisherStatusChangedEventArgs
    };

    // ----- WiFiDirectConnectionListener class --------------------

    static PyObject* _new_WiFiDirectConnectionListener(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::Devices::WiFiDirect::WiFiDirectConnectionListener 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_WiFiDirectConnectionListener(py::wrapper::Windows::Devices::WiFiDirect::WiFiDirectConnectionListener* self) noexcept
    {
        auto tp = Py_TYPE(self);
        std::destroy_at(&self->obj);
        tp->tp_free(self);
        Py_DECREF(tp);
    }

    static PyObject* WiFiDirectConnectionListener_add_ConnectionRequested(py::wrapper::Windows::Devices::WiFiDirect::WiFiDirectConnectionListener* self, PyObject* arg) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsEventPresent(L"Windows.Devices.WiFiDirect.WiFiDirectConnectionListener", 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::Devices::WiFiDirect::WiFiDirectConnectionListener, winrt::Windows::Devices::WiFiDirect::WiFiDirectConnectionRequestedEventArgs>>(arg);

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

    static PyObject* WiFiDirectConnectionListener_remove_ConnectionRequested(py::wrapper::Windows::Devices::WiFiDirect::WiFiDirectConnectionListener* self, PyObject* arg) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsEventPresent(L"Windows.Devices.WiFiDirect.WiFiDirectConnectionListener", 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);

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

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

    static PyObject* _from_WiFiDirectConnectionListener(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::Devices::WiFiDirect::WiFiDirectConnectionListener>());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyMethodDef _methods_WiFiDirectConnectionListener[] = {
        { "add_connection_requested", reinterpret_cast<PyCFunction>(WiFiDirectConnectionListener_add_ConnectionRequested), METH_O, nullptr },
        { "remove_connection_requested", reinterpret_cast<PyCFunction>(WiFiDirectConnectionListener_remove_ConnectionRequested), METH_O, nullptr },
        { "_assign_array_", _assign_array_WiFiDirectConnectionListener, METH_O | METH_STATIC, nullptr },
        { "_from", reinterpret_cast<PyCFunction>(_from_WiFiDirectConnectionListener), METH_O | METH_STATIC, nullptr },
        { }
    };

    static PyGetSetDef _getset_WiFiDirectConnectionListener[] = {
        { }
    };

    static PyType_Slot _type_slots_WiFiDirectConnectionListener[] = 
    {
        { Py_tp_new, reinterpret_cast<void*>(_new_WiFiDirectConnectionListener) },
        { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_WiFiDirectConnectionListener) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_WiFiDirectConnectionListener) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_WiFiDirectConnectionListener) },
        { },
    };

    static PyType_Spec type_spec_WiFiDirectConnectionListener =
    {
        "winrt._winrt_windows_devices_wifidirect.WiFiDirectConnectionListener",
        sizeof(py::wrapper::Windows::Devices::WiFiDirect::WiFiDirectConnectionListener),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_WiFiDirectConnectionListener
    };

    // ----- WiFiDirectConnectionParameters class --------------------

    static PyObject* _new_WiFiDirectConnectionParameters(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::Devices::WiFiDirect::WiFiDirectConnectionParameters 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_WiFiDirectConnectionParameters(py::wrapper::Windows::Devices::WiFiDirect::WiFiDirectConnectionParameters* self) noexcept
    {
        auto tp = Py_TYPE(self);
        std::destroy_at(&self->obj);
        tp->tp_free(self);
        Py_DECREF(tp);
    }

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

        if (arg_count == 1)
        {
            if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Devices.WiFiDirect.WiFiDirectConnectionParameters", L"GetDevicePairingKinds", 1))
            {
                py::set_arg_count_version_error(1);
                return nullptr;
            }

            try
            {
                auto param0 = py::convert_to<winrt::Windows::Devices::WiFiDirect::WiFiDirectConfigurationMethod>(args, 0);

                return py::convert(winrt::Windows::Devices::WiFiDirect::WiFiDirectConnectionParameters::GetDevicePairingKinds(param0));
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

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

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

    static int WiFiDirectConnectionParameters_put_GroupOwnerIntent(py::wrapper::Windows::Devices::WiFiDirect::WiFiDirectConnectionParameters* self, PyObject* arg, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Devices.WiFiDirect.WiFiDirectConnectionParameters", L"GroupOwnerIntent"))
        {
            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<int16_t>(arg);

            self->obj.GroupOwnerIntent(param0);
            return 0;
        }
        catch (...)
        {
            py::to_PyErr();
            return -1;
        }
    }

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

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

    static int WiFiDirectConnectionParameters_put_PreferredPairingProcedure(py::wrapper::Windows::Devices::WiFiDirect::WiFiDirectConnectionParameters* self, PyObject* arg, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Devices.WiFiDirect.WiFiDirectConnectionParameters", L"PreferredPairingProcedure"))
        {
            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::Devices::WiFiDirect::WiFiDirectPairingProcedure>(arg);

            self->obj.PreferredPairingProcedure(param0);
            return 0;
        }
        catch (...)
        {
            py::to_PyErr();
            return -1;
        }
    }

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

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

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

    static PyObject* _from_WiFiDirectConnectionParameters(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::Devices::WiFiDirect::WiFiDirectConnectionParameters>());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyMethodDef _methods_WiFiDirectConnectionParameters[] = {
        { "_assign_array_", _assign_array_WiFiDirectConnectionParameters, METH_O | METH_STATIC, nullptr },
        { "_from", reinterpret_cast<PyCFunction>(_from_WiFiDirectConnectionParameters), METH_O | METH_STATIC, nullptr },
        { }
    };

    static PyGetSetDef _getset_WiFiDirectConnectionParameters[] = {
        { "group_owner_intent", reinterpret_cast<getter>(WiFiDirectConnectionParameters_get_GroupOwnerIntent), reinterpret_cast<setter>(WiFiDirectConnectionParameters_put_GroupOwnerIntent), nullptr, nullptr },
        { "preferred_pairing_procedure", reinterpret_cast<getter>(WiFiDirectConnectionParameters_get_PreferredPairingProcedure), reinterpret_cast<setter>(WiFiDirectConnectionParameters_put_PreferredPairingProcedure), nullptr, nullptr },
        { "preference_ordered_configuration_methods", reinterpret_cast<getter>(WiFiDirectConnectionParameters_get_PreferenceOrderedConfigurationMethods), nullptr, nullptr, nullptr },
        { }
    };

    static PyType_Slot _type_slots_WiFiDirectConnectionParameters[] = 
    {
        { Py_tp_new, reinterpret_cast<void*>(_new_WiFiDirectConnectionParameters) },
        { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_WiFiDirectConnectionParameters) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_WiFiDirectConnectionParameters) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_WiFiDirectConnectionParameters) },
        { },
    };

    static PyType_Spec type_spec_WiFiDirectConnectionParameters =
    {
        "winrt._winrt_windows_devices_wifidirect.WiFiDirectConnectionParameters",
        sizeof(py::wrapper::Windows::Devices::WiFiDirect::WiFiDirectConnectionParameters),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_WiFiDirectConnectionParameters
    };

    static PyGetSetDef getset_WiFiDirectConnectionParameters_Static[] = {
        { }
    };

    static PyMethodDef methods_WiFiDirectConnectionParameters_Static[] = {
        { "get_device_pairing_kinds", reinterpret_cast<PyCFunction>(WiFiDirectConnectionParameters_GetDevicePairingKinds), METH_VARARGS, nullptr },
        { }
    };

    static PyType_Slot type_slots_WiFiDirectConnectionParameters_Static[] = 
    {
        { Py_tp_base, reinterpret_cast<void*>(&PyType_Type) },
        { Py_tp_getset, reinterpret_cast<void*>(getset_WiFiDirectConnectionParameters_Static) },
        { Py_tp_methods, reinterpret_cast<void*>(methods_WiFiDirectConnectionParameters_Static) },
        { }
    };

    static PyType_Spec type_spec_WiFiDirectConnectionParameters_Static =
    {
        "winrt._winrt_windows_devices_wifidirect.WiFiDirectConnectionParameters_Static",
        static_cast<int>(PyType_Type.tp_basicsize),
        static_cast<int>(PyType_Type.tp_itemsize),
        Py_TPFLAGS_DEFAULT,
        type_slots_WiFiDirectConnectionParameters_Static
    };

    // ----- WiFiDirectConnectionRequest class --------------------

    static PyObject* _new_WiFiDirectConnectionRequest(PyTypeObject* /*unused*/, PyObject* /*unused*/, PyObject* /*unused*/) noexcept
    {
        static_assert(py::py_type<winrt::Windows::Devices::WiFiDirect::WiFiDirectConnectionRequest>::type_name);
        py::set_invalid_activation_error(py::py_type<winrt::Windows::Devices::WiFiDirect::WiFiDirectConnectionRequest>::type_name);
        return nullptr;
    }

    static void _dealloc_WiFiDirectConnectionRequest(py::wrapper::Windows::Devices::WiFiDirect::WiFiDirectConnectionRequest* self) noexcept
    {
        auto tp = Py_TYPE(self);
        std::destroy_at(&self->obj);
        tp->tp_free(self);
        Py_DECREF(tp);
    }

    static PyObject* WiFiDirectConnectionRequest_Close(py::wrapper::Windows::Devices::WiFiDirect::WiFiDirectConnectionRequest* self, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_Size(args);

        if (arg_count == 0)
        {
            if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Devices.WiFiDirect.WiFiDirectConnectionRequest", L"Close", 0))
            {
                py::set_arg_count_version_error(0);
                return nullptr;
            }

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

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

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

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

    static PyObject* _from_WiFiDirectConnectionRequest(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::Devices::WiFiDirect::WiFiDirectConnectionRequest>());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* _enter_WiFiDirectConnectionRequest(py::wrapper::Windows::Devices::WiFiDirect::WiFiDirectConnectionRequest* self, PyObject* /*unused*/) noexcept
    {
        return Py_NewRef(self);
    }

    static PyObject* _exit_WiFiDirectConnectionRequest(py::wrapper::Windows::Devices::WiFiDirect::WiFiDirectConnectionRequest* self, PyObject* /*unused*/) noexcept
    {
        try
        {
            self->obj.Close();
            Py_RETURN_FALSE;
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyMethodDef _methods_WiFiDirectConnectionRequest[] = {
        { "close", reinterpret_cast<PyCFunction>(WiFiDirectConnectionRequest_Close), METH_VARARGS, nullptr },
        { "_assign_array_", _assign_array_WiFiDirectConnectionRequest, METH_O | METH_STATIC, nullptr },
        { "_from", reinterpret_cast<PyCFunction>(_from_WiFiDirectConnectionRequest), METH_O | METH_STATIC, nullptr },
        { "__enter__", reinterpret_cast<PyCFunction>(_enter_WiFiDirectConnectionRequest), METH_NOARGS, nullptr },
        { "__exit__",  reinterpret_cast<PyCFunction>(_exit_WiFiDirectConnectionRequest), METH_VARARGS, nullptr },
        { }
    };

    static PyGetSetDef _getset_WiFiDirectConnectionRequest[] = {
        { "device_information", reinterpret_cast<getter>(WiFiDirectConnectionRequest_get_DeviceInformation), nullptr, nullptr, nullptr },
        { }
    };

    static PyType_Slot _type_slots_WiFiDirectConnectionRequest[] = 
    {
        { Py_tp_new, reinterpret_cast<void*>(_new_WiFiDirectConnectionRequest) },
        { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_WiFiDirectConnectionRequest) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_WiFiDirectConnectionRequest) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_WiFiDirectConnectionRequest) },
        { },
    };

    static PyType_Spec type_spec_WiFiDirectConnectionRequest =
    {
        "winrt._winrt_windows_devices_wifidirect.WiFiDirectConnectionRequest",
        sizeof(py::wrapper::Windows::Devices::WiFiDirect::WiFiDirectConnectionRequest),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_WiFiDirectConnectionRequest
    };

    // ----- WiFiDirectConnectionRequestedEventArgs class --------------------

    static PyObject* _new_WiFiDirectConnectionRequestedEventArgs(PyTypeObject* /*unused*/, PyObject* /*unused*/, PyObject* /*unused*/) noexcept
    {
        static_assert(py::py_type<winrt::Windows::Devices::WiFiDirect::WiFiDirectConnectionRequestedEventArgs>::type_name);
        py::set_invalid_activation_error(py::py_type<winrt::Windows::Devices::WiFiDirect::WiFiDirectConnectionRequestedEventArgs>::type_name);
        return nullptr;
    }

    static void _dealloc_WiFiDirectConnectionRequestedEventArgs(py::wrapper::Windows::Devices::WiFiDirect::WiFiDirectConnectionRequestedEventArgs* self) noexcept
    {
        auto tp = Py_TYPE(self);
        std::destroy_at(&self->obj);
        tp->tp_free(self);
        Py_DECREF(tp);
    }

    static PyObject* WiFiDirectConnectionRequestedEventArgs_GetConnectionRequest(py::wrapper::Windows::Devices::WiFiDirect::WiFiDirectConnectionRequestedEventArgs* self, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_Size(args);

        if (arg_count == 0)
        {
            if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Devices.WiFiDirect.WiFiDirectConnectionRequestedEventArgs", L"GetConnectionRequest", 0))
            {
                py::set_arg_count_version_error(0);
                return nullptr;
            }

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

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

    static PyObject* _from_WiFiDirectConnectionRequestedEventArgs(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::Devices::WiFiDirect::WiFiDirectConnectionRequestedEventArgs>());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyMethodDef _methods_WiFiDirectConnectionRequestedEventArgs[] = {
        { "get_connection_request", reinterpret_cast<PyCFunction>(WiFiDirectConnectionRequestedEventArgs_GetConnectionRequest), METH_VARARGS, nullptr },
        { "_assign_array_", _assign_array_WiFiDirectConnectionRequestedEventArgs, METH_O | METH_STATIC, nullptr },
        { "_from", reinterpret_cast<PyCFunction>(_from_WiFiDirectConnectionRequestedEventArgs), METH_O | METH_STATIC, nullptr },
        { }
    };

    static PyGetSetDef _getset_WiFiDirectConnectionRequestedEventArgs[] = {
        { }
    };

    static PyType_Slot _type_slots_WiFiDirectConnectionRequestedEventArgs[] = 
    {
        { Py_tp_new, reinterpret_cast<void*>(_new_WiFiDirectConnectionRequestedEventArgs) },
        { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_WiFiDirectConnectionRequestedEventArgs) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_WiFiDirectConnectionRequestedEventArgs) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_WiFiDirectConnectionRequestedEventArgs) },
        { },
    };

    static PyType_Spec type_spec_WiFiDirectConnectionRequestedEventArgs =
    {
        "winrt._winrt_windows_devices_wifidirect.WiFiDirectConnectionRequestedEventArgs",
        sizeof(py::wrapper::Windows::Devices::WiFiDirect::WiFiDirectConnectionRequestedEventArgs),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_WiFiDirectConnectionRequestedEventArgs
    };

    // ----- WiFiDirectDevice class --------------------

    static PyObject* _new_WiFiDirectDevice(PyTypeObject* /*unused*/, PyObject* /*unused*/, PyObject* /*unused*/) noexcept
    {
        static_assert(py::py_type<winrt::Windows::Devices::WiFiDirect::WiFiDirectDevice>::type_name);
        py::set_invalid_activation_error(py::py_type<winrt::Windows::Devices::WiFiDirect::WiFiDirectDevice>::type_name);
        return nullptr;
    }

    static void _dealloc_WiFiDirectDevice(py::wrapper::Windows::Devices::WiFiDirect::WiFiDirectDevice* self) noexcept
    {
        auto tp = Py_TYPE(self);
        std::destroy_at(&self->obj);
        tp->tp_free(self);
        Py_DECREF(tp);
    }

    static PyObject* WiFiDirectDevice_Close(py::wrapper::Windows::Devices::WiFiDirect::WiFiDirectDevice* self, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_Size(args);

        if (arg_count == 0)
        {
            if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Devices.WiFiDirect.WiFiDirectDevice", L"Close", 0))
            {
                py::set_arg_count_version_error(0);
                return nullptr;
            }

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

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

        if (arg_count == 1)
        {
            if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Devices.WiFiDirect.WiFiDirectDevice", L"FromIdAsync", 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::Devices::WiFiDirect::WiFiDirectDevice::FromIdAsync(param0));
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else if (arg_count == 2)
        {
            if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Devices.WiFiDirect.WiFiDirectDevice", L"FromIdAsync", 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::Devices::WiFiDirect::WiFiDirectConnectionParameters>(args, 1);

                return py::convert(winrt::Windows::Devices::WiFiDirect::WiFiDirectDevice::FromIdAsync(param0, param1));
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* WiFiDirectDevice_GetConnectionEndpointPairs(py::wrapper::Windows::Devices::WiFiDirect::WiFiDirectDevice* self, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_Size(args);

        if (arg_count == 0)
        {
            if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Devices.WiFiDirect.WiFiDirectDevice", L"GetConnectionEndpointPairs", 0))
            {
                py::set_arg_count_version_error(0);
                return nullptr;
            }

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

    static PyObject* WiFiDirectDevice_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.Devices.WiFiDirect.WiFiDirectDevice", L"GetDeviceSelector", 0))
            {
                py::set_arg_count_version_error(0);
                return nullptr;
            }

            try
            {
                return py::convert(winrt::Windows::Devices::WiFiDirect::WiFiDirectDevice::GetDeviceSelector());
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else if (arg_count == 1)
        {
            if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Devices.WiFiDirect.WiFiDirectDevice", L"GetDeviceSelector", 1))
            {
                py::set_arg_count_version_error(1);
                return nullptr;
            }

            try
            {
                auto param0 = py::convert_to<winrt::Windows::Devices::WiFiDirect::WiFiDirectDeviceSelectorType>(args, 0);

                return py::convert(winrt::Windows::Devices::WiFiDirect::WiFiDirectDevice::GetDeviceSelector(param0));
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

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

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

    static PyObject* WiFiDirectDevice_get_DeviceId(py::wrapper::Windows::Devices::WiFiDirect::WiFiDirectDevice* self, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Devices.WiFiDirect.WiFiDirectDevice", 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* WiFiDirectDevice_add_ConnectionStatusChanged(py::wrapper::Windows::Devices::WiFiDirect::WiFiDirectDevice* self, PyObject* arg) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsEventPresent(L"Windows.Devices.WiFiDirect.WiFiDirectDevice", L"ConnectionStatusChanged"))
        {
            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::Devices::WiFiDirect::WiFiDirectDevice, winrt::Windows::Foundation::IInspectable>>(arg);

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

    static PyObject* WiFiDirectDevice_remove_ConnectionStatusChanged(py::wrapper::Windows::Devices::WiFiDirect::WiFiDirectDevice* self, PyObject* arg) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsEventPresent(L"Windows.Devices.WiFiDirect.WiFiDirectDevice", L"ConnectionStatusChanged"))
        {
            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.ConnectionStatusChanged(param0);
            Py_RETURN_NONE;
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

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

    static PyObject* _from_WiFiDirectDevice(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::Devices::WiFiDirect::WiFiDirectDevice>());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* _enter_WiFiDirectDevice(py::wrapper::Windows::Devices::WiFiDirect::WiFiDirectDevice* self, PyObject* /*unused*/) noexcept
    {
        return Py_NewRef(self);
    }

    static PyObject* _exit_WiFiDirectDevice(py::wrapper::Windows::Devices::WiFiDirect::WiFiDirectDevice* self, PyObject* /*unused*/) noexcept
    {
        try
        {
            self->obj.Close();
            Py_RETURN_FALSE;
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyMethodDef _methods_WiFiDirectDevice[] = {
        { "close", reinterpret_cast<PyCFunction>(WiFiDirectDevice_Close), METH_VARARGS, nullptr },
        { "get_connection_endpoint_pairs", reinterpret_cast<PyCFunction>(WiFiDirectDevice_GetConnectionEndpointPairs), METH_VARARGS, nullptr },
        { "add_connection_status_changed", reinterpret_cast<PyCFunction>(WiFiDirectDevice_add_ConnectionStatusChanged), METH_O, nullptr },
        { "remove_connection_status_changed", reinterpret_cast<PyCFunction>(WiFiDirectDevice_remove_ConnectionStatusChanged), METH_O, nullptr },
        { "_assign_array_", _assign_array_WiFiDirectDevice, METH_O | METH_STATIC, nullptr },
        { "_from", reinterpret_cast<PyCFunction>(_from_WiFiDirectDevice), METH_O | METH_STATIC, nullptr },
        { "__enter__", reinterpret_cast<PyCFunction>(_enter_WiFiDirectDevice), METH_NOARGS, nullptr },
        { "__exit__",  reinterpret_cast<PyCFunction>(_exit_WiFiDirectDevice), METH_VARARGS, nullptr },
        { }
    };

    static PyGetSetDef _getset_WiFiDirectDevice[] = {
        { "connection_status", reinterpret_cast<getter>(WiFiDirectDevice_get_ConnectionStatus), nullptr, nullptr, nullptr },
        { "device_id", reinterpret_cast<getter>(WiFiDirectDevice_get_DeviceId), nullptr, nullptr, nullptr },
        { }
    };

    static PyType_Slot _type_slots_WiFiDirectDevice[] = 
    {
        { Py_tp_new, reinterpret_cast<void*>(_new_WiFiDirectDevice) },
        { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_WiFiDirectDevice) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_WiFiDirectDevice) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_WiFiDirectDevice) },
        { },
    };

    static PyType_Spec type_spec_WiFiDirectDevice =
    {
        "winrt._winrt_windows_devices_wifidirect.WiFiDirectDevice",
        sizeof(py::wrapper::Windows::Devices::WiFiDirect::WiFiDirectDevice),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_WiFiDirectDevice
    };

    static PyGetSetDef getset_WiFiDirectDevice_Static[] = {
        { }
    };

    static PyMethodDef methods_WiFiDirectDevice_Static[] = {
        { "from_id_async", reinterpret_cast<PyCFunction>(WiFiDirectDevice_FromIdAsync), METH_VARARGS, nullptr },
        { "get_device_selector", reinterpret_cast<PyCFunction>(WiFiDirectDevice_GetDeviceSelector), METH_VARARGS, nullptr },
        { }
    };

    static PyType_Slot type_slots_WiFiDirectDevice_Static[] = 
    {
        { Py_tp_base, reinterpret_cast<void*>(&PyType_Type) },
        { Py_tp_getset, reinterpret_cast<void*>(getset_WiFiDirectDevice_Static) },
        { Py_tp_methods, reinterpret_cast<void*>(methods_WiFiDirectDevice_Static) },
        { }
    };

    static PyType_Spec type_spec_WiFiDirectDevice_Static =
    {
        "winrt._winrt_windows_devices_wifidirect.WiFiDirectDevice_Static",
        static_cast<int>(PyType_Type.tp_basicsize),
        static_cast<int>(PyType_Type.tp_itemsize),
        Py_TPFLAGS_DEFAULT,
        type_slots_WiFiDirectDevice_Static
    };

    // ----- WiFiDirectInformationElement class --------------------

    static PyObject* _new_WiFiDirectInformationElement(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::Devices::WiFiDirect::WiFiDirectInformationElement 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_WiFiDirectInformationElement(py::wrapper::Windows::Devices::WiFiDirect::WiFiDirectInformationElement* self) noexcept
    {
        auto tp = Py_TYPE(self);
        std::destroy_at(&self->obj);
        tp->tp_free(self);
        Py_DECREF(tp);
    }

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

        if (arg_count == 1)
        {
            if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Devices.WiFiDirect.WiFiDirectInformationElement", L"CreateFromBuffer", 1))
            {
                py::set_arg_count_version_error(1);
                return nullptr;
            }

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

                return py::convert(winrt::Windows::Devices::WiFiDirect::WiFiDirectInformationElement::CreateFromBuffer(param0));
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

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

        if (arg_count == 1)
        {
            if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Devices.WiFiDirect.WiFiDirectInformationElement", L"CreateFromDeviceInformation", 1))
            {
                py::set_arg_count_version_error(1);
                return nullptr;
            }

            try
            {
                auto param0 = py::convert_to<winrt::Windows::Devices::Enumeration::DeviceInformation>(args, 0);

                return py::convert(winrt::Windows::Devices::WiFiDirect::WiFiDirectInformationElement::CreateFromDeviceInformation(param0));
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

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

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

    static int WiFiDirectInformationElement_put_Value(py::wrapper::Windows::Devices::WiFiDirect::WiFiDirectInformationElement* self, PyObject* arg, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Devices.WiFiDirect.WiFiDirectInformationElement", L"Value"))
        {
            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);

            self->obj.Value(param0);
            return 0;
        }
        catch (...)
        {
            py::to_PyErr();
            return -1;
        }
    }

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

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

    static int WiFiDirectInformationElement_put_OuiType(py::wrapper::Windows::Devices::WiFiDirect::WiFiDirectInformationElement* self, PyObject* arg, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Devices.WiFiDirect.WiFiDirectInformationElement", L"OuiType"))
        {
            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<uint8_t>(arg);

            self->obj.OuiType(param0);
            return 0;
        }
        catch (...)
        {
            py::to_PyErr();
            return -1;
        }
    }

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

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

    static int WiFiDirectInformationElement_put_Oui(py::wrapper::Windows::Devices::WiFiDirect::WiFiDirectInformationElement* self, PyObject* arg, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Devices.WiFiDirect.WiFiDirectInformationElement", L"Oui"))
        {
            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);

            self->obj.Oui(param0);
            return 0;
        }
        catch (...)
        {
            py::to_PyErr();
            return -1;
        }
    }

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

    static PyObject* _from_WiFiDirectInformationElement(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::Devices::WiFiDirect::WiFiDirectInformationElement>());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyMethodDef _methods_WiFiDirectInformationElement[] = {
        { "_assign_array_", _assign_array_WiFiDirectInformationElement, METH_O | METH_STATIC, nullptr },
        { "_from", reinterpret_cast<PyCFunction>(_from_WiFiDirectInformationElement), METH_O | METH_STATIC, nullptr },
        { }
    };

    static PyGetSetDef _getset_WiFiDirectInformationElement[] = {
        { "value", reinterpret_cast<getter>(WiFiDirectInformationElement_get_Value), reinterpret_cast<setter>(WiFiDirectInformationElement_put_Value), nullptr, nullptr },
        { "oui_type", reinterpret_cast<getter>(WiFiDirectInformationElement_get_OuiType), reinterpret_cast<setter>(WiFiDirectInformationElement_put_OuiType), nullptr, nullptr },
        { "oui", reinterpret_cast<getter>(WiFiDirectInformationElement_get_Oui), reinterpret_cast<setter>(WiFiDirectInformationElement_put_Oui), nullptr, nullptr },
        { }
    };

    static PyType_Slot _type_slots_WiFiDirectInformationElement[] = 
    {
        { Py_tp_new, reinterpret_cast<void*>(_new_WiFiDirectInformationElement) },
        { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_WiFiDirectInformationElement) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_WiFiDirectInformationElement) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_WiFiDirectInformationElement) },
        { },
    };

    static PyType_Spec type_spec_WiFiDirectInformationElement =
    {
        "winrt._winrt_windows_devices_wifidirect.WiFiDirectInformationElement",
        sizeof(py::wrapper::Windows::Devices::WiFiDirect::WiFiDirectInformationElement),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_WiFiDirectInformationElement
    };

    static PyGetSetDef getset_WiFiDirectInformationElement_Static[] = {
        { }
    };

    static PyMethodDef methods_WiFiDirectInformationElement_Static[] = {
        { "create_from_buffer", reinterpret_cast<PyCFunction>(WiFiDirectInformationElement_CreateFromBuffer), METH_VARARGS, nullptr },
        { "create_from_device_information", reinterpret_cast<PyCFunction>(WiFiDirectInformationElement_CreateFromDeviceInformation), METH_VARARGS, nullptr },
        { }
    };

    static PyType_Slot type_slots_WiFiDirectInformationElement_Static[] = 
    {
        { Py_tp_base, reinterpret_cast<void*>(&PyType_Type) },
        { Py_tp_getset, reinterpret_cast<void*>(getset_WiFiDirectInformationElement_Static) },
        { Py_tp_methods, reinterpret_cast<void*>(methods_WiFiDirectInformationElement_Static) },
        { }
    };

    static PyType_Spec type_spec_WiFiDirectInformationElement_Static =
    {
        "winrt._winrt_windows_devices_wifidirect.WiFiDirectInformationElement_Static",
        static_cast<int>(PyType_Type.tp_basicsize),
        static_cast<int>(PyType_Type.tp_itemsize),
        Py_TPFLAGS_DEFAULT,
        type_slots_WiFiDirectInformationElement_Static
    };

    // ----- WiFiDirectLegacySettings class --------------------

    static PyObject* _new_WiFiDirectLegacySettings(PyTypeObject* /*unused*/, PyObject* /*unused*/, PyObject* /*unused*/) noexcept
    {
        static_assert(py::py_type<winrt::Windows::Devices::WiFiDirect::WiFiDirectLegacySettings>::type_name);
        py::set_invalid_activation_error(py::py_type<winrt::Windows::Devices::WiFiDirect::WiFiDirectLegacySettings>::type_name);
        return nullptr;
    }

    static void _dealloc_WiFiDirectLegacySettings(py::wrapper::Windows::Devices::WiFiDirect::WiFiDirectLegacySettings* self) noexcept
    {
        auto tp = Py_TYPE(self);
        std::destroy_at(&self->obj);
        tp->tp_free(self);
        Py_DECREF(tp);
    }

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

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

    static int WiFiDirectLegacySettings_put_Ssid(py::wrapper::Windows::Devices::WiFiDirect::WiFiDirectLegacySettings* self, PyObject* arg, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Devices.WiFiDirect.WiFiDirectLegacySettings", L"Ssid"))
        {
            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);

            self->obj.Ssid(param0);
            return 0;
        }
        catch (...)
        {
            py::to_PyErr();
            return -1;
        }
    }

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

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

    static int WiFiDirectLegacySettings_put_Passphrase(py::wrapper::Windows::Devices::WiFiDirect::WiFiDirectLegacySettings* self, PyObject* arg, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Devices.WiFiDirect.WiFiDirectLegacySettings", L"Passphrase"))
        {
            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::Security::Credentials::PasswordCredential>(arg);

            self->obj.Passphrase(param0);
            return 0;
        }
        catch (...)
        {
            py::to_PyErr();
            return -1;
        }
    }

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

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

    static int WiFiDirectLegacySettings_put_IsEnabled(py::wrapper::Windows::Devices::WiFiDirect::WiFiDirectLegacySettings* self, PyObject* arg, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Devices.WiFiDirect.WiFiDirectLegacySettings", L"IsEnabled"))
        {
            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);

            self->obj.IsEnabled(param0);
            return 0;
        }
        catch (...)
        {
            py::to_PyErr();
            return -1;
        }
    }

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

    static PyObject* _from_WiFiDirectLegacySettings(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::Devices::WiFiDirect::WiFiDirectLegacySettings>());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyMethodDef _methods_WiFiDirectLegacySettings[] = {
        { "_assign_array_", _assign_array_WiFiDirectLegacySettings, METH_O | METH_STATIC, nullptr },
        { "_from", reinterpret_cast<PyCFunction>(_from_WiFiDirectLegacySettings), METH_O | METH_STATIC, nullptr },
        { }
    };

    static PyGetSetDef _getset_WiFiDirectLegacySettings[] = {
        { "ssid", reinterpret_cast<getter>(WiFiDirectLegacySettings_get_Ssid), reinterpret_cast<setter>(WiFiDirectLegacySettings_put_Ssid), nullptr, nullptr },
        { "passphrase", reinterpret_cast<getter>(WiFiDirectLegacySettings_get_Passphrase), reinterpret_cast<setter>(WiFiDirectLegacySettings_put_Passphrase), nullptr, nullptr },
        { "is_enabled", reinterpret_cast<getter>(WiFiDirectLegacySettings_get_IsEnabled), reinterpret_cast<setter>(WiFiDirectLegacySettings_put_IsEnabled), nullptr, nullptr },
        { }
    };

    static PyType_Slot _type_slots_WiFiDirectLegacySettings[] = 
    {
        { Py_tp_new, reinterpret_cast<void*>(_new_WiFiDirectLegacySettings) },
        { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_WiFiDirectLegacySettings) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_WiFiDirectLegacySettings) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_WiFiDirectLegacySettings) },
        { },
    };

    static PyType_Spec type_spec_WiFiDirectLegacySettings =
    {
        "winrt._winrt_windows_devices_wifidirect.WiFiDirectLegacySettings",
        sizeof(py::wrapper::Windows::Devices::WiFiDirect::WiFiDirectLegacySettings),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_WiFiDirectLegacySettings
    };

    // ----- Windows.Devices.WiFiDirect Initialization --------------------
    PyDoc_STRVAR(module_doc, "Windows::Devices::WiFiDirect");


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

} // py::cpp::Windows::Devices::WiFiDirect

PyMODINIT_FUNC PyInit__winrt_windows_devices_wifidirect(void) noexcept
{
    using namespace py::cpp::Windows::Devices::WiFiDirect;

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

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

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

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

    py::pyobj_handle type_WiFiDirectConnectionParameters_Static{PyType_FromSpec(&type_spec_WiFiDirectConnectionParameters_Static)};
    if (!type_WiFiDirectConnectionParameters_Static)
    {
        return nullptr;
    }

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

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

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

    py::pyobj_handle type_WiFiDirectDevice_Static{PyType_FromSpec(&type_spec_WiFiDirectDevice_Static)};
    if (!type_WiFiDirectDevice_Static)
    {
        return nullptr;
    }

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

    py::pyobj_handle type_WiFiDirectInformationElement_Static{PyType_FromSpec(&type_spec_WiFiDirectInformationElement_Static)};
    if (!type_WiFiDirectInformationElement_Static)
    {
        return nullptr;
    }

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

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


    return module.detach();
}
