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

#include "py.Microsoft.UI.Xaml.Hosting.h"

namespace py::cpp::Microsoft::UI::Xaml::Hosting
{
    // ----- DesktopWindowXamlSource class --------------------

    struct PyWinrtDesktopWindowXamlSource;
    using BasePyWinrtDesktopWindowXamlSource = winrt::Microsoft::UI::Xaml::Hosting::DesktopWindowXamlSourceT<PyWinrtDesktopWindowXamlSource, py::IPywinrtObject>;

    struct PyWinrtDesktopWindowXamlSource : py::py_obj_ref, BasePyWinrtDesktopWindowXamlSource
    {
        PyWinrtDesktopWindowXamlSource(PyObject* py_obj) : py::py_obj_ref(py_obj), BasePyWinrtDesktopWindowXamlSource() {}

        int32_t __stdcall GetPyObject(PyObject*& obj) override
        {
            obj = py::py_obj_ref::get_py_obj();
            return 0;
        }

        int32_t __stdcall GetComposableInner(winrt::Windows::Foundation::IInspectable& inner) override
        {
            inner = m_inner;
            return winrt::impl::error_ok;
        }

        static void toggle_reference(PyWinrtDesktopWindowXamlSource* instance, bool is_last_reference)
        {
            py::py_obj_ref::toggle_reference(instance, is_last_reference);
        }

        int32_t query_interface_tearoff(winrt::guid const& id, void** result) const noexcept override
        {
            return py::py_obj_ref::query_interface_tearoff(id, result);
        }

        std::vector<winrt::guid> get_iids_tearoff() const noexcept override
        {
            return py::py_obj_ref::get_iids_tearoff();
        }
    };

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

        auto arg_count = PyTuple_GET_SIZE(args);

        auto self_type = get_python_type_for<winrt::Microsoft::UI::Xaml::Hosting::DesktopWindowXamlSource>();
        if (!self_type)
        {
            return nullptr;
        }

        if (arg_count == 0)
        {
            try
            {
                if (type != self_type)
                {
                    py::pyobj_handle self{type->tp_alloc(type, 0)};
                    if (!self)
                    {
                        return nullptr;
                    }

                    std::construct_at(&reinterpret_cast<py::winrt_wrapper<winrt::Windows::Foundation::IInspectable>*>(self.get())->obj, nullptr);

                    auto obj_impl = winrt::make_self<PyWinrtDesktopWindowXamlSource>(self.get());

                    auto obj = py::make_py_obj<PyWinrtDesktopWindowXamlSource>(obj_impl, type, self.get());
                    if (!obj)
                    {
                        return nullptr;
                    }

                    reinterpret_cast<py::winrt_wrapper<winrt::Windows::Foundation::IInspectable>*>(self.get())->obj = std::move(obj);

                    return self.detach();
                }

                winrt::Microsoft::UI::Xaml::Hosting::DesktopWindowXamlSource 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_DesktopWindowXamlSource(py::winrt_wrapper<winrt::Windows::Foundation::IInspectable>* self) noexcept
    {
        auto tp = Py_TYPE(self);
        std::destroy_at(&self->obj);
        tp->tp_free(self);
        Py_DECREF(tp);
    }

    static PyObject* DesktopWindowXamlSource_Close(py::winrt_wrapper<winrt::Windows::Foundation::IInspectable>* self, 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"Microsoft.UI.Xaml.Hosting.DesktopWindowXamlSource", L"Close", 0);
                }

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

                {
                    auto _gil = release_gil();
                    self->obj.try_as<winrt::Microsoft::UI::Xaml::Hosting::DesktopWindowXamlSource>().Close();
                }

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

    static PyObject* DesktopWindowXamlSource_Initialize(py::winrt_wrapper<winrt::Windows::Foundation::IInspectable>* 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"Microsoft.UI.Xaml.Hosting.DesktopWindowXamlSource", L"Initialize", 1);
                }

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

                auto param0 = py::convert_to<winrt::Microsoft::UI::WindowId>(args, 0);

                {
                    auto _gil = release_gil();
                    self->obj.try_as<winrt::Microsoft::UI::Xaml::Hosting::DesktopWindowXamlSource>().Initialize(param0);
                }

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

