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

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


namespace py::cpp::Windows::Devices::WiFiDirect::Services
{
    // ----- WiFiDirectService class --------------------

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

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

    static PyObject* WiFiDirectService_ConnectAsync(py::wrapper::Windows::Devices::WiFiDirect::Services::WiFiDirectService* 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.Services.WiFiDirectService", L"ConnectAsync", 0))
            {
                py::set_arg_count_version_error(0);
                return nullptr;
            }

            try
            {
                return py::convert(self->obj.ConnectAsync());
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else if (arg_count == 1)
        {
            if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Devices.WiFiDirect.Services.WiFiDirectService", L"ConnectAsync", 1))
            {
                py::set_arg_count_version_error(1);
                return nullptr;
            }

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

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

    static PyObject* WiFiDirectService_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.Services.WiFiDirectService", 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::Services::WiFiDirectService::FromIdAsync(param0));
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

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

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

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

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

    static PyObject* WiFiDirectService_GetSelector(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.Services.WiFiDirectService", L"GetSelector", 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::Services::WiFiDirectService::GetSelector(param0));
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else if (arg_count == 2)
        {
            if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Devices.WiFiDirect.Services.WiFiDirectService", L"GetSelector", 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(winrt::Windows::Devices::WiFiDirect::Services::WiFiDirectService::GetSelector(param0, param1));
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

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

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

    static int WiFiDirectService_put_SessionInfo(py::wrapper::Windows::Devices::WiFiDirect::Services::WiFiDirectService* self, PyObject* arg, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Devices.WiFiDirect.Services.WiFiDirectService", L"SessionInfo"))
        {
            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.SessionInfo(param0);
            return 0;
        }
        catch (...)
        {
            py::to_PyErr();
            return -1;
        }
    }

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

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

    static int WiFiDirectService_put_PreferGroupOwnerMode(py::wrapper::Windows::Devices::WiFiDirect::Services::WiFiDirectService* self, PyObject* arg, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Devices.WiFiDirect.Services.WiFiDirectService", L"PreferGroupOwnerMode"))
        {
            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.PreferGroupOwnerMode(param0);
            return 0;
        }
        catch (...)
        {
            py::to_PyErr();
            return -1;
        }
    }

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

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

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

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

    static PyObject* WiFiDirectService_get_SupportedConfigurationMethods(py::wrapper::Windows::Devices::WiFiDirect::Services::WiFiDirectService* self, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Devices.WiFiDirect.Services.WiFiDirectService", 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* WiFiDirectService_add_SessionDeferred(py::wrapper::Windows::Devices::WiFiDirect::Services::WiFiDirectService* self, PyObject* arg) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsEventPresent(L"Windows.Devices.WiFiDirect.Services.WiFiDirectService", L"SessionDeferred"))
        {
            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::Services::WiFiDirectService, winrt::Windows::Devices::WiFiDirect::Services::WiFiDirectServiceSessionDeferredEventArgs>>(arg);

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

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

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

    static PyObject* _from_WiFiDirectService(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::Services::WiFiDirectService>());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyMethodDef _methods_WiFiDirectService[] = {
        { "connect_async", reinterpret_cast<PyCFunction>(WiFiDirectService_ConnectAsync), METH_VARARGS, nullptr },
        { "get_provisioning_info_async", reinterpret_cast<PyCFunction>(WiFiDirectService_GetProvisioningInfoAsync), METH_VARARGS, nullptr },
        { "add_session_deferred", reinterpret_cast<PyCFunction>(WiFiDirectService_add_SessionDeferred), METH_O, nullptr },
        { "remove_session_deferred", reinterpret_cast<PyCFunction>(WiFiDirectService_remove_SessionDeferred), METH_O, nullptr },
        { "_assign_array_", _assign_array_WiFiDirectService, METH_O | METH_STATIC, nullptr },
        { "_from", reinterpret_cast<PyCFunction>(_from_WiFiDirectService), METH_O | METH_STATIC, nullptr },
        { }
    };

    static PyGetSetDef _getset_WiFiDirectService[] = {
        { "session_info", reinterpret_cast<getter>(WiFiDirectService_get_SessionInfo), reinterpret_cast<setter>(WiFiDirectService_put_SessionInfo), nullptr, nullptr },
        { "prefer_group_owner_mode", reinterpret_cast<getter>(WiFiDirectService_get_PreferGroupOwnerMode), reinterpret_cast<setter>(WiFiDirectService_put_PreferGroupOwnerMode), nullptr, nullptr },
        { "remote_service_info", reinterpret_cast<getter>(WiFiDirectService_get_RemoteServiceInfo), nullptr, nullptr, nullptr },
        { "service_error", reinterpret_cast<getter>(WiFiDirectService_get_ServiceError), nullptr, nullptr, nullptr },
        { "supported_configuration_methods", reinterpret_cast<getter>(WiFiDirectService_get_SupportedConfigurationMethods), nullptr, nullptr, nullptr },
        { }
    };

    static PyType_Slot _type_slots_WiFiDirectService[] = 
    {
        { Py_tp_new, reinterpret_cast<void*>(_new_WiFiDirectService) },
        { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_WiFiDirectService) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_WiFiDirectService) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_WiFiDirectService) },
        { },
    };

    static PyType_Spec type_spec_WiFiDirectService =
    {
        "winrt._winrt_windows_devices_wifidirect_services.WiFiDirectService",
        sizeof(py::wrapper::Windows::Devices::WiFiDirect::Services::WiFiDirectService),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_WiFiDirectService
    };

    static PyGetSetDef getset_WiFiDirectService_Static[] = {
        { }
    };

    static PyMethodDef methods_WiFiDirectService_Static[] = {
        { "from_id_async", reinterpret_cast<PyCFunction>(WiFiDirectService_FromIdAsync), METH_VARARGS, nullptr },
        { "get_selector", reinterpret_cast<PyCFunction>(WiFiDirectService_GetSelector), METH_VARARGS, nullptr },
        { }
    };

    static PyType_Slot type_slots_WiFiDirectService_Static[] = 
    {
        { Py_tp_base, reinterpret_cast<void*>(&PyType_Type) },
        { Py_tp_getset, reinterpret_cast<void*>(getset_WiFiDirectService_Static) },
        { Py_tp_methods, reinterpret_cast<void*>(methods_WiFiDirectService_Static) },
        { }
    };

    static PyType_Spec type_spec_WiFiDirectService_Static =
    {
        "winrt._winrt_windows_devices_wifidirect_services.WiFiDirectService_Static",
        static_cast<int>(PyType_Type.tp_basicsize),
        static_cast<int>(PyType_Type.tp_itemsize),
        Py_TPFLAGS_DEFAULT,
        type_slots_WiFiDirectService_Static
    };

    // ----- WiFiDirectServiceAdvertiser class --------------------

    static PyObject* _new_WiFiDirectServiceAdvertiser(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 == 1)
        {
            try
            {
                auto param0 = py::convert_to<winrt::hstring>(args, 0);

                winrt::Windows::Devices::WiFiDirect::Services::WiFiDirectServiceAdvertiser instance{ param0 };
                return py::wrap(instance, type);
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

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

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

        if (arg_count == 1)
        {
            if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Devices.WiFiDirect.Services.WiFiDirectServiceAdvertiser", L"ConnectAsync", 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(self->obj.ConnectAsync(param0));
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else if (arg_count == 2)
        {
            if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Devices.WiFiDirect.Services.WiFiDirectServiceAdvertiser", L"ConnectAsync", 2))
            {
                py::set_arg_count_version_error(2);
                return nullptr;
            }

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

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

    static PyObject* WiFiDirectServiceAdvertiser_Start(py::wrapper::Windows::Devices::WiFiDirect::Services::WiFiDirectServiceAdvertiser* 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.Services.WiFiDirectServiceAdvertiser", 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* WiFiDirectServiceAdvertiser_Stop(py::wrapper::Windows::Devices::WiFiDirect::Services::WiFiDirectServiceAdvertiser* 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.Services.WiFiDirectServiceAdvertiser", 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* WiFiDirectServiceAdvertiser_get_ServiceStatus(py::wrapper::Windows::Devices::WiFiDirect::Services::WiFiDirectServiceAdvertiser* self, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Devices.WiFiDirect.Services.WiFiDirectServiceAdvertiser", L"ServiceStatus"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return nullptr;
        }

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

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

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

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

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

    static int WiFiDirectServiceAdvertiser_put_ServiceInfo(py::wrapper::Windows::Devices::WiFiDirect::Services::WiFiDirectServiceAdvertiser* self, PyObject* arg, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Devices.WiFiDirect.Services.WiFiDirectServiceAdvertiser", L"ServiceInfo"))
        {
            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.ServiceInfo(param0);
            return 0;
        }
        catch (...)
        {
            py::to_PyErr();
            return -1;
        }
    }

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

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

    static int WiFiDirectServiceAdvertiser_put_PreferGroupOwnerMode(py::wrapper::Windows::Devices::WiFiDirect::Services::WiFiDirectServiceAdvertiser* self, PyObject* arg, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Devices.WiFiDirect.Services.WiFiDirectServiceAdvertiser", L"PreferGroupOwnerMode"))
        {
            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.PreferGroupOwnerMode(param0);
            return 0;
        }
        catch (...)
        {
            py::to_PyErr();
            return -1;
        }
    }

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

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

    static int WiFiDirectServiceAdvertiser_put_DeferredSessionInfo(py::wrapper::Windows::Devices::WiFiDirect::Services::WiFiDirectServiceAdvertiser* self, PyObject* arg, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Devices.WiFiDirect.Services.WiFiDirectServiceAdvertiser", L"DeferredSessionInfo"))
        {
            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.DeferredSessionInfo(param0);
            return 0;
        }
        catch (...)
        {
            py::to_PyErr();
            return -1;
        }
    }

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

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

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

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

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

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

    static int WiFiDirectServiceAdvertiser_put_AutoAcceptSession(py::wrapper::Windows::Devices::WiFiDirect::Services::WiFiDirectServiceAdvertiser* self, PyObject* arg, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Devices.WiFiDirect.Services.WiFiDirectServiceAdvertiser", L"AutoAcceptSession"))
        {
            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.AutoAcceptSession(param0);
            return 0;
        }
        catch (...)
        {
            py::to_PyErr();
            return -1;
        }
    }

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

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

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

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

    static PyObject* WiFiDirectServiceAdvertiser_get_ServiceName(py::wrapper::Windows::Devices::WiFiDirect::Services::WiFiDirectServiceAdvertiser* self, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Devices.WiFiDirect.Services.WiFiDirectServiceAdvertiser", 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* WiFiDirectServiceAdvertiser_get_ServiceNamePrefixes(py::wrapper::Windows::Devices::WiFiDirect::Services::WiFiDirectServiceAdvertiser* self, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Devices.WiFiDirect.Services.WiFiDirectServiceAdvertiser", L"ServiceNamePrefixes"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return nullptr;
        }

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

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

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

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

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

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

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

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

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

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

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

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

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

    static PyObject* _from_WiFiDirectServiceAdvertiser(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::Services::WiFiDirectServiceAdvertiser>());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyMethodDef _methods_WiFiDirectServiceAdvertiser[] = {
        { "connect_async", reinterpret_cast<PyCFunction>(WiFiDirectServiceAdvertiser_ConnectAsync), METH_VARARGS, nullptr },
        { "start", reinterpret_cast<PyCFunction>(WiFiDirectServiceAdvertiser_Start), METH_VARARGS, nullptr },
        { "stop", reinterpret_cast<PyCFunction>(WiFiDirectServiceAdvertiser_Stop), METH_VARARGS, nullptr },
        { "add_advertisement_status_changed", reinterpret_cast<PyCFunction>(WiFiDirectServiceAdvertiser_add_AdvertisementStatusChanged), METH_O, nullptr },
        { "remove_advertisement_status_changed", reinterpret_cast<PyCFunction>(WiFiDirectServiceAdvertiser_remove_AdvertisementStatusChanged), METH_O, nullptr },
        { "add_auto_accept_session_connected", reinterpret_cast<PyCFunction>(WiFiDirectServiceAdvertiser_add_AutoAcceptSessionConnected), METH_O, nullptr },
        { "remove_auto_accept_session_connected", reinterpret_cast<PyCFunction>(WiFiDirectServiceAdvertiser_remove_AutoAcceptSessionConnected), METH_O, nullptr },
        { "add_session_requested", reinterpret_cast<PyCFunction>(WiFiDirectServiceAdvertiser_add_SessionRequested), METH_O, nullptr },
        { "remove_session_requested", reinterpret_cast<PyCFunction>(WiFiDirectServiceAdvertiser_remove_SessionRequested), METH_O, nullptr },
        { "_assign_array_", _assign_array_WiFiDirectServiceAdvertiser, METH_O | METH_STATIC, nullptr },
        { "_from", reinterpret_cast<PyCFunction>(_from_WiFiDirectServiceAdvertiser), METH_O | METH_STATIC, nullptr },
        { }
    };

    static PyGetSetDef _getset_WiFiDirectServiceAdvertiser[] = {
        { "service_status", reinterpret_cast<getter>(WiFiDirectServiceAdvertiser_get_ServiceStatus), reinterpret_cast<setter>(WiFiDirectServiceAdvertiser_put_ServiceStatus), nullptr, nullptr },
        { "service_info", reinterpret_cast<getter>(WiFiDirectServiceAdvertiser_get_ServiceInfo), reinterpret_cast<setter>(WiFiDirectServiceAdvertiser_put_ServiceInfo), nullptr, nullptr },
        { "prefer_group_owner_mode", reinterpret_cast<getter>(WiFiDirectServiceAdvertiser_get_PreferGroupOwnerMode), reinterpret_cast<setter>(WiFiDirectServiceAdvertiser_put_PreferGroupOwnerMode), nullptr, nullptr },
        { "deferred_session_info", reinterpret_cast<getter>(WiFiDirectServiceAdvertiser_get_DeferredSessionInfo), reinterpret_cast<setter>(WiFiDirectServiceAdvertiser_put_DeferredSessionInfo), nullptr, nullptr },
        { "custom_service_status_code", reinterpret_cast<getter>(WiFiDirectServiceAdvertiser_get_CustomServiceStatusCode), reinterpret_cast<setter>(WiFiDirectServiceAdvertiser_put_CustomServiceStatusCode), nullptr, nullptr },
        { "auto_accept_session", reinterpret_cast<getter>(WiFiDirectServiceAdvertiser_get_AutoAcceptSession), reinterpret_cast<setter>(WiFiDirectServiceAdvertiser_put_AutoAcceptSession), nullptr, nullptr },
        { "service_error", reinterpret_cast<getter>(WiFiDirectServiceAdvertiser_get_ServiceError), nullptr, nullptr, nullptr },
        { "preferred_configuration_methods", reinterpret_cast<getter>(WiFiDirectServiceAdvertiser_get_PreferredConfigurationMethods), nullptr, nullptr, nullptr },
        { "service_name", reinterpret_cast<getter>(WiFiDirectServiceAdvertiser_get_ServiceName), nullptr, nullptr, nullptr },
        { "service_name_prefixes", reinterpret_cast<getter>(WiFiDirectServiceAdvertiser_get_ServiceNamePrefixes), nullptr, nullptr, nullptr },
        { "advertisement_status", reinterpret_cast<getter>(WiFiDirectServiceAdvertiser_get_AdvertisementStatus), nullptr, nullptr, nullptr },
        { }
    };

    static PyType_Slot _type_slots_WiFiDirectServiceAdvertiser[] = 
    {
        { Py_tp_new, reinterpret_cast<void*>(_new_WiFiDirectServiceAdvertiser) },
        { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_WiFiDirectServiceAdvertiser) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_WiFiDirectServiceAdvertiser) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_WiFiDirectServiceAdvertiser) },
        { },
    };

    static PyType_Spec type_spec_WiFiDirectServiceAdvertiser =
    {
        "winrt._winrt_windows_devices_wifidirect_services.WiFiDirectServiceAdvertiser",
        sizeof(py::wrapper::Windows::Devices::WiFiDirect::Services::WiFiDirectServiceAdvertiser),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_WiFiDirectServiceAdvertiser
    };

    // ----- WiFiDirectServiceAutoAcceptSessionConnectedEventArgs class --------------------

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

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

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

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

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

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

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

    static PyObject* _from_WiFiDirectServiceAutoAcceptSessionConnectedEventArgs(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::Services::WiFiDirectServiceAutoAcceptSessionConnectedEventArgs>());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyMethodDef _methods_WiFiDirectServiceAutoAcceptSessionConnectedEventArgs[] = {
        { "_assign_array_", _assign_array_WiFiDirectServiceAutoAcceptSessionConnectedEventArgs, METH_O | METH_STATIC, nullptr },
        { "_from", reinterpret_cast<PyCFunction>(_from_WiFiDirectServiceAutoAcceptSessionConnectedEventArgs), METH_O | METH_STATIC, nullptr },
        { }
    };

    static PyGetSetDef _getset_WiFiDirectServiceAutoAcceptSessionConnectedEventArgs[] = {
        { "session", reinterpret_cast<getter>(WiFiDirectServiceAutoAcceptSessionConnectedEventArgs_get_Session), nullptr, nullptr, nullptr },
        { "session_info", reinterpret_cast<getter>(WiFiDirectServiceAutoAcceptSessionConnectedEventArgs_get_SessionInfo), nullptr, nullptr, nullptr },
        { }
    };

    static PyType_Slot _type_slots_WiFiDirectServiceAutoAcceptSessionConnectedEventArgs[] = 
    {
        { Py_tp_new, reinterpret_cast<void*>(_new_WiFiDirectServiceAutoAcceptSessionConnectedEventArgs) },
        { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_WiFiDirectServiceAutoAcceptSessionConnectedEventArgs) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_WiFiDirectServiceAutoAcceptSessionConnectedEventArgs) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_WiFiDirectServiceAutoAcceptSessionConnectedEventArgs) },
        { },
    };

    static PyType_Spec type_spec_WiFiDirectServiceAutoAcceptSessionConnectedEventArgs =
    {
        "winrt._winrt_windows_devices_wifidirect_services.WiFiDirectServiceAutoAcceptSessionConnectedEventArgs",
        sizeof(py::wrapper::Windows::Devices::WiFiDirect::Services::WiFiDirectServiceAutoAcceptSessionConnectedEventArgs),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_WiFiDirectServiceAutoAcceptSessionConnectedEventArgs
    };

    // ----- WiFiDirectServiceProvisioningInfo class --------------------

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

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

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

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

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

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

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

    static PyObject* _from_WiFiDirectServiceProvisioningInfo(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::Services::WiFiDirectServiceProvisioningInfo>());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyMethodDef _methods_WiFiDirectServiceProvisioningInfo[] = {
        { "_assign_array_", _assign_array_WiFiDirectServiceProvisioningInfo, METH_O | METH_STATIC, nullptr },
        { "_from", reinterpret_cast<PyCFunction>(_from_WiFiDirectServiceProvisioningInfo), METH_O | METH_STATIC, nullptr },
        { }
    };

    static PyGetSetDef _getset_WiFiDirectServiceProvisioningInfo[] = {
        { "is_group_formation_needed", reinterpret_cast<getter>(WiFiDirectServiceProvisioningInfo_get_IsGroupFormationNeeded), nullptr, nullptr, nullptr },
        { "selected_configuration_method", reinterpret_cast<getter>(WiFiDirectServiceProvisioningInfo_get_SelectedConfigurationMethod), nullptr, nullptr, nullptr },
        { }
    };

    static PyType_Slot _type_slots_WiFiDirectServiceProvisioningInfo[] = 
    {
        { Py_tp_new, reinterpret_cast<void*>(_new_WiFiDirectServiceProvisioningInfo) },
        { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_WiFiDirectServiceProvisioningInfo) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_WiFiDirectServiceProvisioningInfo) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_WiFiDirectServiceProvisioningInfo) },
        { },
    };

