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

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


namespace py::cpp::Windows::Gaming::UI
{
    struct module_state
    {
        PyObject* type_GameChatMessageOrigin;
        PyObject* type_GameChatOverlayPosition;
        PyTypeObject* type_GameBar;
        PyTypeObject* type_GameChatMessageReceivedEventArgs;
        PyTypeObject* type_GameChatOverlay;
        PyTypeObject* type_GameChatOverlayMessageSource;
        PyTypeObject* type_GameUIProviderActivatedEventArgs;
    };

    static PyObject* register_GameChatMessageOrigin(PyObject* module, PyObject* type) noexcept
    {
        auto state = reinterpret_cast<module_state*>(PyModule_GetState(module));
        assert(state);

        if (state->type_GameChatMessageOrigin)
        {
            PyErr_SetString(PyExc_RuntimeError, "type has already been registered");
            return nullptr;
        }

        if (!PyType_Check(type))
        {
            PyErr_SetString(PyExc_TypeError, "argument is not a type");
            return nullptr;
        }

        state->type_GameChatMessageOrigin = type;
        Py_INCREF(state->type_GameChatMessageOrigin);


        Py_RETURN_NONE;
    }

    static PyObject* register_GameChatOverlayPosition(PyObject* module, PyObject* type) noexcept
    {
        auto state = reinterpret_cast<module_state*>(PyModule_GetState(module));
        assert(state);

        if (state->type_GameChatOverlayPosition)
        {
            PyErr_SetString(PyExc_RuntimeError, "type has already been registered");
            return nullptr;
        }

        if (!PyType_Check(type))
        {
            PyErr_SetString(PyExc_TypeError, "argument is not a type");
            return nullptr;
        }

        state->type_GameChatOverlayPosition = type;
        Py_INCREF(state->type_GameChatOverlayPosition);


        Py_RETURN_NONE;
    }

    // ----- GameBar class --------------------
    static constexpr const char* const type_name_GameBar = "GameBar";

    static PyObject* _new_GameBar(PyTypeObject* type, PyObject* args, PyObject* kwds) noexcept
    {
        py::set_invalid_activation_error(type_name_GameBar);
        return nullptr;
    }

    static PyObject* GameBar_get_IsInputRedirected(PyObject* /*unused*/, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Gaming.UI.GameBar", L"IsInputRedirected"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return nullptr;
        }

        try
        {
            return py::convert(winrt::Windows::Gaming::UI::GameBar::IsInputRedirected());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* GameBar_get_Visible(PyObject* /*unused*/, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Gaming.UI.GameBar", L"Visible"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return nullptr;
        }

        try
        {
            return py::convert(winrt::Windows::Gaming::UI::GameBar::Visible());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* GameBar_add_IsInputRedirectedChanged(PyObject* /*unused*/, PyObject* arg) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsEventPresent(L"Windows.Gaming.UI.GameBar", L"IsInputRedirectedChanged"))
        {
            PyErr_SetString(PyExc_AttributeError, "event is not available in this version of Windows");
            return nullptr;
        }

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

            return py::convert(winrt::Windows::Gaming::UI::GameBar::IsInputRedirectedChanged(param0));
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* GameBar_remove_IsInputRedirectedChanged(PyObject* /*unused*/, PyObject* arg) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsEventPresent(L"Windows.Gaming.UI.GameBar", L"IsInputRedirectedChanged"))
        {
            PyErr_SetString(PyExc_AttributeError, "event is not available in this version of Windows");
            return nullptr;
        }

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