    static PyObject* DesktopWindowXamlSource_NavigateFocus(py::winrt_wrapper<winrt::Windows::Foundation::IInspectable>* 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"Microsoft.UI.Xaml.Hosting.DesktopWindowXamlSource", L"NavigateFocus", 1);
                }

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

                auto param0 = py::convert_to<winrt::Microsoft::UI::Xaml::Hosting::XamlSourceFocusNavigationRequest>(args, 0);

                return py::convert([&]()
                {
                    auto _gil = release_gil();
                    return self->obj.try_as<winrt::Microsoft::UI::Xaml::Hosting::DesktopWindowXamlSource>().NavigateFocus(param0);
                }());
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* DesktopWindowXamlSource_get_SystemBackdrop(py::winrt_wrapper<winrt::Windows::Foundation::IInspectable>* 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"Microsoft.UI.Xaml.Hosting.DesktopWindowXamlSource", L"SystemBackdrop");
            }

            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.try_as<winrt::Microsoft::UI::Xaml::Hosting::DesktopWindowXamlSource>().SystemBackdrop();
            }());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static int DesktopWindowXamlSource_put_SystemBackdrop(py::winrt_wrapper<winrt::Windows::Foundation::IInspectable>* 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"Microsoft.UI.Xaml.Hosting.DesktopWindowXamlSource", L"SystemBackdrop");
            }

            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::Microsoft::UI::Xaml::Media::SystemBackdrop>(arg);

            {
                auto _gil = release_gil();
                self->obj.try_as<winrt::Microsoft::UI::Xaml::Hosting::DesktopWindowXamlSource>().SystemBackdrop(param0);
            }

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

    static PyObject* DesktopWindowXamlSource_get_Content(py::winrt_wrapper<winrt::Windows::Foundation::IInspectable>* 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"Microsoft.UI.Xaml.Hosting.DesktopWindowXamlSource", L"Content");
            }

            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.try_as<winrt::Microsoft::UI::Xaml::Hosting::DesktopWindowXamlSource>().Content();
            }());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static int DesktopWindowXamlSource_put_Content(py::winrt_wrapper<winrt::Windows::Foundation::IInspectable>* 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"Microsoft.UI.Xaml.Hosting.DesktopWindowXamlSource", L"Content");
            }

            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::Microsoft::UI::Xaml::UIElement>(arg);

            {
                auto _gil = release_gil();
                self->obj.try_as<winrt::Microsoft::UI::Xaml::Hosting::DesktopWindowXamlSource>().Content(param0);
            }

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

    static PyObject* DesktopWindowXamlSource_get_HasFocus(py::winrt_wrapper<winrt::Windows::Foundation::IInspectable>* 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"Microsoft.UI.Xaml.Hosting.DesktopWindowXamlSource", L"HasFocus");
            }

            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.try_as<winrt::Microsoft::UI::Xaml::Hosting::DesktopWindowXamlSource>().HasFocus();
            }());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* DesktopWindowXamlSource_get_SiteBridge(py::winrt_wrapper<winrt::Windows::Foundation::IInspectable>* 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"Microsoft.UI.Xaml.Hosting.DesktopWindowXamlSource", L"SiteBridge");
            }

            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.try_as<winrt::Microsoft::UI::Xaml::Hosting::DesktopWindowXamlSource>().SiteBridge();
            }());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* DesktopWindowXamlSource_get_ShouldConstrainPopupsToWorkArea(py::winrt_wrapper<winrt::Windows::Foundation::IInspectable>* 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"Microsoft.UI.Xaml.Hosting.DesktopWindowXamlSource", L"ShouldConstrainPopupsToWorkArea");
            }

            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.try_as<winrt::Microsoft::UI::Xaml::Hosting::DesktopWindowXamlSource>().ShouldConstrainPopupsToWorkArea();
            }());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static int DesktopWindowXamlSource_put_ShouldConstrainPopupsToWorkArea(py::winrt_wrapper<winrt::Windows::Foundation::IInspectable>* 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"Microsoft.UI.Xaml.Hosting.DesktopWindowXamlSource", L"ShouldConstrainPopupsToWorkArea");
            }

            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<bool>(arg);

            {
                auto _gil = release_gil();
                self->obj.try_as<winrt::Microsoft::UI::Xaml::Hosting::DesktopWindowXamlSource>().ShouldConstrainPopupsToWorkArea(param0);
            }

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

    static PyObject* DesktopWindowXamlSource_add_GotFocus(py::winrt_wrapper<winrt::Windows::Foundation::IInspectable>* 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"Microsoft.UI.Xaml.Hosting.DesktopWindowXamlSource", L"GotFocus");
            }

            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::Microsoft::UI::Xaml::Hosting::DesktopWindowXamlSource, winrt::Microsoft::UI::Xaml::Hosting::DesktopWindowXamlSourceGotFocusEventArgs>>(arg);

            return py::convert([&]()
            {
                auto _gil = release_gil();
                return self->obj.try_as<winrt::Microsoft::UI::Xaml::Hosting::DesktopWindowXamlSource>().GotFocus(param0);
            }());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* DesktopWindowXamlSource_remove_GotFocus(py::winrt_wrapper<winrt::Windows::Foundation::IInspectable>* 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"Microsoft.UI.Xaml.Hosting.DesktopWindowXamlSource", L"GotFocus");
            }

            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.try_as<winrt::Microsoft::UI::Xaml::Hosting::DesktopWindowXamlSource>().GotFocus(param0);
            }

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

    static PyObject* DesktopWindowXamlSource_add_TakeFocusRequested(py::winrt_wrapper<winrt::Windows::Foundation::IInspectable>* 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"Microsoft.UI.Xaml.Hosting.DesktopWindowXamlSource", L"TakeFocusRequested");
            }

            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::Microsoft::UI::Xaml::Hosting::DesktopWindowXamlSource, winrt::Microsoft::UI::Xaml::Hosting::DesktopWindowXamlSourceTakeFocusRequestedEventArgs>>(arg);

            return py::convert([&]()
            {
                auto _gil = release_gil();
                return self->obj.try_as<winrt::Microsoft::UI::Xaml::Hosting::DesktopWindowXamlSource>().TakeFocusRequested(param0);
            }());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* DesktopWindowXamlSource_remove_TakeFocusRequested(py::winrt_wrapper<winrt::Windows::Foundation::IInspectable>* 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"Microsoft.UI.Xaml.Hosting.DesktopWindowXamlSource", L"TakeFocusRequested");
            }

            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.try_as<winrt::Microsoft::UI::Xaml::Hosting::DesktopWindowXamlSource>().TakeFocusRequested(param0);
            }

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

    static PyObject* _assign_array_DesktopWindowXamlSource(PyObject* /*unused*/, PyObject* arg) noexcept
    {
        auto array = std::make_unique<py::ComArray<winrt::Microsoft::UI::Xaml::Hosting::DesktopWindowXamlSource>>();
        if (!py::cpp::_winrt::Array_Assign(arg, std::move(array)))
        {
            return nullptr;
        }
        Py_RETURN_NONE;
    }

    static PyObject* _from_DesktopWindowXamlSource(PyObject* /*unused*/, PyObject* arg) noexcept
    {
        try
        {
            auto return_value = py::convert_to<winrt::Windows::Foundation::IInspectable>(arg);
            return py::convert(return_value.as<winrt::Microsoft::UI::Xaml::Hosting::DesktopWindowXamlSource>());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* _enter_DesktopWindowXamlSource(py::winrt_wrapper<winrt::Windows::Foundation::IInspectable>* self, PyObject* /*unused*/) noexcept
    {
        return Py_NewRef(self);
    }

    static PyObject* _exit_DesktopWindowXamlSource(py::winrt_wrapper<winrt::Windows::Foundation::IInspectable>* self, PyObject* /*unused*/) noexcept
    {
        try
        {
            {
                auto _gil = py::release_gil();
                self->obj.try_as<winrt::Microsoft::UI::Xaml::Hosting::DesktopWindowXamlSource>().Close();
            }

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

    static PyMethodDef _methods_DesktopWindowXamlSource[] = {
        { "close", reinterpret_cast<PyCFunction>(DesktopWindowXamlSource_Close), METH_VARARGS, nullptr },
        { "initialize", reinterpret_cast<PyCFunction>(DesktopWindowXamlSource_Initialize), METH_VARARGS, nullptr },
        { "navigate_focus", reinterpret_cast<PyCFunction>(DesktopWindowXamlSource_NavigateFocus), METH_VARARGS, nullptr },
        { "add_got_focus", reinterpret_cast<PyCFunction>(DesktopWindowXamlSource_add_GotFocus), METH_O, nullptr },
        { "remove_got_focus", reinterpret_cast<PyCFunction>(DesktopWindowXamlSource_remove_GotFocus), METH_O, nullptr },
        { "add_take_focus_requested", reinterpret_cast<PyCFunction>(DesktopWindowXamlSource_add_TakeFocusRequested), METH_O, nullptr },
        { "remove_take_focus_requested", reinterpret_cast<PyCFunction>(DesktopWindowXamlSource_remove_TakeFocusRequested), METH_O, nullptr },
        { "_assign_array_", _assign_array_DesktopWindowXamlSource, METH_O | METH_STATIC, nullptr },
        { "_from", reinterpret_cast<PyCFunction>(_from_DesktopWindowXamlSource), METH_O | METH_STATIC, nullptr },
        { "__enter__", reinterpret_cast<PyCFunction>(_enter_DesktopWindowXamlSource), METH_NOARGS, nullptr },
        { "__exit__", reinterpret_cast<PyCFunction>(_exit_DesktopWindowXamlSource), METH_VARARGS, nullptr },
        { }};

    static PyGetSetDef _getset_DesktopWindowXamlSource[] = {
        { "system_backdrop", reinterpret_cast<getter>(DesktopWindowXamlSource_get_SystemBackdrop), reinterpret_cast<setter>(DesktopWindowXamlSource_put_SystemBackdrop), nullptr, nullptr },
        { "content", reinterpret_cast<getter>(DesktopWindowXamlSource_get_Content), reinterpret_cast<setter>(DesktopWindowXamlSource_put_Content), nullptr, nullptr },
        { "has_focus", reinterpret_cast<getter>(DesktopWindowXamlSource_get_HasFocus), nullptr, nullptr, nullptr },
        { "site_bridge", reinterpret_cast<getter>(DesktopWindowXamlSource_get_SiteBridge), nullptr, nullptr, nullptr },
        { "should_constrain_popups_to_work_area", reinterpret_cast<getter>(DesktopWindowXamlSource_get_ShouldConstrainPopupsToWorkArea), reinterpret_cast<setter>(DesktopWindowXamlSource_put_ShouldConstrainPopupsToWorkArea), nullptr, nullptr },
        { }};

    static PyType_Slot _type_slots_DesktopWindowXamlSource[] = {
        { Py_tp_new, reinterpret_cast<void*>(_new_DesktopWindowXamlSource) },
        { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_DesktopWindowXamlSource) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_DesktopWindowXamlSource) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_DesktopWindowXamlSource) },
        { }};

    static PyType_Spec type_spec_DesktopWindowXamlSource = {
        "winui3._winui3_microsoft_ui_xaml_hosting.DesktopWindowXamlSource",
        sizeof(py::winrt_wrapper<winrt::Windows::Foundation::IInspectable>),
        0,
        Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
        _type_slots_DesktopWindowXamlSource};

    static PyGetSetDef getset_DesktopWindowXamlSource_Static[] = {
        { }};

    static PyMethodDef methods_DesktopWindowXamlSource_Static[] = {
        { }};

    static PyType_Slot type_slots_DesktopWindowXamlSource_Static[] = 
    {
        { Py_tp_base, reinterpret_cast<void*>(&PyType_Type) },
        { Py_tp_getset, reinterpret_cast<void*>(getset_DesktopWindowXamlSource_Static) },
        { Py_tp_methods, reinterpret_cast<void*>(methods_DesktopWindowXamlSource_Static) },
        { }
    };

    static PyType_Spec type_spec_DesktopWindowXamlSource_Static = {
        "winui3._winui3_microsoft_ui_xaml_hosting.DesktopWindowXamlSource_Static",
        static_cast<int>(PyType_Type.tp_basicsize),
        static_cast<int>(PyType_Type.tp_itemsize),
        Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
        type_slots_DesktopWindowXamlSource_Static};

    // ----- DesktopWindowXamlSourceGotFocusEventArgs class --------------------

    static PyObject* _new_DesktopWindowXamlSourceGotFocusEventArgs(PyTypeObject* /*unused*/, PyObject* /*unused*/, PyObject* /*unused*/) noexcept
    {
        static_assert(py::py_type<winrt::Microsoft::UI::Xaml::Hosting::DesktopWindowXamlSourceGotFocusEventArgs>::type_name);
        py::set_invalid_activation_error(py::py_type<winrt::Microsoft::UI::Xaml::Hosting::DesktopWindowXamlSourceGotFocusEventArgs>::type_name);
        return nullptr;
    }

    static void _dealloc_DesktopWindowXamlSourceGotFocusEventArgs(py::wrapper::Microsoft::UI::Xaml::Hosting::DesktopWindowXamlSourceGotFocusEventArgs* self) noexcept
    {
        auto tp = Py_TYPE(self);
        std::destroy_at(&self->obj);
        tp->tp_free(self);
        Py_DECREF(tp);
    }

    static PyObject* DesktopWindowXamlSourceGotFocusEventArgs_get_Request(py::wrapper::Microsoft::UI::Xaml::Hosting::DesktopWindowXamlSourceGotFocusEventArgs* 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"Microsoft.UI.Xaml.Hosting.DesktopWindowXamlSourceGotFocusEventArgs", L"Request");
            }

            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.Request();
            }());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* _assign_array_DesktopWindowXamlSourceGotFocusEventArgs(PyObject* /*unused*/, PyObject* arg) noexcept
    {
        auto array = std::make_unique<py::ComArray<winrt::Microsoft::UI::Xaml::Hosting::DesktopWindowXamlSourceGotFocusEventArgs>>();
        if (!py::cpp::_winrt::Array_Assign(arg, std::move(array)))
        {
            return nullptr;
        }
        Py_RETURN_NONE;
    }

    static PyObject* _from_DesktopWindowXamlSourceGotFocusEventArgs(PyObject* /*unused*/, PyObject* arg) noexcept
    {
        try
        {
            auto return_value = py::convert_to<winrt::Windows::Foundation::IInspectable>(arg);
            return py::convert(return_value.as<winrt::Microsoft::UI::Xaml::Hosting::DesktopWindowXamlSourceGotFocusEventArgs>());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyMethodDef _methods_DesktopWindowXamlSourceGotFocusEventArgs[] = {
        { "_assign_array_", _assign_array_DesktopWindowXamlSourceGotFocusEventArgs, METH_O | METH_STATIC, nullptr },
        { "_from", reinterpret_cast<PyCFunction>(_from_DesktopWindowXamlSourceGotFocusEventArgs), METH_O | METH_STATIC, nullptr },
        { }};

    static PyGetSetDef _getset_DesktopWindowXamlSourceGotFocusEventArgs[] = {
        { "request", reinterpret_cast<getter>(DesktopWindowXamlSourceGotFocusEventArgs_get_Request), nullptr, nullptr, nullptr },
        { }};

    static PyType_Slot _type_slots_DesktopWindowXamlSourceGotFocusEventArgs[] = {
        { Py_tp_new, reinterpret_cast<void*>(_new_DesktopWindowXamlSourceGotFocusEventArgs) },
        { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_DesktopWindowXamlSourceGotFocusEventArgs) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_DesktopWindowXamlSourceGotFocusEventArgs) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_DesktopWindowXamlSourceGotFocusEventArgs) },
        { }};

    static PyType_Spec type_spec_DesktopWindowXamlSourceGotFocusEventArgs = {
        "winui3._winui3_microsoft_ui_xaml_hosting.DesktopWindowXamlSourceGotFocusEventArgs",
        sizeof(py::wrapper::Microsoft::UI::Xaml::Hosting::DesktopWindowXamlSourceGotFocusEventArgs),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_DesktopWindowXamlSourceGotFocusEventArgs};

    // ----- DesktopWindowXamlSourceTakeFocusRequestedEventArgs class --------------------

    static PyObject* _new_DesktopWindowXamlSourceTakeFocusRequestedEventArgs(PyTypeObject* /*unused*/, PyObject* /*unused*/, PyObject* /*unused*/) noexcept
    {
        static_assert(py::py_type<winrt::Microsoft::UI::Xaml::Hosting::DesktopWindowXamlSourceTakeFocusRequestedEventArgs>::type_name);
        py::set_invalid_activation_error(py::py_type<winrt::Microsoft::UI::Xaml::Hosting::DesktopWindowXamlSourceTakeFocusRequestedEventArgs>::type_name);
        return nullptr;
    }

    static void _dealloc_DesktopWindowXamlSourceTakeFocusRequestedEventArgs(py::wrapper::Microsoft::UI::Xaml::Hosting::DesktopWindowXamlSourceTakeFocusRequestedEventArgs* self) noexcept
    {
        auto tp = Py_TYPE(self);
        std::destroy_at(&self->obj);
        tp->tp_free(self);
        Py_DECREF(tp);
    }

    static PyObject* DesktopWindowXamlSourceTakeFocusRequestedEventArgs_get_Request(py::wrapper::Microsoft::UI::Xaml::Hosting::DesktopWindowXamlSourceTakeFocusRequestedEventArgs* 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"Microsoft.UI.Xaml.Hosting.DesktopWindowXamlSourceTakeFocusRequestedEventArgs", L"Request");
            }

            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.Request();
            }());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* _assign_array_DesktopWindowXamlSourceTakeFocusRequestedEventArgs(PyObject* /*unused*/, PyObject* arg) noexcept
    {
        auto array = std::make_unique<py::ComArray<winrt::Microsoft::UI::Xaml::Hosting::DesktopWindowXamlSourceTakeFocusRequestedEventArgs>>();
        if (!py::cpp::_winrt::Array_Assign(arg, std::move(array)))
        {
            return nullptr;
        }
        Py_RETURN_NONE;
    }

    static PyObject* _from_DesktopWindowXamlSourceTakeFocusRequestedEventArgs(PyObject* /*unused*/, PyObject* arg) noexcept
    {
        try
        {
            auto return_value = py::convert_to<winrt::Windows::Foundation::IInspectable>(arg);
            return py::convert(return_value.as<winrt::Microsoft::UI::Xaml::Hosting::DesktopWindowXamlSourceTakeFocusRequestedEventArgs>());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyMethodDef _methods_DesktopWindowXamlSourceTakeFocusRequestedEventArgs[] = {
        { "_assign_array_", _assign_array_DesktopWindowXamlSourceTakeFocusRequestedEventArgs, METH_O | METH_STATIC, nullptr },
        { "_from", reinterpret_cast<PyCFunction>(_from_DesktopWindowXamlSourceTakeFocusRequestedEventArgs), METH_O | METH_STATIC, nullptr },
        { }};

    static PyGetSetDef _getset_DesktopWindowXamlSourceTakeFocusRequestedEventArgs[] = {
        { "request", reinterpret_cast<getter>(DesktopWindowXamlSourceTakeFocusRequestedEventArgs_get_Request), nullptr, nullptr, nullptr },
        { }};

    static PyType_Slot _type_slots_DesktopWindowXamlSourceTakeFocusRequestedEventArgs[] = {
        { Py_tp_new, reinterpret_cast<void*>(_new_DesktopWindowXamlSourceTakeFocusRequestedEventArgs) },
        { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_DesktopWindowXamlSourceTakeFocusRequestedEventArgs) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_DesktopWindowXamlSourceTakeFocusRequestedEventArgs) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_DesktopWindowXamlSourceTakeFocusRequestedEventArgs) },
        { }};

    static PyType_Spec type_spec_DesktopWindowXamlSourceTakeFocusRequestedEventArgs = {
        "winui3._winui3_microsoft_ui_xaml_hosting.DesktopWindowXamlSourceTakeFocusRequestedEventArgs",
        sizeof(py::wrapper::Microsoft::UI::Xaml::Hosting::DesktopWindowXamlSourceTakeFocusRequestedEventArgs),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_DesktopWindowXamlSourceTakeFocusRequestedEventArgs};

    // ----- ElementCompositionPreview class --------------------

    static PyObject* _new_ElementCompositionPreview(PyTypeObject* /*unused*/, PyObject* /*unused*/, PyObject* /*unused*/) noexcept
    {
        static_assert(py::py_type<winrt::Microsoft::UI::Xaml::Hosting::ElementCompositionPreview>::type_name);
        py::set_invalid_activation_error(py::py_type<winrt::Microsoft::UI::Xaml::Hosting::ElementCompositionPreview>::type_name);
        return nullptr;
    }

    static void _dealloc_ElementCompositionPreview(py::wrapper::Microsoft::UI::Xaml::Hosting::ElementCompositionPreview* self) noexcept
    {
        auto tp = Py_TYPE(self);
        std::destroy_at(&self->obj);
        tp->tp_free(self);
        Py_DECREF(tp);
    }

    static PyObject* ElementCompositionPreview_GetElementChildVisual(PyObject* /*unused*/, 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"Microsoft.UI.Xaml.Hosting.ElementCompositionPreview", L"GetElementChildVisual", 1);
                }

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

                auto param0 = py::convert_to<winrt::Microsoft::UI::Xaml::UIElement>(args, 0);

                return py::convert([&]()
                {
                    auto _gil = release_gil();
                    return winrt::Microsoft::UI::Xaml::Hosting::ElementCompositionPreview::GetElementChildVisual(param0);
                }());
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* ElementCompositionPreview_GetElementVisual(PyObject* /*unused*/, 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"Microsoft.UI.Xaml.Hosting.ElementCompositionPreview", L"GetElementVisual", 1);
                }

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

                auto param0 = py::convert_to<winrt::Microsoft::UI::Xaml::UIElement>(args, 0);

                return py::convert([&]()
                {
                    auto _gil = release_gil();
                    return winrt::Microsoft::UI::Xaml::Hosting::ElementCompositionPreview::GetElementVisual(param0);
                }());
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* ElementCompositionPreview_GetPointerPositionPropertySet(PyObject* /*unused*/, 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"Microsoft.UI.Xaml.Hosting.ElementCompositionPreview", L"GetPointerPositionPropertySet", 1);
                }

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

                auto param0 = py::convert_to<winrt::Microsoft::UI::Xaml::UIElement>(args, 0);

                return py::convert([&]()
                {
                    auto _gil = release_gil();
                    return winrt::Microsoft::UI::Xaml::Hosting::ElementCompositionPreview::GetPointerPositionPropertySet(param0);
                }());
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* ElementCompositionPreview_GetScrollViewerManipulationPropertySet(PyObject* /*unused*/, 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"Microsoft.UI.Xaml.Hosting.ElementCompositionPreview", L"GetScrollViewerManipulationPropertySet", 1);
                }

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

                auto param0 = py::convert_to<winrt::Microsoft::UI::Xaml::Controls::ScrollViewer>(args, 0);

                return py::convert([&]()
                {
                    auto _gil = release_gil();
                    return winrt::Microsoft::UI::Xaml::Hosting::ElementCompositionPreview::GetScrollViewerManipulationPropertySet(param0);
                }());
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

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

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

                if (!is_overload_present.has_value())
                {
                    is_overload_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Microsoft.UI.Xaml.Hosting.ElementCompositionPreview", L"SetElementChildVisual", 2);
                }

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

                auto param0 = py::convert_to<winrt::Microsoft::UI::Xaml::UIElement>(args, 0);
                auto param1 = py::convert_to<winrt::Microsoft::UI::Composition::Visual>(args, 1);

                {
                    auto _gil = release_gil();
                    winrt::Microsoft::UI::Xaml::Hosting::ElementCompositionPreview::SetElementChildVisual(param0, param1);
                }

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

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

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

                if (!is_overload_present.has_value())
                {
                    is_overload_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Microsoft.UI.Xaml.Hosting.ElementCompositionPreview", L"SetImplicitHideAnimation", 2);
                }

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

                auto param0 = py::convert_to<winrt::Microsoft::UI::Xaml::UIElement>(args, 0);
                auto param1 = py::convert_to<winrt::Microsoft::UI::Composition::ICompositionAnimationBase>(args, 1);

                {
                    auto _gil = release_gil();
                    winrt::Microsoft::UI::Xaml::Hosting::ElementCompositionPreview::SetImplicitHideAnimation(param0, param1);
                }

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

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

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

                if (!is_overload_present.has_value())
                {
                    is_overload_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Microsoft.UI.Xaml.Hosting.ElementCompositionPreview", L"SetImplicitShowAnimation", 2);
                }

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

                auto param0 = py::convert_to<winrt::Microsoft::UI::Xaml::UIElement>(args, 0);
                auto param1 = py::convert_to<winrt::Microsoft::UI::Composition::ICompositionAnimationBase>(args, 1);

                {
                    auto _gil = release_gil();
                    winrt::Microsoft::UI::Xaml::Hosting::ElementCompositionPreview::SetImplicitShowAnimation(param0, param1);
                }

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

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

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

                if (!is_overload_present.has_value())
                {
                    is_overload_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Microsoft.UI.Xaml.Hosting.ElementCompositionPreview", L"SetIsTranslationEnabled", 2);
                }

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

                auto param0 = py::convert_to<winrt::Microsoft::UI::Xaml::UIElement>(args, 0);
                auto param1 = py::convert_to<bool>(args, 1);

                {
                    auto _gil = release_gil();
                    winrt::Microsoft::UI::Xaml::Hosting::ElementCompositionPreview::SetIsTranslationEnabled(param0, param1);
                }

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

    static PyObject* _assign_array_ElementCompositionPreview(PyObject* /*unused*/, PyObject* arg) noexcept
    {
        auto array = std::make_unique<py::ComArray<winrt::Microsoft::UI::Xaml::Hosting::ElementCompositionPreview>>();
        if (!py::cpp::_winrt::Array_Assign(arg, std::move(array)))
        {
            return nullptr;
        }
        Py_RETURN_NONE;
    }

    static PyObject* _from_ElementCompositionPreview(PyObject* /*unused*/, PyObject* arg) noexcept
    {
        try
        {
            auto return_value = py::convert_to<winrt::Windows::Foundation::IInspectable>(arg);
            return py::convert(return_value.as<winrt::Microsoft::UI::Xaml::Hosting::ElementCompositionPreview>());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyMethodDef _methods_ElementCompositionPreview[] = {
        { "_assign_array_", _assign_array_ElementCompositionPreview, METH_O | METH_STATIC, nullptr },
        { "_from", reinterpret_cast<PyCFunction>(_from_ElementCompositionPreview), METH_O | METH_STATIC, nullptr },
        { }};

    static PyGetSetDef _getset_ElementCompositionPreview[] = {
        { }};

    static PyType_Slot _type_slots_ElementCompositionPreview[] = {
        { Py_tp_new, reinterpret_cast<void*>(_new_ElementCompositionPreview) },
        { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_ElementCompositionPreview) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_ElementCompositionPreview) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_ElementCompositionPreview) },
        { }};

    static PyType_Spec type_spec_ElementCompositionPreview = {
        "winui3._winui3_microsoft_ui_xaml_hosting.ElementCompositionPreview",
        sizeof(py::wrapper::Microsoft::UI::Xaml::Hosting::ElementCompositionPreview),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_ElementCompositionPreview};

    static PyGetSetDef getset_ElementCompositionPreview_Static[] = {
        { }};

    static PyMethodDef methods_ElementCompositionPreview_Static[] = {
        { "get_element_child_visual", reinterpret_cast<PyCFunction>(ElementCompositionPreview_GetElementChildVisual), METH_VARARGS, nullptr },
        { "get_element_visual", reinterpret_cast<PyCFunction>(ElementCompositionPreview_GetElementVisual), METH_VARARGS, nullptr },
        { "get_pointer_position_property_set", reinterpret_cast<PyCFunction>(ElementCompositionPreview_GetPointerPositionPropertySet), METH_VARARGS, nullptr },
        { "get_scroll_viewer_manipulation_property_set", reinterpret_cast<PyCFunction>(ElementCompositionPreview_GetScrollViewerManipulationPropertySet), METH_VARARGS, nullptr },
        { "set_element_child_visual", reinterpret_cast<PyCFunction>(ElementCompositionPreview_SetElementChildVisual), METH_VARARGS, nullptr },
        { "set_implicit_hide_animation", reinterpret_cast<PyCFunction>(ElementCompositionPreview_SetImplicitHideAnimation), METH_VARARGS, nullptr },
        { "set_implicit_show_animation", reinterpret_cast<PyCFunction>(ElementCompositionPreview_SetImplicitShowAnimation), METH_VARARGS, nullptr },
        { "set_is_translation_enabled", reinterpret_cast<PyCFunction>(ElementCompositionPreview_SetIsTranslationEnabled), METH_VARARGS, nullptr },
        { }};

    static PyType_Slot type_slots_ElementCompositionPreview_Static[] = 
    {
        { Py_tp_base, reinterpret_cast<void*>(&PyType_Type) },
        { Py_tp_getset, reinterpret_cast<void*>(getset_ElementCompositionPreview_Static) },
        { Py_tp_methods, reinterpret_cast<void*>(methods_ElementCompositionPreview_Static) },
        { }
    };

    static PyType_Spec type_spec_ElementCompositionPreview_Static = {
        "winui3._winui3_microsoft_ui_xaml_hosting.ElementCompositionPreview_Static",
        static_cast<int>(PyType_Type.tp_basicsize),
        static_cast<int>(PyType_Type.tp_itemsize),
        Py_TPFLAGS_DEFAULT,
        type_slots_ElementCompositionPreview_Static};

    // ----- WindowsXamlManager class --------------------

    static PyObject* _new_WindowsXamlManager(PyTypeObject* /*unused*/, PyObject* /*unused*/, PyObject* /*unused*/) noexcept
    {
        static_assert(py::py_type<winrt::Microsoft::UI::Xaml::Hosting::WindowsXamlManager>::type_name);
        py::set_invalid_activation_error(py::py_type<winrt::Microsoft::UI::Xaml::Hosting::WindowsXamlManager>::type_name);
        return nullptr;
    }

    static void _dealloc_WindowsXamlManager(py::wrapper::Microsoft::UI::Xaml::Hosting::WindowsXamlManager* self) noexcept
    {
        auto tp = Py_TYPE(self);
        std::destroy_at(&self->obj);
        tp->tp_free(self);
        Py_DECREF(tp);
    }

    static PyObject* WindowsXamlManager_Close(py::wrapper::Microsoft::UI::Xaml::Hosting::WindowsXamlManager* self, 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"Microsoft.UI.Xaml.Hosting.WindowsXamlManager", L"Close", 0);
                }

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

                {
                    auto _gil = release_gil();
                    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* WindowsXamlManager_GetForCurrentThread(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"Microsoft.UI.Xaml.Hosting.WindowsXamlManager", L"GetForCurrentThread", 0);
                }

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

                return py::convert([&]()
                {
                    auto _gil = release_gil();
                    return winrt::Microsoft::UI::Xaml::Hosting::WindowsXamlManager::GetForCurrentThread();
                }());
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* WindowsXamlManager_InitializeForCurrentThread(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"Microsoft.UI.Xaml.Hosting.WindowsXamlManager", L"InitializeForCurrentThread", 0);
                }

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

                return py::convert([&]()
                {
                    auto _gil = release_gil();
                    return winrt::Microsoft::UI::Xaml::Hosting::WindowsXamlManager::InitializeForCurrentThread();
                }());
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* WindowsXamlManager_add_XamlShutdownCompletedOnThread(py::wrapper::Microsoft::UI::Xaml::Hosting::WindowsXamlManager* 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"Microsoft.UI.Xaml.Hosting.WindowsXamlManager", L"XamlShutdownCompletedOnThread");
            }

            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::Microsoft::UI::Xaml::Hosting::WindowsXamlManager, winrt::Microsoft::UI::Xaml::Hosting::XamlShutdownCompletedOnThreadEventArgs>>(arg);

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

    static PyObject* WindowsXamlManager_remove_XamlShutdownCompletedOnThread(py::wrapper::Microsoft::UI::Xaml::Hosting::WindowsXamlManager* 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"Microsoft.UI.Xaml.Hosting.WindowsXamlManager", L"XamlShutdownCompletedOnThread");
            }

            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.XamlShutdownCompletedOnThread(param0);
            }

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

    static PyObject* _assign_array_WindowsXamlManager(PyObject* /*unused*/, PyObject* arg) noexcept
    {
        auto array = std::make_unique<py::ComArray<winrt::Microsoft::UI::Xaml::Hosting::WindowsXamlManager>>();
        if (!py::cpp::_winrt::Array_Assign(arg, std::move(array)))
        {
            return nullptr;
        }
        Py_RETURN_NONE;
    }

    static PyObject* _from_WindowsXamlManager(PyObject* /*unused*/, PyObject* arg) noexcept
    {
        try
        {
            auto return_value = py::convert_to<winrt::Windows::Foundation::IInspectable>(arg);
            return py::convert(return_value.as<winrt::Microsoft::UI::Xaml::Hosting::WindowsXamlManager>());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* _enter_WindowsXamlManager(py::wrapper::Microsoft::UI::Xaml::Hosting::WindowsXamlManager* self, PyObject* /*unused*/) noexcept
    {
        return Py_NewRef(self);
    }

    static PyObject* _exit_WindowsXamlManager(py::wrapper::Microsoft::UI::Xaml::Hosting::WindowsXamlManager* self, PyObject* /*unused*/) noexcept
    {
        try
        {
            {
                auto _gil = py::release_gil();
                self->obj.Close();
            }

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

    static PyMethodDef _methods_WindowsXamlManager[] = {
        { "close", reinterpret_cast<PyCFunction>(WindowsXamlManager_Close), METH_VARARGS, nullptr },
        { "add_xaml_shutdown_completed_on_thread", reinterpret_cast<PyCFunction>(WindowsXamlManager_add_XamlShutdownCompletedOnThread), METH_O, nullptr },
        { "remove_xaml_shutdown_completed_on_thread", reinterpret_cast<PyCFunction>(WindowsXamlManager_remove_XamlShutdownCompletedOnThread), METH_O, nullptr },
        { "_assign_array_", _assign_array_WindowsXamlManager, METH_O | METH_STATIC, nullptr },
        { "_from", reinterpret_cast<PyCFunction>(_from_WindowsXamlManager), METH_O | METH_STATIC, nullptr },
        { "__enter__", reinterpret_cast<PyCFunction>(_enter_WindowsXamlManager), METH_NOARGS, nullptr },
        { "__exit__", reinterpret_cast<PyCFunction>(_exit_WindowsXamlManager), METH_VARARGS, nullptr },
        { }};

    static PyGetSetDef _getset_WindowsXamlManager[] = {
        { }};

    static PyType_Slot _type_slots_WindowsXamlManager[] = {
        { Py_tp_new, reinterpret_cast<void*>(_new_WindowsXamlManager) },
        { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_WindowsXamlManager) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_WindowsXamlManager) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_WindowsXamlManager) },
        { }};

    static PyType_Spec type_spec_WindowsXamlManager = {
        "winui3._winui3_microsoft_ui_xaml_hosting.WindowsXamlManager",
        sizeof(py::wrapper::Microsoft::UI::Xaml::Hosting::WindowsXamlManager),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_WindowsXamlManager};

    static PyGetSetDef getset_WindowsXamlManager_Static[] = {
        { }};

    static PyMethodDef methods_WindowsXamlManager_Static[] = {
        { "get_for_current_thread", reinterpret_cast<PyCFunction>(WindowsXamlManager_GetForCurrentThread), METH_VARARGS, nullptr },
        { "initialize_for_current_thread", reinterpret_cast<PyCFunction>(WindowsXamlManager_InitializeForCurrentThread), METH_VARARGS, nullptr },
        { }};

    static PyType_Slot type_slots_WindowsXamlManager_Static[] = 
    {
        { Py_tp_base, reinterpret_cast<void*>(&PyType_Type) },
        { Py_tp_getset, reinterpret_cast<void*>(getset_WindowsXamlManager_Static) },
        { Py_tp_methods, reinterpret_cast<void*>(methods_WindowsXamlManager_Static) },
        { }
    };

    static PyType_Spec type_spec_WindowsXamlManager_Static = {
        "winui3._winui3_microsoft_ui_xaml_hosting.WindowsXamlManager_Static",
        static_cast<int>(PyType_Type.tp_basicsize),
        static_cast<int>(PyType_Type.tp_itemsize),
        Py_TPFLAGS_DEFAULT,
        type_slots_WindowsXamlManager_Static};

    // ----- XamlShutdownCompletedOnThreadEventArgs class --------------------

    static PyObject* _new_XamlShutdownCompletedOnThreadEventArgs(PyTypeObject* /*unused*/, PyObject* /*unused*/, PyObject* /*unused*/) noexcept
    {
        static_assert(py::py_type<winrt::Microsoft::UI::Xaml::Hosting::XamlShutdownCompletedOnThreadEventArgs>::type_name);
        py::set_invalid_activation_error(py::py_type<winrt::Microsoft::UI::Xaml::Hosting::XamlShutdownCompletedOnThreadEventArgs>::type_name);
        return nullptr;
    }

    static void _dealloc_XamlShutdownCompletedOnThreadEventArgs(py::wrapper::Microsoft::UI::Xaml::Hosting::XamlShutdownCompletedOnThreadEventArgs* self) noexcept
    {
        auto tp = Py_TYPE(self);
        std::destroy_at(&self->obj);
        tp->tp_free(self);
        Py_DECREF(tp);
    }

    static PyObject* XamlShutdownCompletedOnThreadEventArgs_GetDispatcherQueueDeferral(py::wrapper::Microsoft::UI::Xaml::Hosting::XamlShutdownCompletedOnThreadEventArgs* self, 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"Microsoft.UI.Xaml.Hosting.XamlShutdownCompletedOnThreadEventArgs", L"GetDispatcherQueueDeferral", 0);
                }

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

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

    static PyObject* _assign_array_XamlShutdownCompletedOnThreadEventArgs(PyObject* /*unused*/, PyObject* arg) noexcept
    {
        auto array = std::make_unique<py::ComArray<winrt::Microsoft::UI::Xaml::Hosting::XamlShutdownCompletedOnThreadEventArgs>>();
        if (!py::cpp::_winrt::Array_Assign(arg, std::move(array)))
        {
            return nullptr;
        }
        Py_RETURN_NONE;
    }

    static PyObject* _from_XamlShutdownCompletedOnThreadEventArgs(PyObject* /*unused*/, PyObject* arg) noexcept
    {
        try
        {
            auto return_value = py::convert_to<winrt::Windows::Foundation::IInspectable>(arg);
            return py::convert(return_value.as<winrt::Microsoft::UI::Xaml::Hosting::XamlShutdownCompletedOnThreadEventArgs>());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyMethodDef _methods_XamlShutdownCompletedOnThreadEventArgs[] = {
        { "get_dispatcher_queue_deferral", reinterpret_cast<PyCFunction>(XamlShutdownCompletedOnThreadEventArgs_GetDispatcherQueueDeferral), METH_VARARGS, nullptr },
        { "_assign_array_", _assign_array_XamlShutdownCompletedOnThreadEventArgs, METH_O | METH_STATIC, nullptr },
        { "_from", reinterpret_cast<PyCFunction>(_from_XamlShutdownCompletedOnThreadEventArgs), METH_O | METH_STATIC, nullptr },
        { }};

    static PyGetSetDef _getset_XamlShutdownCompletedOnThreadEventArgs[] = {
        { }};

    static PyType_Slot _type_slots_XamlShutdownCompletedOnThreadEventArgs[] = {
        { Py_tp_new, reinterpret_cast<void*>(_new_XamlShutdownCompletedOnThreadEventArgs) },
        { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_XamlShutdownCompletedOnThreadEventArgs) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_XamlShutdownCompletedOnThreadEventArgs) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_XamlShutdownCompletedOnThreadEventArgs) },
        { }};

    static PyType_Spec type_spec_XamlShutdownCompletedOnThreadEventArgs = {
        "winui3._winui3_microsoft_ui_xaml_hosting.XamlShutdownCompletedOnThreadEventArgs",
        sizeof(py::wrapper::Microsoft::UI::Xaml::Hosting::XamlShutdownCompletedOnThreadEventArgs),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_XamlShutdownCompletedOnThreadEventArgs};

    // ----- XamlSourceFocusNavigationRequest class --------------------

    static PyObject* _new_XamlSourceFocusNavigationRequest(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 == 1)
        {
            try
            {
                auto param0 = py::convert_to<winrt::Microsoft::UI::Xaml::Hosting::XamlSourceFocusNavigationReason>(args, 0);

                winrt::Microsoft::UI::Xaml::Hosting::XamlSourceFocusNavigationRequest instance{param0};
                return py::wrap(instance, type);
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else if (arg_count == 2)
        {
            try
            {
                auto param0 = py::convert_to<winrt::Microsoft::UI::Xaml::Hosting::XamlSourceFocusNavigationReason>(args, 0);
                auto param1 = py::convert_to<winrt::Windows::Foundation::Rect>(args, 1);

                winrt::Microsoft::UI::Xaml::Hosting::XamlSourceFocusNavigationRequest instance{param0, param1};
                return py::wrap(instance, type);
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else if (arg_count == 3)
        {
            try
            {
                auto param0 = py::convert_to<winrt::Microsoft::UI::Xaml::Hosting::XamlSourceFocusNavigationReason>(args, 0);
                auto param1 = py::convert_to<winrt::Windows::Foundation::Rect>(args, 1);
                auto param2 = py::convert_to<winrt::guid>(args, 2);

                winrt::Microsoft::UI::Xaml::Hosting::XamlSourceFocusNavigationRequest instance{param0, param1, param2};
                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_XamlSourceFocusNavigationRequest(py::wrapper::Microsoft::UI::Xaml::Hosting::XamlSourceFocusNavigationRequest* self) noexcept
    {
        auto tp = Py_TYPE(self);
        std::destroy_at(&self->obj);
        tp->tp_free(self);
        Py_DECREF(tp);
    }

    static PyObject* XamlSourceFocusNavigationRequest_get_CorrelationId(py::wrapper::Microsoft::UI::Xaml::Hosting::XamlSourceFocusNavigationRequest* 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"Microsoft.UI.Xaml.Hosting.XamlSourceFocusNavigationRequest", L"CorrelationId");
            }

            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.CorrelationId();
            }());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* XamlSourceFocusNavigationRequest_get_HintRect(py::wrapper::Microsoft::UI::Xaml::Hosting::XamlSourceFocusNavigationRequest* 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"Microsoft.UI.Xaml.Hosting.XamlSourceFocusNavigationRequest", L"HintRect");
            }

            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.HintRect();
            }());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* XamlSourceFocusNavigationRequest_get_Reason(py::wrapper::Microsoft::UI::Xaml::Hosting::XamlSourceFocusNavigationRequest* 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"Microsoft.UI.Xaml.Hosting.XamlSourceFocusNavigationRequest", L"Reason");
            }

            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.Reason();
            }());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* _assign_array_XamlSourceFocusNavigationRequest(PyObject* /*unused*/, PyObject* arg) noexcept
    {
        auto array = std::make_unique<py::ComArray<winrt::Microsoft::UI::Xaml::Hosting::XamlSourceFocusNavigationRequest>>();
        if (!py::cpp::_winrt::Array_Assign(arg, std::move(array)))
        {
            return nullptr;
        }
        Py_RETURN_NONE;
    }

    static PyObject* _from_XamlSourceFocusNavigationRequest(PyObject* /*unused*/, PyObject* arg) noexcept
    {
        try
        {
            auto return_value = py::convert_to<winrt::Windows::Foundation::IInspectable>(arg);
            return py::convert(return_value.as<winrt::Microsoft::UI::Xaml::Hosting::XamlSourceFocusNavigationRequest>());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyMethodDef _methods_XamlSourceFocusNavigationRequest[] = {
        { "_assign_array_", _assign_array_XamlSourceFocusNavigationRequest, METH_O | METH_STATIC, nullptr },
        { "_from", reinterpret_cast<PyCFunction>(_from_XamlSourceFocusNavigationRequest), METH_O | METH_STATIC, nullptr },
        { }};

    static PyGetSetDef _getset_XamlSourceFocusNavigationRequest[] = {
        { "correlation_id", reinterpret_cast<getter>(XamlSourceFocusNavigationRequest_get_CorrelationId), nullptr, nullptr, nullptr },
        { "hint_rect", reinterpret_cast<getter>(XamlSourceFocusNavigationRequest_get_HintRect), nullptr, nullptr, nullptr },
        { "reason", reinterpret_cast<getter>(XamlSourceFocusNavigationRequest_get_Reason), nullptr, nullptr, nullptr },
        { }};

    static PyType_Slot _type_slots_XamlSourceFocusNavigationRequest[] = {
        { Py_tp_new, reinterpret_cast<void*>(_new_XamlSourceFocusNavigationRequest) },
        { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_XamlSourceFocusNavigationRequest) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_XamlSourceFocusNavigationRequest) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_XamlSourceFocusNavigationRequest) },
        { }};

    static PyType_Spec type_spec_XamlSourceFocusNavigationRequest = {
        "winui3._winui3_microsoft_ui_xaml_hosting.XamlSourceFocusNavigationRequest",
        sizeof(py::wrapper::Microsoft::UI::Xaml::Hosting::XamlSourceFocusNavigationRequest),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_XamlSourceFocusNavigationRequest};

    // ----- XamlSourceFocusNavigationResult class --------------------

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

                winrt::Microsoft::UI::Xaml::Hosting::XamlSourceFocusNavigationResult 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_XamlSourceFocusNavigationResult(py::wrapper::Microsoft::UI::Xaml::Hosting::XamlSourceFocusNavigationResult* self) noexcept
    {
        auto tp = Py_TYPE(self);
        std::destroy_at(&self->obj);
        tp->tp_free(self);
        Py_DECREF(tp);
    }

    static PyObject* XamlSourceFocusNavigationResult_get_WasFocusMoved(py::wrapper::Microsoft::UI::Xaml::Hosting::XamlSourceFocusNavigationResult* 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"Microsoft.UI.Xaml.Hosting.XamlSourceFocusNavigationResult", L"WasFocusMoved");
            }

            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.WasFocusMoved();
            }());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* _assign_array_XamlSourceFocusNavigationResult(PyObject* /*unused*/, PyObject* arg) noexcept
    {
        auto array = std::make_unique<py::ComArray<winrt::Microsoft::UI::Xaml::Hosting::XamlSourceFocusNavigationResult>>();
        if (!py::cpp::_winrt::Array_Assign(arg, std::move(array)))
        {
            return nullptr;
        }
        Py_RETURN_NONE;
    }

    static PyObject* _from_XamlSourceFocusNavigationResult(PyObject* /*unused*/, PyObject* arg) noexcept
    {
        try
        {
            auto return_value = py::convert_to<winrt::Windows::Foundation::IInspectable>(arg);
            return py::convert(return_value.as<winrt::Microsoft::UI::Xaml::Hosting::XamlSourceFocusNavigationResult>());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyMethodDef _methods_XamlSourceFocusNavigationResult[] = {
        { "_assign_array_", _assign_array_XamlSourceFocusNavigationResult, METH_O | METH_STATIC, nullptr },
        { "_from", reinterpret_cast<PyCFunction>(_from_XamlSourceFocusNavigationResult), METH_O | METH_STATIC, nullptr },
        { }};

    static PyGetSetDef _getset_XamlSourceFocusNavigationResult[] = {
        { "was_focus_moved", reinterpret_cast<getter>(XamlSourceFocusNavigationResult_get_WasFocusMoved), nullptr, nullptr, nullptr },
        { }};

    static PyType_Slot _type_slots_XamlSourceFocusNavigationResult[] = {
        { Py_tp_new, reinterpret_cast<void*>(_new_XamlSourceFocusNavigationResult) },
        { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_XamlSourceFocusNavigationResult) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_XamlSourceFocusNavigationResult) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_XamlSourceFocusNavigationResult) },
        { }};

    static PyType_Spec type_spec_XamlSourceFocusNavigationResult = {
        "winui3._winui3_microsoft_ui_xaml_hosting.XamlSourceFocusNavigationResult",
        sizeof(py::wrapper::Microsoft::UI::Xaml::Hosting::XamlSourceFocusNavigationResult),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_XamlSourceFocusNavigationResult};

    // ----- Microsoft.UI.Xaml.Hosting Initialization --------------------

    PyDoc_STRVAR(module_doc, "Microsoft.UI.Xaml.Hosting");

    static PyModuleDef module_def = {
        PyModuleDef_HEAD_INIT,
        "_winui3_microsoft_ui_xaml_hosting",
        module_doc,
        0,
        nullptr,
        nullptr,
        nullptr,
        nullptr,
        nullptr};
} // py::cpp::Microsoft::UI::Xaml::Hosting