    static PyType_Spec type_spec_WiFiDirectServiceProvisioningInfo =
    {
        "winrt._winrt_windows_devices_wifidirect_services.WiFiDirectServiceProvisioningInfo",
        sizeof(py::wrapper::Windows::Devices::WiFiDirect::Services::WiFiDirectServiceProvisioningInfo),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_WiFiDirectServiceProvisioningInfo
    };

    // ----- WiFiDirectServiceRemotePortAddedEventArgs class --------------------

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

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

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

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

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

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

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

    static PyObject* _from_WiFiDirectServiceRemotePortAddedEventArgs(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::Services::WiFiDirectServiceRemotePortAddedEventArgs>());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyMethodDef _methods_WiFiDirectServiceRemotePortAddedEventArgs[] = {
        { "_assign_array_", _assign_array_WiFiDirectServiceRemotePortAddedEventArgs, METH_O | METH_STATIC, nullptr },
        { "_from", reinterpret_cast<PyCFunction>(_from_WiFiDirectServiceRemotePortAddedEventArgs), METH_O | METH_STATIC, nullptr },
        { }
    };

    static PyGetSetDef _getset_WiFiDirectServiceRemotePortAddedEventArgs[] = {
        { "endpoint_pairs", reinterpret_cast<getter>(WiFiDirectServiceRemotePortAddedEventArgs_get_EndpointPairs), nullptr, nullptr, nullptr },
        { "protocol", reinterpret_cast<getter>(WiFiDirectServiceRemotePortAddedEventArgs_get_Protocol), nullptr, nullptr, nullptr },
        { }
    };