            winrt::Windows::Gaming::UI::GameBar::IsInputRedirectedChanged(param0);
            Py_RETURN_NONE;
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* GameBar_add_VisibilityChanged(PyObject* /*unused*/, PyObject* arg) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsEventPresent(L"Windows.Gaming.UI.GameBar", L"VisibilityChanged"))
        {
            PyErr_SetString(PyExc_AttributeError, "event is not available in this version of Windows");
            return nullptr;
        }

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

            return py::convert(winrt::Windows::Gaming::UI::GameBar::VisibilityChanged(param0));
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* GameBar_remove_VisibilityChanged(PyObject* /*unused*/, PyObject* arg) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsEventPresent(L"Windows.Gaming.UI.GameBar", L"VisibilityChanged"))
        {
            PyErr_SetString(PyExc_AttributeError, "event is not available in this version of Windows");
            return nullptr;
        }

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

            winrt::Windows::Gaming::UI::GameBar::VisibilityChanged(param0);
            Py_RETURN_NONE;
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

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

    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 =
    {
        "_winsdk_Windows_Gaming_UI.GameBar",
        0,
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_GameBar
    };

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

    static PyType_Slot type_slots_GameBar_Meta[] = 
    {
        { Py_tp_base, reinterpret_cast<void*>(&PyType_Type) },
        { Py_tp_getset, reinterpret_cast<void*>(getset_GameBar_Meta) },
        { }
    };

    static PyType_Spec type_spec_GameBar_Meta =
    {
        "_winsdk_Windows_Gaming_UI.GameBar_Meta",
        static_cast<int>(PyType_Type.tp_basicsize),
        static_cast<int>(PyType_Type.tp_itemsize),
        Py_TPFLAGS_DEFAULT,
        type_slots_GameBar_Meta
    };

    // ----- GameChatMessageReceivedEventArgs class --------------------
    static constexpr const char* const type_name_GameChatMessageReceivedEventArgs = "GameChatMessageReceivedEventArgs";

    static PyObject* _new_GameChatMessageReceivedEventArgs(PyTypeObject* type, PyObject* args, PyObject* kwds) noexcept
    {
        py::set_invalid_activation_error(type_name_GameChatMessageReceivedEventArgs);
        return nullptr;
    }

    static void _dealloc_GameChatMessageReceivedEventArgs(py::wrapper::Windows::Gaming::UI::GameChatMessageReceivedEventArgs* self) noexcept
    {
        auto tp = Py_TYPE(self);

        if (PyType_IS_GC(tp))
        {
            PyObject_GC_UnTrack(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
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Gaming.UI.GameChatMessageReceivedEventArgs", L"AppDisplayName"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return nullptr;
        }

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

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

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

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

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

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

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

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

        try
        {
            return py::convert(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 =
    {
        "_winsdk_Windows_Gaming_UI.GameChatMessageReceivedEventArgs",
        sizeof(py::wrapper::Windows::Gaming::UI::GameChatMessageReceivedEventArgs),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_GameChatMessageReceivedEventArgs
    };

    // ----- GameChatOverlay class --------------------
    static constexpr const char* const type_name_GameChatOverlay = "GameChatOverlay";

    static PyObject* _new_GameChatOverlay(PyTypeObject* type, PyObject* args, PyObject* kwds) noexcept
    {
        py::set_invalid_activation_error(type_name_GameChatOverlay);
        return nullptr;
    }

    static void _dealloc_GameChatOverlay(py::wrapper::Windows::Gaming::UI::GameChatOverlay* self) noexcept
    {
        auto tp = Py_TYPE(self);

        if (PyType_IS_GC(tp))
        {
            PyObject_GC_UnTrack(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_Size(args);

        if (arg_count == 3)
        {
            if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Gaming.UI.GameChatOverlay", L"AddMessage", 3))
            {
                py::set_arg_count_version_error(3);
                return nullptr;
            }

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

                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_Size(args);

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

            try
            {
                return py::convert(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
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Gaming.UI.GameChatOverlay", L"DesiredPosition"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return nullptr;
        }

        try
        {
            return py::convert(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 (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Gaming.UI.GameChatOverlay", L"DesiredPosition"))
        {
            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::Gaming::UI::GameChatOverlayPosition>(arg);

            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 },
        { "get_default", reinterpret_cast<PyCFunction>(GameChatOverlay_GetDefault), METH_VARARGS | METH_STATIC, 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 =
    {
        "_winsdk_Windows_Gaming_UI.GameChatOverlay",
        sizeof(py::wrapper::Windows::Gaming::UI::GameChatOverlay),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_GameChatOverlay
    };

    // ----- GameChatOverlayMessageSource class --------------------
    static constexpr const char* const type_name_GameChatOverlayMessageSource = "GameChatOverlayMessageSource";

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

        auto arg_count = PyTuple_Size(args);
        if (arg_count == 0)
        {
            try
            {
                winrt::Windows::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);

        if (PyType_IS_GC(tp))
        {
            PyObject_GC_UnTrack(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_Size(args);

        if (arg_count == 1)
        {
            if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Gaming.UI.GameChatOverlayMessageSource", L"SetDelayBeforeClosingAfterMessageReceived", 1))
            {
                py::set_arg_count_version_error(1);
                return nullptr;
            }

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

                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
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsEventPresent(L"Windows.Gaming.UI.GameChatOverlayMessageSource", L"MessageReceived"))
        {
            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::Gaming::UI::GameChatOverlayMessageSource, winrt::Windows::Gaming::UI::GameChatMessageReceivedEventArgs>>(arg);

            return py::convert(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
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsEventPresent(L"Windows.Gaming.UI.GameChatOverlayMessageSource", L"MessageReceived"))
        {
            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.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 =
    {
        "_winsdk_Windows_Gaming_UI.GameChatOverlayMessageSource",
        sizeof(py::wrapper::Windows::Gaming::UI::GameChatOverlayMessageSource),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_GameChatOverlayMessageSource
    };

    // ----- GameUIProviderActivatedEventArgs class --------------------
    static constexpr const char* const type_name_GameUIProviderActivatedEventArgs = "GameUIProviderActivatedEventArgs";

    static PyObject* _new_GameUIProviderActivatedEventArgs(PyTypeObject* type, PyObject* args, PyObject* kwds) noexcept
    {
        py::set_invalid_activation_error(type_name_GameUIProviderActivatedEventArgs);
        return nullptr;
    }

    static void _dealloc_GameUIProviderActivatedEventArgs(py::wrapper::Windows::Gaming::UI::GameUIProviderActivatedEventArgs* self) noexcept
    {
        auto tp = Py_TYPE(self);

        if (PyType_IS_GC(tp))
        {
            PyObject_GC_UnTrack(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_Size(args);

        if (arg_count == 1)
        {
            if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Gaming.UI.GameUIProviderActivatedEventArgs", L"ReportCompleted", 1))
            {
                py::set_arg_count_version_error(1);
                return nullptr;
            }

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

                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
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Gaming.UI.GameUIProviderActivatedEventArgs", L"Kind"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return nullptr;
        }

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

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

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

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

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

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

        try
        {
            return py::convert(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_u_i_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 =
    {
        "_winsdk_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 PyMethodDef module_methods[] = {
        {"_register_GameChatMessageOrigin", register_GameChatMessageOrigin, METH_O, "registers type"},
        {"_register_GameChatOverlayPosition", register_GameChatOverlayPosition, METH_O, "registers type"},
        {}};


    static int module_traverse(PyObject* module, visitproc visit, void* arg) noexcept
    {
        auto state = reinterpret_cast<module_state*>(PyModule_GetState(module));

        if (!state)
        {
            return 0;
        }

        Py_VISIT(state->type_GameChatMessageOrigin);
        Py_VISIT(state->type_GameChatOverlayPosition);
        Py_VISIT(state->type_GameBar);
        Py_VISIT(state->type_GameChatMessageReceivedEventArgs);
        Py_VISIT(state->type_GameChatOverlay);
        Py_VISIT(state->type_GameChatOverlayMessageSource);
        Py_VISIT(state->type_GameUIProviderActivatedEventArgs);

        return 0;
    }

    static int module_clear(PyObject* module) noexcept
    {
        auto state = reinterpret_cast<module_state*>(PyModule_GetState(module));

        if (!state)
        {
            return 0;
        }

        Py_CLEAR(state->type_GameChatMessageOrigin);
        Py_CLEAR(state->type_GameChatOverlayPosition);
        Py_CLEAR(state->type_GameBar);
        Py_CLEAR(state->type_GameChatMessageReceivedEventArgs);
        Py_CLEAR(state->type_GameChatOverlay);
        Py_CLEAR(state->type_GameChatOverlayMessageSource);
        Py_CLEAR(state->type_GameUIProviderActivatedEventArgs);

        return 0;
    }


    static PyModuleDef module_def
        = {PyModuleDef_HEAD_INIT,
           "_winsdk_Windows_Gaming_UI",
           module_doc,
           sizeof(module_state),
           module_methods,
           nullptr,
           module_traverse,
           module_clear,
           nullptr};

} // py::cpp::Windows::Gaming::UI

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

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

    if (!module)
    {
        return nullptr;
    }

    auto object_type = py::get_python_type<py::Object>();
    if (!object_type)
    {
        return nullptr;
    }

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

    if (!bases)
    {
        return nullptr;
    }

    py::pyobj_handle collections_abc_module{PyImport_ImportModule("collections.abc")};

    if (!collections_abc_module)
    {
        return nullptr;
    }

    py::pyobj_handle sequence_type{PyObject_GetAttrString(collections_abc_module.get(), "Sequence")};

    if (!sequence_type)
    {
        return nullptr;
    }

    py::pyobj_handle sequence_bases{PyTuple_Pack(2, object_type, sequence_type.get())};

    if (!sequence_bases)
    {
        return nullptr;
    }

    py::pyobj_handle mutable_sequence_type{PyObject_GetAttrString(collections_abc_module.get(), "MutableSequence")};

    if (!mutable_sequence_type)
    {
        return nullptr;
    }

    py::pyobj_handle mutable_sequence_bases{PyTuple_Pack(2, object_type, mutable_sequence_type.get())};

    if (!mutable_sequence_bases)
    {
        return nullptr;
    }

    py::pyobj_handle mapping_type{PyObject_GetAttrString(collections_abc_module.get(), "Mapping")};

    if (!mapping_type)
    {
        return nullptr;
    }

    py::pyobj_handle mapping_bases{PyTuple_Pack(2, object_type, mapping_type.get())};

    if (!mapping_bases)
    {
        return nullptr;
    }

    py::pyobj_handle mutable_mapping_type{PyObject_GetAttrString(collections_abc_module.get(), "MutableMapping")};

    if (!mutable_mapping_type)
    {
        return nullptr;
    }

    py::pyobj_handle mutable_mapping_bases{PyTuple_Pack(2, object_type, mutable_mapping_type.get())};

    if (!mutable_mapping_bases)
    {
        return nullptr;
    }

    auto state = reinterpret_cast<module_state*>(PyModule_GetState(module.get()));
    assert(state);

    py::pyobj_handle type_GameBar_Meta{PyType_FromSpec(&type_spec_GameBar_Meta)};
    if (!type_GameBar_Meta)
    {
        return nullptr;
    }

    state->type_GameBar = py::register_python_type(module.get(), type_name_GameBar, &type_spec_GameBar, nullptr, reinterpret_cast<PyTypeObject*>(type_GameBar_Meta.get()));
    if (!state->type_GameBar)
    {
        return nullptr;
    }

    state->type_GameChatMessageReceivedEventArgs = py::register_python_type(module.get(), type_name_GameChatMessageReceivedEventArgs, &type_spec_GameChatMessageReceivedEventArgs, bases.get(), nullptr);
    if (!state->type_GameChatMessageReceivedEventArgs)
    {
        return nullptr;
    }

    state->type_GameChatOverlay = py::register_python_type(module.get(), type_name_GameChatOverlay, &type_spec_GameChatOverlay, bases.get(), nullptr);
    if (!state->type_GameChatOverlay)
    {
        return nullptr;
    }

    state->type_GameChatOverlayMessageSource = py::register_python_type(module.get(), type_name_GameChatOverlayMessageSource, &type_spec_GameChatOverlayMessageSource, bases.get(), nullptr);
    if (!state->type_GameChatOverlayMessageSource)
    {
        return nullptr;
    }

    state->type_GameUIProviderActivatedEventArgs = py::register_python_type(module.get(), type_name_GameUIProviderActivatedEventArgs, &type_spec_GameUIProviderActivatedEventArgs, bases.get(), nullptr);
    if (!state->type_GameUIProviderActivatedEventArgs)
    {
        return nullptr;
    }


    return module.detach();
}

PyObject* py::py_type<winrt::Windows::Gaming::UI::GameChatMessageOrigin>::get_python_type() noexcept {
    using namespace py::cpp::Windows::Gaming::UI;

    PyObject* module = PyState_FindModule(&module_def);

    if (!module) {
        PyErr_SetString(PyExc_RuntimeError, "could not find module for Windows::Gaming::UI");
        return nullptr;
    }

    auto state = reinterpret_cast<module_state*>(PyModule_GetState(module));
    assert(state);

    auto python_type = state->type_GameChatMessageOrigin;

    if (!python_type) {
        PyErr_SetString(PyExc_RuntimeError, "type winrt::Windows::Gaming::UI::GameChatMessageOrigin is not registered");
        return nullptr;
    }

    return python_type;
}

PyObject* py::py_type<winrt::Windows::Gaming::UI::GameChatOverlayPosition>::get_python_type() noexcept {
    using namespace py::cpp::Windows::Gaming::UI;

    PyObject* module = PyState_FindModule(&module_def);

    if (!module) {
        PyErr_SetString(PyExc_RuntimeError, "could not find module for Windows::Gaming::UI");
        return nullptr;
    }

    auto state = reinterpret_cast<module_state*>(PyModule_GetState(module));
    assert(state);

    auto python_type = state->type_GameChatOverlayPosition;

    if (!python_type) {
        PyErr_SetString(PyExc_RuntimeError, "type winrt::Windows::Gaming::UI::GameChatOverlayPosition is not registered");
        return nullptr;
    }

    return python_type;
}

PyTypeObject* py::winrt_type<winrt::Windows::Gaming::UI::GameBar>::get_python_type() noexcept {
    using namespace py::cpp::Windows::Gaming::UI;

    PyObject* module = PyState_FindModule(&module_def);

    if (!module) {
        PyErr_SetString(PyExc_RuntimeError, "could not find module for Windows::Gaming::UI");
        return nullptr;
    }

    auto state = reinterpret_cast<module_state*>(PyModule_GetState(module));
    assert(state);

    auto python_type = state->type_GameBar;

    if (!python_type) {
        PyErr_SetString(PyExc_RuntimeError, "type winrt::Windows::Gaming::UI::GameBar is not registered");
        return nullptr;
    }

    return python_type;
}

PyTypeObject* py::winrt_type<winrt::Windows::Gaming::UI::GameChatMessageReceivedEventArgs>::get_python_type() noexcept {
    using namespace py::cpp::Windows::Gaming::UI;

    PyObject* module = PyState_FindModule(&module_def);

    if (!module) {
        PyErr_SetString(PyExc_RuntimeError, "could not find module for Windows::Gaming::UI");
        return nullptr;
    }

    auto state = reinterpret_cast<module_state*>(PyModule_GetState(module));
    assert(state);

    auto python_type = state->type_GameChatMessageReceivedEventArgs;

    if (!python_type) {
        PyErr_SetString(PyExc_RuntimeError, "type winrt::Windows::Gaming::UI::GameChatMessageReceivedEventArgs is not registered");
        return nullptr;
    }

    return python_type;
}

PyTypeObject* py::winrt_type<winrt::Windows::Gaming::UI::GameChatOverlay>::get_python_type() noexcept {
    using namespace py::cpp::Windows::Gaming::UI;

    PyObject* module = PyState_FindModule(&module_def);

    if (!module) {
        PyErr_SetString(PyExc_RuntimeError, "could not find module for Windows::Gaming::UI");
        return nullptr;
    }

    auto state = reinterpret_cast<module_state*>(PyModule_GetState(module));
    assert(state);

    auto python_type = state->type_GameChatOverlay;

    if (!python_type) {
        PyErr_SetString(PyExc_RuntimeError, "type winrt::Windows::Gaming::UI::GameChatOverlay is not registered");
        return nullptr;
    }

    return python_type;
}

PyTypeObject* py::winrt_type<winrt::Windows::Gaming::UI::GameChatOverlayMessageSource>::get_python_type() noexcept {
    using namespace py::cpp::Windows::Gaming::UI;

    PyObject* module = PyState_FindModule(&module_def);

    if (!module) {
        PyErr_SetString(PyExc_RuntimeError, "could not find module for Windows::Gaming::UI");
        return nullptr;
    }

    auto state = reinterpret_cast<module_state*>(PyModule_GetState(module));
    assert(state);

    auto python_type = state->type_GameChatOverlayMessageSource;

    if (!python_type) {
        PyErr_SetString(PyExc_RuntimeError, "type winrt::Windows::Gaming::UI::GameChatOverlayMessageSource is not registered");
        return nullptr;
    }

    return python_type;
}

PyTypeObject* py::winrt_type<winrt::Windows::Gaming::UI::GameUIProviderActivatedEventArgs>::get_python_type() noexcept {
    using namespace py::cpp::Windows::Gaming::UI;

    PyObject* module = PyState_FindModule(&module_def);

    if (!module) {
        PyErr_SetString(PyExc_RuntimeError, "could not find module for Windows::Gaming::UI");
        return nullptr;
    }

    auto state = reinterpret_cast<module_state*>(PyModule_GetState(module));
    assert(state);

    auto python_type = state->type_GameUIProviderActivatedEventArgs;

    if (!python_type) {
        PyErr_SetString(PyExc_RuntimeError, "type winrt::Windows::Gaming::UI::GameUIProviderActivatedEventArgs is not registered");
        return nullptr;
    }

    return python_type;
}