PyMODINIT_FUNC PyInit__winui3_microsoft_ui_xaml_hosting(void) noexcept
{
    using namespace py::cpp::Microsoft::UI::Xaml::Hosting;

    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 DesktopWindowXamlSource_Static_bases{PyTuple_Pack(1, reinterpret_cast<PyObject*>(inspectable_meta_type))};
    if (!DesktopWindowXamlSource_Static_bases)
    {
        return nullptr;
    }

    py::pyobj_handle type_DesktopWindowXamlSource_Static{PyType_FromSpecWithBases(&type_spec_DesktopWindowXamlSource_Static, DesktopWindowXamlSource_Static_bases.get())};
    if (!type_DesktopWindowXamlSource_Static)
    {
        return nullptr;
    }

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

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

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

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

    py::pyobj_handle type_ElementCompositionPreview_Static{PyType_FromSpecWithBases(&type_spec_ElementCompositionPreview_Static, ElementCompositionPreview_Static_bases.get())};
    if (!type_ElementCompositionPreview_Static)
    {
        return nullptr;
    }

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

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

    py::pyobj_handle type_WindowsXamlManager_Static{PyType_FromSpecWithBases(&type_spec_WindowsXamlManager_Static, WindowsXamlManager_Static_bases.get())};
    if (!type_WindowsXamlManager_Static)
    {
        return nullptr;
    }

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

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

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

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


    return module.detach();
}