    static PyType_Slot _type_slots_WiFiDirectServiceRemotePortAddedEventArgs[] = 
    {
        { Py_tp_new, reinterpret_cast<void*>(_new_WiFiDirectServiceRemotePortAddedEventArgs) },
        { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_WiFiDirectServiceRemotePortAddedEventArgs) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_WiFiDirectServiceRemotePortAddedEventArgs) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_WiFiDirectServiceRemotePortAddedEventArgs) },
        { },
    };

    static PyType_Spec type_spec_WiFiDirectServiceRemotePortAddedEventArgs =
    {
        "winrt._winrt_windows_devices_wifidirect_services.WiFiDirectServiceRemotePortAddedEventArgs",
        sizeof(py::wrapper::Windows::Devices::WiFiDirect::Services::WiFiDirectServiceRemotePortAddedEventArgs),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_WiFiDirectServiceRemotePortAddedEventArgs
    };

    // ----- WiFiDirectServiceSession class --------------------

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

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

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

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

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

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

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

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

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

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

    static PyObject* WiFiDirectServiceSession_Close(py::wrapper::Windows::Devices::WiFiDirect::Services::WiFiDirectServiceSession* 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.Services.WiFiDirectServiceSession", 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* WiFiDirectServiceSession_GetConnectionEndpointPairs(py::wrapper::Windows::Devices::WiFiDirect::Services::WiFiDirectServiceSession* 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.Services.WiFiDirectServiceSession", 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* WiFiDirectServiceSession_get_AdvertisementId(py::wrapper::Windows::Devices::WiFiDirect::Services::WiFiDirectServiceSession* self, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Devices.WiFiDirect.Services.WiFiDirectServiceSession", L"AdvertisementId"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return nullptr;
        }

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

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

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

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

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

    static PyObject* WiFiDirectServiceSession_get_ServiceName(py::wrapper::Windows::Devices::WiFiDirect::Services::WiFiDirectServiceSession* self, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Devices.WiFiDirect.Services.WiFiDirectServiceSession", 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* WiFiDirectServiceSession_get_SessionAddress(py::wrapper::Windows::Devices::WiFiDirect::Services::WiFiDirectServiceSession* self, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Devices.WiFiDirect.Services.WiFiDirectServiceSession", L"SessionAddress"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return nullptr;
        }

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

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

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

    static PyObject* WiFiDirectServiceSession_get_Status(py::wrapper::Windows::Devices::WiFiDirect::Services::WiFiDirectServiceSession* self, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Devices.WiFiDirect.Services.WiFiDirectServiceSession", 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* WiFiDirectServiceSession_add_RemotePortAdded(py::wrapper::Windows::Devices::WiFiDirect::Services::WiFiDirectServiceSession* self, PyObject* arg) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsEventPresent(L"Windows.Devices.WiFiDirect.Services.WiFiDirectServiceSession", L"RemotePortAdded"))
        {
            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::Services::WiFiDirectServiceSession, winrt::Windows::Devices::WiFiDirect::Services::WiFiDirectServiceRemotePortAddedEventArgs>>(arg);

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

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

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

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

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

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

    static PyObject* _from_WiFiDirectServiceSession(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::Services::WiFiDirectServiceSession>());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

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

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

    static PyMethodDef _methods_WiFiDirectServiceSession[] = {
        { "add_datagram_socket_async", reinterpret_cast<PyCFunction>(WiFiDirectServiceSession_AddDatagramSocketAsync), METH_VARARGS, nullptr },
        { "add_stream_socket_listener_async", reinterpret_cast<PyCFunction>(WiFiDirectServiceSession_AddStreamSocketListenerAsync), METH_VARARGS, nullptr },
        { "close", reinterpret_cast<PyCFunction>(WiFiDirectServiceSession_Close), METH_VARARGS, nullptr },
        { "get_connection_endpoint_pairs", reinterpret_cast<PyCFunction>(WiFiDirectServiceSession_GetConnectionEndpointPairs), METH_VARARGS, nullptr },
        { "add_remote_port_added", reinterpret_cast<PyCFunction>(WiFiDirectServiceSession_add_RemotePortAdded), METH_O, nullptr },
        { "remove_remote_port_added", reinterpret_cast<PyCFunction>(WiFiDirectServiceSession_remove_RemotePortAdded), METH_O, nullptr },
        { "add_session_status_changed", reinterpret_cast<PyCFunction>(WiFiDirectServiceSession_add_SessionStatusChanged), METH_O, nullptr },
        { "remove_session_status_changed", reinterpret_cast<PyCFunction>(WiFiDirectServiceSession_remove_SessionStatusChanged), METH_O, nullptr },
        { "_assign_array_", _assign_array_WiFiDirectServiceSession, METH_O | METH_STATIC, nullptr },
        { "_from", reinterpret_cast<PyCFunction>(_from_WiFiDirectServiceSession), METH_O | METH_STATIC, nullptr },
        { "__enter__", reinterpret_cast<PyCFunction>(_enter_WiFiDirectServiceSession), METH_NOARGS, nullptr },
        { "__exit__",  reinterpret_cast<PyCFunction>(_exit_WiFiDirectServiceSession), METH_VARARGS, nullptr },
        { }
    };

    static PyGetSetDef _getset_WiFiDirectServiceSession[] = {
        { "advertisement_id", reinterpret_cast<getter>(WiFiDirectServiceSession_get_AdvertisementId), nullptr, nullptr, nullptr },
        { "error_status", reinterpret_cast<getter>(WiFiDirectServiceSession_get_ErrorStatus), nullptr, nullptr, nullptr },
        { "service_address", reinterpret_cast<getter>(WiFiDirectServiceSession_get_ServiceAddress), nullptr, nullptr, nullptr },
        { "service_name", reinterpret_cast<getter>(WiFiDirectServiceSession_get_ServiceName), nullptr, nullptr, nullptr },
        { "session_address", reinterpret_cast<getter>(WiFiDirectServiceSession_get_SessionAddress), nullptr, nullptr, nullptr },
        { "session_id", reinterpret_cast<getter>(WiFiDirectServiceSession_get_SessionId), nullptr, nullptr, nullptr },
        { "status", reinterpret_cast<getter>(WiFiDirectServiceSession_get_Status), nullptr, nullptr, nullptr },
        { }
    };

    static PyType_Slot _type_slots_WiFiDirectServiceSession[] = 
    {
        { Py_tp_new, reinterpret_cast<void*>(_new_WiFiDirectServiceSession) },
        { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_WiFiDirectServiceSession) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_WiFiDirectServiceSession) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_WiFiDirectServiceSession) },
        { },
    };

    static PyType_Spec type_spec_WiFiDirectServiceSession =
    {
        "winrt._winrt_windows_devices_wifidirect_services.WiFiDirectServiceSession",
        sizeof(py::wrapper::Windows::Devices::WiFiDirect::Services::WiFiDirectServiceSession),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_WiFiDirectServiceSession
    };

    // ----- WiFiDirectServiceSessionDeferredEventArgs class --------------------

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

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

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

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

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

    static PyObject* _from_WiFiDirectServiceSessionDeferredEventArgs(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::Services::WiFiDirectServiceSessionDeferredEventArgs>());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyMethodDef _methods_WiFiDirectServiceSessionDeferredEventArgs[] = {
        { "_assign_array_", _assign_array_WiFiDirectServiceSessionDeferredEventArgs, METH_O | METH_STATIC, nullptr },
        { "_from", reinterpret_cast<PyCFunction>(_from_WiFiDirectServiceSessionDeferredEventArgs), METH_O | METH_STATIC, nullptr },
        { }
    };

    static PyGetSetDef _getset_WiFiDirectServiceSessionDeferredEventArgs[] = {
        { "deferred_session_info", reinterpret_cast<getter>(WiFiDirectServiceSessionDeferredEventArgs_get_DeferredSessionInfo), nullptr, nullptr, nullptr },
        { }
    };

    static PyType_Slot _type_slots_WiFiDirectServiceSessionDeferredEventArgs[] = 
    {
        { Py_tp_new, reinterpret_cast<void*>(_new_WiFiDirectServiceSessionDeferredEventArgs) },
        { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_WiFiDirectServiceSessionDeferredEventArgs) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_WiFiDirectServiceSessionDeferredEventArgs) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_WiFiDirectServiceSessionDeferredEventArgs) },
        { },
    };

    static PyType_Spec type_spec_WiFiDirectServiceSessionDeferredEventArgs =
    {
        "winrt._winrt_windows_devices_wifidirect_services.WiFiDirectServiceSessionDeferredEventArgs",
        sizeof(py::wrapper::Windows::Devices::WiFiDirect::Services::WiFiDirectServiceSessionDeferredEventArgs),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_WiFiDirectServiceSessionDeferredEventArgs
    };

    // ----- WiFiDirectServiceSessionRequest class --------------------

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

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

    static PyObject* WiFiDirectServiceSessionRequest_Close(py::wrapper::Windows::Devices::WiFiDirect::Services::WiFiDirectServiceSessionRequest* 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.Services.WiFiDirectServiceSessionRequest", 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* WiFiDirectServiceSessionRequest_get_DeviceInformation(py::wrapper::Windows::Devices::WiFiDirect::Services::WiFiDirectServiceSessionRequest* self, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Devices.WiFiDirect.Services.WiFiDirectServiceSessionRequest", 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* WiFiDirectServiceSessionRequest_get_ProvisioningInfo(py::wrapper::Windows::Devices::WiFiDirect::Services::WiFiDirectServiceSessionRequest* self, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Devices.WiFiDirect.Services.WiFiDirectServiceSessionRequest", L"ProvisioningInfo"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return nullptr;
        }

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

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

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

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

    static PyObject* _from_WiFiDirectServiceSessionRequest(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::Services::WiFiDirectServiceSessionRequest>());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

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

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

    static PyMethodDef _methods_WiFiDirectServiceSessionRequest[] = {
        { "close", reinterpret_cast<PyCFunction>(WiFiDirectServiceSessionRequest_Close), METH_VARARGS, nullptr },
        { "_assign_array_", _assign_array_WiFiDirectServiceSessionRequest, METH_O | METH_STATIC, nullptr },
        { "_from", reinterpret_cast<PyCFunction>(_from_WiFiDirectServiceSessionRequest), METH_O | METH_STATIC, nullptr },
        { "__enter__", reinterpret_cast<PyCFunction>(_enter_WiFiDirectServiceSessionRequest), METH_NOARGS, nullptr },
        { "__exit__",  reinterpret_cast<PyCFunction>(_exit_WiFiDirectServiceSessionRequest), METH_VARARGS, nullptr },
        { }
    };

    static PyGetSetDef _getset_WiFiDirectServiceSessionRequest[] = {
        { "device_information", reinterpret_cast<getter>(WiFiDirectServiceSessionRequest_get_DeviceInformation), nullptr, nullptr, nullptr },
        { "provisioning_info", reinterpret_cast<getter>(WiFiDirectServiceSessionRequest_get_ProvisioningInfo), nullptr, nullptr, nullptr },
        { "session_info", reinterpret_cast<getter>(WiFiDirectServiceSessionRequest_get_SessionInfo), nullptr, nullptr, nullptr },
        { }
    };

    static PyType_Slot _type_slots_WiFiDirectServiceSessionRequest[] = 
    {
        { Py_tp_new, reinterpret_cast<void*>(_new_WiFiDirectServiceSessionRequest) },
        { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_WiFiDirectServiceSessionRequest) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_WiFiDirectServiceSessionRequest) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_WiFiDirectServiceSessionRequest) },
        { },
    };

    static PyType_Spec type_spec_WiFiDirectServiceSessionRequest =
    {
        "winrt._winrt_windows_devices_wifidirect_services.WiFiDirectServiceSessionRequest",
        sizeof(py::wrapper::Windows::Devices::WiFiDirect::Services::WiFiDirectServiceSessionRequest),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_WiFiDirectServiceSessionRequest
    };

    // ----- WiFiDirectServiceSessionRequestedEventArgs class --------------------

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

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

    static PyObject* WiFiDirectServiceSessionRequestedEventArgs_GetSessionRequest(py::wrapper::Windows::Devices::WiFiDirect::Services::WiFiDirectServiceSessionRequestedEventArgs* 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.Services.WiFiDirectServiceSessionRequestedEventArgs", L"GetSessionRequest", 0))
            {
                py::set_arg_count_version_error(0);
                return nullptr;
            }

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

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

    static PyObject* _from_WiFiDirectServiceSessionRequestedEventArgs(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::Services::WiFiDirectServiceSessionRequestedEventArgs>());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyMethodDef _methods_WiFiDirectServiceSessionRequestedEventArgs[] = {
        { "get_session_request", reinterpret_cast<PyCFunction>(WiFiDirectServiceSessionRequestedEventArgs_GetSessionRequest), METH_VARARGS, nullptr },
        { "_assign_array_", _assign_array_WiFiDirectServiceSessionRequestedEventArgs, METH_O | METH_STATIC, nullptr },
        { "_from", reinterpret_cast<PyCFunction>(_from_WiFiDirectServiceSessionRequestedEventArgs), METH_O | METH_STATIC, nullptr },
        { }
    };

    static PyGetSetDef _getset_WiFiDirectServiceSessionRequestedEventArgs[] = {
        { }
    };

    static PyType_Slot _type_slots_WiFiDirectServiceSessionRequestedEventArgs[] = 
    {
        { Py_tp_new, reinterpret_cast<void*>(_new_WiFiDirectServiceSessionRequestedEventArgs) },
        { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_WiFiDirectServiceSessionRequestedEventArgs) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_WiFiDirectServiceSessionRequestedEventArgs) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_WiFiDirectServiceSessionRequestedEventArgs) },
        { },
    };

    static PyType_Spec type_spec_WiFiDirectServiceSessionRequestedEventArgs =
    {
        "winrt._winrt_windows_devices_wifidirect_services.WiFiDirectServiceSessionRequestedEventArgs",
        sizeof(py::wrapper::Windows::Devices::WiFiDirect::Services::WiFiDirectServiceSessionRequestedEventArgs),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_WiFiDirectServiceSessionRequestedEventArgs
    };

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


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

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

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

    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;
    }

    py::pyobj_handle type_WiFiDirectService_Static{PyType_FromSpec(&type_spec_WiFiDirectService_Static)};
    if (!type_WiFiDirectService_Static)
    {
        return nullptr;
    }

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

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

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

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

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

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

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

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

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


    return module.detach();
}
