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

#include "py.Windows.Gaming.UI.h"

namespace py::cpp::Windows::Gaming::UI
{
    // ----- GameBar class --------------------

    static PyObject* _new_GameBar(PyTypeObject* /*unused*/, PyObject* /*unused*/, PyObject* /*unused*/) noexcept
    {
        static_assert(py::py_type<winrt::Windows::Gaming::UI::GameBar>::type_name);
        py::set_invalid_activation_error(py::py_type<winrt::Windows::Gaming::UI::GameBar>::type_name);
        return nullptr;
    }

    static PyObject* GameBar_get_IsInputRedirected(PyObject* /*unused*/, void* /*unused*/) noexcept
    {
        try
        {
            static std::optional<bool> is_property_present{};

            if (!is_property_present.has_value())
            {
                is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Gaming.UI.GameBar", L"IsInputRedirected");
            }

            if (!is_property_present.value())
            {
                PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
                return nullptr;
            }

            return py::convert([&]()
            {
                auto _gil = release_gil();
                return winrt::Windows::Gaming::UI::GameBar::IsInputRedirected();
            }());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* GameBar_get_Visible(PyObject* /*unused*/, void* /*unused*/) noexcept
    {
        try
        {
            static std::optional<bool> is_property_present{};

            if (!is_property_present.has_value())
            {
                is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Gaming.UI.GameBar", L"Visible");
            }

            if (!is_property_present.value())
            {
                PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
                return nullptr;
            }

            return py::convert([&]()
            {
                auto _gil = release_gil();
                return winrt::Windows::Gaming::UI::GameBar::Visible();
            }());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* GameBar_add_IsInputRedirectedChanged(PyObject* /*unused*/, PyObject* arg) noexcept
    {
        try
        {
            static std::optional<bool> is_event_present{};

            if (!is_event_present.has_value())
            {
                is_event_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsEventPresent(L"Windows.Gaming.UI.GameBar", L"IsInputRedirectedChanged");
            }

            if (!is_event_present.value())
            {
                PyErr_SetString(PyExc_AttributeError, "event is not available in this version of Windows");
                return nullptr;
            }

            auto param0 = py::convert_to<winrt::Windows::Foundation::EventHandler<winrt::Windows::Foundation::IInspectable>>(arg);

            return py::convert([&]()
            {
                auto _gil = release_gil();
                return winrt::Windows::Gaming::UI::GameBar::IsInputRedirectedChanged(param0);
            }());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* GameBar_remove_IsInputRedirectedChanged(PyObject* /*unused*/, PyObject* arg) noexcept
    {
        try
        {
            static std::optional<bool> is_event_present{};

            if (!is_event_present.has_value())
            {
                is_event_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsEventPresent(L"Windows.Gaming.UI.GameBar", L"IsInputRedirectedChanged");
            }

            if (!is_event_present.value())
            {
                PyErr_SetString(PyExc_AttributeError, "event is not available in this version of Windows");
                return nullptr;
            }

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

            {
                auto _gil = release_gil();
                winrt::Windows::Gaming::UI::GameBar::IsInputRedirectedChanged(param0);
            }

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

    static PyObject* GameBar_add_VisibilityChanged(PyObject* /*unused*/, PyObject* arg) noexcept
    {
        try
        {
            static std::optional<bool> is_event_present{};

            if (!is_event_present.has_value())
            {
                is_event_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsEventPresent(L"Windows.Gaming.UI.GameBar", L"VisibilityChanged");
            }

            if (!is_event_present.value())
            {
                PyErr_SetString(PyExc_AttributeError, "event is not available in this version of Windows");
                return nullptr;
            }

            auto param0 = py::convert_to<winrt::Windows::Foundation::EventHandler<winrt::Windows::Foundation::IInspectable>>(arg);

            return py::convert([&]()
            {
                auto _gil = release_gil();
                return winrt::Windows::Gaming::UI::GameBar::VisibilityChanged(param0);
            }());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* GameBar_remove_VisibilityChanged(PyObject* /*unused*/, PyObject* arg) noexcept
    {
        try
        {
            static std::optional<bool> is_event_present{};

            if (!is_event_present.has_value())
            {
                is_event_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsEventPresent(L"Windows.Gaming.UI.GameBar", L"VisibilityChanged");
            }

            if (!is_event_present.value())
            {
                PyErr_SetString(PyExc_AttributeError, "event is not available in this version of Windows");
                return nullptr;
            }

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

            {
                auto _gil = release_gil();
                winrt::Windows::Gaming::UI::GameBar::VisibilityChanged(param0);
            }

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

    static PyMethodDef _methods_GameBar[] = {
        { }};

    static PyGetSetDef _getset_GameBar[] = {
        { }};

    static PyType_Slot _type_slots_GameBar[] = {
        { Py_tp_new, reinterpret_cast<void*>(_new_GameBar) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_GameBar) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_GameBar) },
        { }};

    static PyType_Spec type_spec_GameBar = {
        "winrt._winrt_windows_gaming_ui.GameBar",
        0,
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_GameBar};

    static PyGetSetDef getset_GameBar_Static[] = {
        { "is_input_redirected", reinterpret_cast<getter>(GameBar_get_IsInputRedirected), nullptr, nullptr, nullptr },
        { "visible", reinterpret_cast<getter>(GameBar_get_Visible), nullptr, nullptr, nullptr },
        { }};

    static PyMethodDef methods_GameBar_Static[] = {
        { "add_is_input_redirected_changed", reinterpret_cast<PyCFunction>(GameBar_add_IsInputRedirectedChanged), METH_O, nullptr },
        { "remove_is_input_redirected_changed", reinterpret_cast<PyCFunction>(GameBar_remove_IsInputRedirectedChanged), METH_O, nullptr },
        { "add_visibility_changed", reinterpret_cast<PyCFunction>(GameBar_add_VisibilityChanged), METH_O, nullptr },
        { "remove_visibility_changed", reinterpret_cast<PyCFunction>(GameBar_remove_VisibilityChanged), METH_O, nullptr },
        { }};

    static PyType_Slot type_slots_GameBar_Static[] = 
    {
        { Py_tp_base, reinterpret_cast<void*>(&PyType_Type) },
        { Py_tp_getset, reinterpret_cast<void*>(getset_GameBar_Static) },
        { Py_tp_methods, reinterpret_cast<void*>(methods_GameBar_Static) },
        { }
    };

    static PyType_Spec type_spec_GameBar_Static = {
        "winrt._winrt_windows_gaming_ui.GameBar_Static",
        static_cast<int>(PyType_Type.tp_basicsize),
        static_cast<int>(PyType_Type.tp_itemsize),
        Py_TPFLAGS_DEFAULT,
        type_slots_GameBar_Static};

    // ----- GameChatMessageReceivedEventArgs class --------------------

    static PyObject* _new_GameChatMessageReceivedEventArgs(PyTypeObject* /*unused*/, PyObject* /*unused*/, PyObject* /*unused*/) noexcept
    {
        static_assert(py::py_type<winrt::Windows::Gaming::UI::GameChatMessageReceivedEventArgs>::type_name);
        py::set_invalid_activation_error(py::py_type<winrt::Windows::Gaming::UI::GameChatMessageReceivedEventArgs>::type_name);
        return nullptr;
    }

    static void _dealloc_GameChatMessageReceivedEventArgs(py::wrapper::Windows::Gaming::UI::GameChatMessageReceivedEventArgs* self) noexcept
    {
        auto tp = Py_TYPE(self);
        std::destroy_at(&self->obj);
        tp->tp_free(self);
        Py_DECREF(tp);
    }

    static PyObject* GameChatMessageReceivedEventArgs_get_AppDisplayName(py::wrapper::Windows::Gaming::UI::GameChatMessageReceivedEventArgs* self, void* /*unused*/) noexcept
    {
        try
        {
            static std::optional<bool> is_property_present{};

            if (!is_property_present.has_value())
            {
                is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Gaming.UI.GameChatMessageReceivedEventArgs", L"AppDisplayName");
            }

            if (!is_property_present.value())
            {
                PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
                return nullptr;
            }

            return py::convert([&]()
            {
                auto _gil = release_gil();
                return self->obj.AppDisplayName();
            }());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* GameChatMessageReceivedEventArgs_get_AppId(py::wrapper::Windows::Gaming::UI::GameChatMessageReceivedEventArgs* self, void* /*unused*/) noexcept
    {
        try
        {
            static std::optional<bool> is_property_present{};

            if (!is_property_present.has_value())
            {
                is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Gaming.UI.GameChatMessageReceivedEventArgs", L"AppId");
            }

            if (!is_property_present.value())
            {
                PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
                return nullptr;
            }

            return py::convert([&]()
            {
                auto _gil = release_gil();
                return self->obj.AppId();
            }());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* GameChatMessageReceivedEventArgs_get_Message(py::wrapper::Windows::Gaming::UI::GameChatMessageReceivedEventArgs* self, void* /*unused*/) noexcept
    {
        try
        {
            static std::optional<bool> is_property_present{};

            if (!is_property_present.has_value())
            {
                is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Gaming.UI.GameChatMessageReceivedEventArgs", L"Message");
            }

            if (!is_property_present.value())
            {
                PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
                return nullptr;
            }

            return py::convert([&]()
            {
                auto _gil = release_gil();
                return self->obj.Message();
            }());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* GameChatMessageReceivedEventArgs_get_Origin(py::wrapper::Windows::Gaming::UI::GameChatMessageReceivedEventArgs* self, void* /*unused*/) noexcept
    {
        try
        {
            static std::optional<bool> is_property_present{};

            if (!is_property_present.has_value())
            {
                is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Gaming.UI.GameChatMessageReceivedEventArgs", L"Origin");
            }

            if (!is_property_present.value())
            {
                PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
                return nullptr;
            }

            return py::convert([&]()
            {
                auto _gil = release_gil();
                return self->obj.Origin();
            }());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* GameChatMessageReceivedEventArgs_get_SenderName(py::wrapper::Windows::Gaming::UI::GameChatMessageReceivedEventArgs* self, void* /*unused*/) noexcept
    {
        try
        {
            static std::optional<bool> is_property_present{};

            if (!is_property_present.has_value())
            {
                is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Gaming.UI.GameChatMessageReceivedEventArgs", L"SenderName");
            }

            if (!is_property_present.value())
            {
                PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
                return nullptr;
            }

            return py::convert([&]()
            {
                auto _gil = release_gil();
                return self->obj.SenderName();
            }());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

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

    static PyObject* _from_GameChatMessageReceivedEventArgs(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::Gaming::UI::GameChatMessageReceivedEventArgs>());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyMethodDef _methods_GameChatMessageReceivedEventArgs[] = {
        { "_assign_array_", _assign_array_GameChatMessageReceivedEventArgs, METH_O | METH_STATIC, nullptr },
        { "_from", reinterpret_cast<PyCFunction>(_from_GameChatMessageReceivedEventArgs), METH_O | METH_STATIC, nullptr },
        { }};

    static PyGetSetDef _getset_GameChatMessageReceivedEventArgs[] = {
        { "app_display_name", reinterpret_cast<getter>(GameChatMessageReceivedEventArgs_get_AppDisplayName), nullptr, nullptr, nullptr },
        { "app_id", reinterpret_cast<getter>(GameChatMessageReceivedEventArgs_get_AppId), nullptr, nullptr, nullptr },
        { "message", reinterpret_cast<getter>(GameChatMessageReceivedEventArgs_get_Message), nullptr, nullptr, nullptr },
        { "origin", reinterpret_cast<getter>(GameChatMessageReceivedEventArgs_get_Origin), nullptr, nullptr, nullptr },
        { "sender_name", reinterpret_cast<getter>(GameChatMessageReceivedEventArgs_get_SenderName), nullptr, nullptr, nullptr },
        { }};

    static PyType_Slot _type_slots_GameChatMessageReceivedEventArgs[] = {
        { Py_tp_new, reinterpret_cast<void*>(_new_GameChatMessageReceivedEventArgs) },
        { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_GameChatMessageReceivedEventArgs) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_GameChatMessageReceivedEventArgs) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_GameChatMessageReceivedEventArgs) },
        { }};

    static PyType_Spec type_spec_GameChatMessageReceivedEventArgs = {
        "winrt._winrt_windows_gaming_ui.GameChatMessageReceivedEventArgs",
        sizeof(py::wrapper::Windows::Gaming::UI::GameChatMessageReceivedEventArgs),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_GameChatMessageReceivedEventArgs};

    // ----- GameChatOverlay class --------------------

    static PyObject* _new_GameChatOverlay(PyTypeObject* /*unused*/, PyObject* /*unused*/, PyObject* /*unused*/) noexcept
    {
        static_assert(py::py_type<winrt::Windows::Gaming::UI::GameChatOverlay>::type_name);
        py::set_invalid_activation_error(py::py_type<winrt::Windows::Gaming::UI::GameChatOverlay>::type_name);
        return nullptr;
    }

    static void _dealloc_GameChatOverlay(py::wrapper::Windows::Gaming::UI::GameChatOverlay* self) noexcept
    {
        auto tp = Py_TYPE(self);
        std::destroy_at(&self->obj);
        tp->tp_free(self);
        Py_DECREF(tp);
    }

    static PyObject* GameChatOverlay_AddMessage(py::wrapper::Windows::Gaming::UI::GameChatOverlay* self, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_GET_SIZE(args);

        if (arg_count == 3)
        {
            try
            {
                static std::optional<bool> is_overload_present{};

                if (!is_overload_present.has_value())
                {
                    is_overload_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Gaming.UI.GameChatOverlay", L"AddMessage", 3);
                }

                if (!is_overload_present.value())
                {
                    py::set_arg_count_version_error(3);
                    return nullptr;
                }

                auto param0 = py::convert_to<winrt::hstring>(args, 0);
                auto param1 = py::convert_to<winrt::hstring>(args, 1);
                auto param2 = py::convert_to<winrt::Windows::Gaming::UI::GameChatMessageOrigin>(args, 2);

                {
                    auto _gil = release_gil();
                    self->obj.AddMessage(param0, param1, param2);
                }

                Py_RETURN_NONE;
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* GameChatOverlay_GetDefault(PyObject* /*unused*/, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_GET_SIZE(args);

        if (arg_count == 0)
        {
            try
            {
                static std::optional<bool> is_overload_present{};

                if (!is_overload_present.has_value())
                {
                    is_overload_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Gaming.UI.GameChatOverlay", L"GetDefault", 0);
                }

                if (!is_overload_present.value())
                {
                    py::set_arg_count_version_error(0);
                    return nullptr;
                }

                return py::convert([&]()
                {
                    auto _gil = release_gil();
                    return winrt::Windows::Gaming::UI::GameChatOverlay::GetDefault();
                }());
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* GameChatOverlay_get_DesiredPosition(py::wrapper::Windows::Gaming::UI::GameChatOverlay* self, void* /*unused*/) noexcept
    {
        try
        {
            static std::optional<bool> is_property_present{};

            if (!is_property_present.has_value())
            {
                is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Gaming.UI.GameChatOverlay", L"DesiredPosition");
            }

            if (!is_property_present.value())
            {
                PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
                return nullptr;
            }

            return py::convert([&]()
            {
                auto _gil = release_gil();
                return self->obj.DesiredPosition();
            }());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static int GameChatOverlay_put_DesiredPosition(py::wrapper::Windows::Gaming::UI::GameChatOverlay* self, PyObject* arg, void* /*unused*/) noexcept
    {
        if (!arg)
        {
            PyErr_SetString(PyExc_AttributeError, "can't delete attribute");
            return -1;
        }

        try
        {
            static std::optional<bool> is_property_present{};

            if (!is_property_present.has_value())
            {
                is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Gaming.UI.GameChatOverlay", L"DesiredPosition");
            }

            if (!is_property_present.value())
            {
                PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
                return -1;
            }

            auto param0 = py::convert_to<winrt::Windows::Gaming::UI::GameChatOverlayPosition>(arg);

            {
                auto _gil = release_gil();
                self->obj.DesiredPosition(param0);
            }

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

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

    static PyObject* _from_GameChatOverlay(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::Gaming::UI::GameChatOverlay>());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyMethodDef _methods_GameChatOverlay[] = {
        { "add_message", reinterpret_cast<PyCFunction>(GameChatOverlay_AddMessage), METH_VARARGS, nullptr },
        { "_assign_array_", _assign_array_GameChatOverlay, METH_O | METH_STATIC, nullptr },
        { "_from", reinterpret_cast<PyCFunction>(_from_GameChatOverlay), METH_O | METH_STATIC, nullptr },
        { }};

    static PyGetSetDef _getset_GameChatOverlay[] = {
        { "desired_position", reinterpret_cast<getter>(GameChatOverlay_get_DesiredPosition), reinterpret_cast<setter>(GameChatOverlay_put_DesiredPosition), nullptr, nullptr },
        { }};

    static PyType_Slot _type_slots_GameChatOverlay[] = {
        { Py_tp_new, reinterpret_cast<void*>(_new_GameChatOverlay) },
        { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_GameChatOverlay) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_GameChatOverlay) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_GameChatOverlay) },
        { }};

    static PyType_Spec type_spec_GameChatOverlay = {
        "winrt._winrt_windows_gaming_ui.GameChatOverlay",
        sizeof(py::wrapper::Windows::Gaming::UI::GameChatOverlay),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_GameChatOverlay};

    static PyGetSetDef getset_GameChatOverlay_Static[] = {
        { }};

    static PyMethodDef methods_GameChatOverlay_Static[] = {
        { "get_default", reinterpret_cast<PyCFunction>(GameChatOverlay_GetDefault), METH_VARARGS, nullptr },
        { }};

    static PyType_Slot type_slots_GameChatOverlay_Static[] = 
    {
        { Py_tp_base, reinterpret_cast<void*>(&PyType_Type) },
        { Py_tp_getset, reinterpret_cast<void*>(getset_GameChatOverlay_Static) },
        { Py_tp_methods, reinterpret_cast<void*>(methods_GameChatOverlay_Static) },
        { }
    };

    static PyType_Spec type_spec_GameChatOverlay_Static = {
        "winrt._winrt_windows_gaming_ui.GameChatOverlay_Static",
        static_cast<int>(PyType_Type.tp_basicsize),
        static_cast<int>(PyType_Type.tp_itemsize),
        Py_TPFLAGS_DEFAULT,
        type_slots_GameChatOverlay_Static};

    // ----- GameChatOverlayMessageSource class --------------------

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

        auto arg_count = PyTuple_GET_SIZE(args);
        if (arg_count == 0)
        {
            try
            {
                winrt::Windows::Gaming::UI::GameChatOverlayMessageSource instance{};
                return py::wrap(instance, type);
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static void _dealloc_GameChatOverlayMessageSource(py::wrapper::Windows::Gaming::UI::GameChatOverlayMessageSource* self) noexcept
    {
        auto tp = Py_TYPE(self);
        std::destroy_at(&self->obj);
        tp->tp_free(self);
        Py_DECREF(tp);
    }

    static PyObject* GameChatOverlayMessageSource_SetDelayBeforeClosingAfterMessageReceived(py::wrapper::Windows::Gaming::UI::GameChatOverlayMessageSource* self, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_GET_SIZE(args);

        if (arg_count == 1)
        {
            try
            {
                static std::optional<bool> is_overload_present{};

                if (!is_overload_present.has_value())
                {
                    is_overload_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Gaming.UI.GameChatOverlayMessageSource", L"SetDelayBeforeClosingAfterMessageReceived", 1);
                }

                if (!is_overload_present.value())
                {
                    py::set_arg_count_version_error(1);
                    return nullptr;
                }

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

                {
                    auto _gil = release_gil();
                    self->obj.SetDelayBeforeClosingAfterMessageReceived(param0);
                }

                Py_RETURN_NONE;
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* GameChatOverlayMessageSource_add_MessageReceived(py::wrapper::Windows::Gaming::UI::GameChatOverlayMessageSource* self, PyObject* arg) noexcept
    {
        try
        {
            static std::optional<bool> is_event_present{};

            if (!is_event_present.has_value())
            {
                is_event_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsEventPresent(L"Windows.Gaming.UI.GameChatOverlayMessageSource", L"MessageReceived");
            }

            if (!is_event_present.value())
            {
                PyErr_SetString(PyExc_AttributeError, "event is not available in this version of Windows");
                return nullptr;
            }

            auto param0 = py::convert_to<winrt::Windows::Foundation::TypedEventHandler<winrt::Windows::Gaming::UI::GameChatOverlayMessageSource, winrt::Windows::Gaming::UI::GameChatMessageReceivedEventArgs>>(arg);

            return py::convert([&]()
            {
                auto _gil = release_gil();
                return self->obj.MessageReceived(param0);
            }());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* GameChatOverlayMessageSource_remove_MessageReceived(py::wrapper::Windows::Gaming::UI::GameChatOverlayMessageSource* self, PyObject* arg) noexcept
    {
        try
        {
            static std::optional<bool> is_event_present{};

            if (!is_event_present.has_value())
            {
                is_event_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsEventPresent(L"Windows.Gaming.UI.GameChatOverlayMessageSource", L"MessageReceived");
            }

            if (!is_event_present.value())
            {
                PyErr_SetString(PyExc_AttributeError, "event is not available in this version of Windows");
                return nullptr;
            }

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

            {
                auto _gil = release_gil();
                self->obj.MessageReceived(param0);
            }

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

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

    static PyObject* _from_GameChatOverlayMessageSource(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::Gaming::UI::GameChatOverlayMessageSource>());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyMethodDef _methods_GameChatOverlayMessageSource[] = {
        { "set_delay_before_closing_after_message_received", reinterpret_cast<PyCFunction>(GameChatOverlayMessageSource_SetDelayBeforeClosingAfterMessageReceived), METH_VARARGS, nullptr },
        { "add_message_received", reinterpret_cast<PyCFunction>(GameChatOverlayMessageSource_add_MessageReceived), METH_O, nullptr },
        { "remove_message_received", reinterpret_cast<PyCFunction>(GameChatOverlayMessageSource_remove_MessageReceived), METH_O, nullptr },
        { "_assign_array_", _assign_array_GameChatOverlayMessageSource, METH_O | METH_STATIC, nullptr },
        { "_from", reinterpret_cast<PyCFunction>(_from_GameChatOverlayMessageSource), METH_O | METH_STATIC, nullptr },
        { }};

    static PyGetSetDef _getset_GameChatOverlayMessageSource[] = {
        { }};

    static PyType_Slot _type_slots_GameChatOverlayMessageSource[] = {
        { Py_tp_new, reinterpret_cast<void*>(_new_GameChatOverlayMessageSource) },
        { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_GameChatOverlayMessageSource) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_GameChatOverlayMessageSource) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_GameChatOverlayMessageSource) },
        { }};

    static PyType_Spec type_spec_GameChatOverlayMessageSource = {
        "winrt._winrt_windows_gaming_ui.GameChatOverlayMessageSource",
        sizeof(py::wrapper::Windows::Gaming::UI::GameChatOverlayMessageSource),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_GameChatOverlayMessageSource};

    // ----- GameUIProviderActivatedEventArgs class --------------------

    static PyObject* _new_GameUIProviderActivatedEventArgs(PyTypeObject* /*unused*/, PyObject* /*unused*/, PyObject* /*unused*/) noexcept
    {
        static_assert(py::py_type<winrt::Windows::Gaming::UI::GameUIProviderActivatedEventArgs>::type_name);
        py::set_invalid_activation_error(py::py_type<winrt::Windows::Gaming::UI::GameUIProviderActivatedEventArgs>::type_name);
        return nullptr;
    }

    static void _dealloc_GameUIProviderActivatedEventArgs(py::wrapper::Windows::Gaming::UI::GameUIProviderActivatedEventArgs* self) noexcept
    {
        auto tp = Py_TYPE(self);
        std::destroy_at(&self->obj);
        tp->tp_free(self);
        Py_DECREF(tp);
    }

    static PyObject* GameUIProviderActivatedEventArgs_ReportCompleted(py::wrapper::Windows::Gaming::UI::GameUIProviderActivatedEventArgs* self, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_GET_SIZE(args);

        if (arg_count == 1)
        {
            try
            {
                static std::optional<bool> is_overload_present{};

                if (!is_overload_present.has_value())
                {
                    is_overload_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Gaming.UI.GameUIProviderActivatedEventArgs", L"ReportCompleted", 1);
                }

                if (!is_overload_present.value())
                {
                    py::set_arg_count_version_error(1);
                    return nullptr;
                }

                auto param0 = py::convert_to<winrt::Windows::Foundation::Collections::ValueSet>(args, 0);

                {
                    auto _gil = release_gil();
                    self->obj.ReportCompleted(param0);
                }

                Py_RETURN_NONE;
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* GameUIProviderActivatedEventArgs_get_Kind(py::wrapper::Windows::Gaming::UI::GameUIProviderActivatedEventArgs* self, void* /*unused*/) noexcept
    {
        try
        {
            static std::optional<bool> is_property_present{};

            if (!is_property_present.has_value())
            {
                is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Gaming.UI.GameUIProviderActivatedEventArgs", L"Kind");
            }

            if (!is_property_present.value())
            {
                PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
                return nullptr;
            }

            return py::convert([&]()
            {
                auto _gil = release_gil();
                return self->obj.Kind();
            }());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* GameUIProviderActivatedEventArgs_get_PreviousExecutionState(py::wrapper::Windows::Gaming::UI::GameUIProviderActivatedEventArgs* self, void* /*unused*/) noexcept
    {
        try
        {
            static std::optional<bool> is_property_present{};

            if (!is_property_present.has_value())
            {
                is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Gaming.UI.GameUIProviderActivatedEventArgs", L"PreviousExecutionState");
            }

            if (!is_property_present.value())
            {
                PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
                return nullptr;
            }

            return py::convert([&]()
            {
                auto _gil = release_gil();
                return self->obj.PreviousExecutionState();
            }());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* GameUIProviderActivatedEventArgs_get_SplashScreen(py::wrapper::Windows::Gaming::UI::GameUIProviderActivatedEventArgs* self, void* /*unused*/) noexcept
    {
        try
        {
            static std::optional<bool> is_property_present{};

            if (!is_property_present.has_value())
            {
                is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Gaming.UI.GameUIProviderActivatedEventArgs", L"SplashScreen");
            }

            if (!is_property_present.value())
            {
                PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
                return nullptr;
            }

            return py::convert([&]()
            {
                auto _gil = release_gil();
                return self->obj.SplashScreen();
            }());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* GameUIProviderActivatedEventArgs_get_GameUIArgs(py::wrapper::Windows::Gaming::UI::GameUIProviderActivatedEventArgs* self, void* /*unused*/) noexcept
    {
        try
        {
            static std::optional<bool> is_property_present{};

            if (!is_property_present.has_value())
            {
                is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Gaming.UI.GameUIProviderActivatedEventArgs", L"GameUIArgs");
            }

            if (!is_property_present.value())
            {
                PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
                return nullptr;
            }

            return py::convert([&]()
            {
                auto _gil = release_gil();
                return self->obj.GameUIArgs();
            }());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

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

    static PyObject* _from_GameUIProviderActivatedEventArgs(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::Gaming::UI::GameUIProviderActivatedEventArgs>());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyMethodDef _methods_GameUIProviderActivatedEventArgs[] = {
        { "report_completed", reinterpret_cast<PyCFunction>(GameUIProviderActivatedEventArgs_ReportCompleted), METH_VARARGS, nullptr },
        { "_assign_array_", _assign_array_GameUIProviderActivatedEventArgs, METH_O | METH_STATIC, nullptr },
        { "_from", reinterpret_cast<PyCFunction>(_from_GameUIProviderActivatedEventArgs), METH_O | METH_STATIC, nullptr },
        { }};

    static PyGetSetDef _getset_GameUIProviderActivatedEventArgs[] = {
        { "kind", reinterpret_cast<getter>(GameUIProviderActivatedEventArgs_get_Kind), nullptr, nullptr, nullptr },
        { "previous_execution_state", reinterpret_cast<getter>(GameUIProviderActivatedEventArgs_get_PreviousExecutionState), nullptr, nullptr, nullptr },
        { "splash_screen", reinterpret_cast<getter>(GameUIProviderActivatedEventArgs_get_SplashScreen), nullptr, nullptr, nullptr },
        { "game_ui_args", reinterpret_cast<getter>(GameUIProviderActivatedEventArgs_get_GameUIArgs), nullptr, nullptr, nullptr },
        { }};

    static PyType_Slot _type_slots_GameUIProviderActivatedEventArgs[] = {
        { Py_tp_new, reinterpret_cast<void*>(_new_GameUIProviderActivatedEventArgs) },
        { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_GameUIProviderActivatedEventArgs) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_GameUIProviderActivatedEventArgs) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_GameUIProviderActivatedEventArgs) },
        { }};

    static PyType_Spec type_spec_GameUIProviderActivatedEventArgs = {
        "winrt._winrt_windows_gaming_ui.GameUIProviderActivatedEventArgs",
        sizeof(py::wrapper::Windows::Gaming::UI::GameUIProviderActivatedEventArgs),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_GameUIProviderActivatedEventArgs};

    // ----- Windows.Gaming.UI Initialization --------------------

    PyDoc_STRVAR(module_doc, "Windows.Gaming.UI");

    static PyModuleDef module_def = {
        PyModuleDef_HEAD_INIT,
        "_winrt_windows_gaming_ui",
        module_doc,
        0,
        nullptr,
        nullptr,
        nullptr,
        nullptr,
        nullptr};
} // py::cpp::Windows::Gaming::UI

PyMODINIT_FUNC PyInit__winrt_windows_gaming_ui(void) noexcept
{
    using namespace py::cpp::Windows::Gaming::UI;

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

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

    if (!module)
    {
        return nullptr;
    }

    auto inspectable_meta_type = py::get_inspectable_meta_type();
    if (!inspectable_meta_type)
    {
        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 GameBar_Static_bases{PyTuple_Pack(1, reinterpret_cast<PyObject*>(inspectable_meta_type))};
    if (!GameBar_Static_bases)
    {
        return nullptr;
    }

    py::pyobj_handle type_GameBar_Static{PyType_FromSpecWithBases(&type_spec_GameBar_Static, GameBar_Static_bases.get())};
    if (!type_GameBar_Static)
    {
        return nullptr;
    }

    py::pytype_handle GameBar_type{py::register_python_type(module.get(), &type_spec_GameBar, object_bases.get(), reinterpret_cast<PyTypeObject*>(type_GameBar_Static.get()))};
    if (!GameBar_type)
    {
        return nullptr;
    }

    py::pytype_handle GameChatMessageReceivedEventArgs_type{py::register_python_type(module.get(), &type_spec_GameChatMessageReceivedEventArgs, object_bases.get(), inspectable_meta_type)};
    if (!GameChatMessageReceivedEventArgs_type)
    {
        return nullptr;
    }

    py::pyobj_handle GameChatOverlay_Static_bases{PyTuple_Pack(1, reinterpret_cast<PyObject*>(inspectable_meta_type))};
    if (!GameChatOverlay_Static_bases)
    {
        return nullptr;
    }

    py::pyobj_handle type_GameChatOverlay_Static{PyType_FromSpecWithBases(&type_spec_GameChatOverlay_Static, GameChatOverlay_Static_bases.get())};
    if (!type_GameChatOverlay_Static)
    {
        return nullptr;
    }

    py::pytype_handle GameChatOverlay_type{py::register_python_type(module.get(), &type_spec_GameChatOverlay, object_bases.get(), reinterpret_cast<PyTypeObject*>(type_GameChatOverlay_Static.get()))};
    if (!GameChatOverlay_type)
    {
        return nullptr;
    }

    py::pytype_handle GameChatOverlayMessageSource_type{py::register_python_type(module.get(), &type_spec_GameChatOverlayMessageSource, object_bases.get(), inspectable_meta_type)};
    if (!GameChatOverlayMessageSource_type)
    {
        return nullptr;
    }

    py::pytype_handle GameUIProviderActivatedEventArgs_type{py::register_python_type(module.get(), &type_spec_GameUIProviderActivatedEventArgs, object_bases.get(), inspectable_meta_type)};
    if (!GameUIProviderActivatedEventArgs_type)
    {
        return nullptr;
    }


    return module.detach();
}
