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

#include "py.Windows.Graphics.Capture.h"

namespace py::cpp::Windows::Graphics::Capture
{
    // ----- Direct3D11CaptureFrame class --------------------

    static PyObject* _new_Direct3D11CaptureFrame(PyTypeObject* /*unused*/, PyObject* /*unused*/, PyObject* /*unused*/) noexcept
    {
        static_assert(py::py_type<winrt::Windows::Graphics::Capture::Direct3D11CaptureFrame>::type_name);
        py::set_invalid_activation_error(py::py_type<winrt::Windows::Graphics::Capture::Direct3D11CaptureFrame>::type_name);
        return nullptr;
    }

    static void _dealloc_Direct3D11CaptureFrame(py::wrapper::Windows::Graphics::Capture::Direct3D11CaptureFrame* self) noexcept
    {
        auto tp = Py_TYPE(self);
        std::destroy_at(&self->obj);
        tp->tp_free(self);
        Py_DECREF(tp);
    }

    static PyObject* Direct3D11CaptureFrame_Close(py::wrapper::Windows::Graphics::Capture::Direct3D11CaptureFrame* 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"Windows.Graphics.Capture.Direct3D11CaptureFrame", 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* Direct3D11CaptureFrame_get_ContentSize(py::wrapper::Windows::Graphics::Capture::Direct3D11CaptureFrame* self, void* /*unused*/) noexcept
    {
        try
        {
            static std::optional<bool> is_property_present{};

            if (!is_property_present.has_value())
            {
                is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Graphics.Capture.Direct3D11CaptureFrame", L"ContentSize");
            }

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

    static PyObject* Direct3D11CaptureFrame_get_Surface(py::wrapper::Windows::Graphics::Capture::Direct3D11CaptureFrame* self, void* /*unused*/) noexcept
    {
        try
        {
            static std::optional<bool> is_property_present{};

            if (!is_property_present.has_value())
            {
                is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Graphics.Capture.Direct3D11CaptureFrame", L"Surface");
            }

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

    static PyObject* Direct3D11CaptureFrame_get_SystemRelativeTime(py::wrapper::Windows::Graphics::Capture::Direct3D11CaptureFrame* self, void* /*unused*/) noexcept
    {
        try
        {
            static std::optional<bool> is_property_present{};

            if (!is_property_present.has_value())
            {
                is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Graphics.Capture.Direct3D11CaptureFrame", L"SystemRelativeTime");
            }

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

    static PyObject* Direct3D11CaptureFrame_get_DirtyRegionMode(py::wrapper::Windows::Graphics::Capture::Direct3D11CaptureFrame* self, void* /*unused*/) noexcept
    {
        try
        {
            static std::optional<bool> is_property_present{};

            if (!is_property_present.has_value())
            {
                is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Graphics.Capture.Direct3D11CaptureFrame", L"DirtyRegionMode");
            }

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

    static PyObject* Direct3D11CaptureFrame_get_DirtyRegions(py::wrapper::Windows::Graphics::Capture::Direct3D11CaptureFrame* self, void* /*unused*/) noexcept
    {
        try
        {
            static std::optional<bool> is_property_present{};

            if (!is_property_present.has_value())
            {
                is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Graphics.Capture.Direct3D11CaptureFrame", L"DirtyRegions");
            }

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

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

    static PyObject* _from_Direct3D11CaptureFrame(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::Graphics::Capture::Direct3D11CaptureFrame>());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* _enter_Direct3D11CaptureFrame(py::wrapper::Windows::Graphics::Capture::Direct3D11CaptureFrame* self, PyObject* /*unused*/) noexcept
    {
        return Py_NewRef(self);
    }

    static PyObject* _exit_Direct3D11CaptureFrame(py::wrapper::Windows::Graphics::Capture::Direct3D11CaptureFrame* 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_Direct3D11CaptureFrame[] = {
        { "close", reinterpret_cast<PyCFunction>(Direct3D11CaptureFrame_Close), METH_VARARGS, nullptr },
        { "_assign_array_", _assign_array_Direct3D11CaptureFrame, METH_O | METH_STATIC, nullptr },
        { "_from", reinterpret_cast<PyCFunction>(_from_Direct3D11CaptureFrame), METH_O | METH_STATIC, nullptr },
        { "__enter__", reinterpret_cast<PyCFunction>(_enter_Direct3D11CaptureFrame), METH_NOARGS, nullptr },
        { "__exit__", reinterpret_cast<PyCFunction>(_exit_Direct3D11CaptureFrame), METH_VARARGS, nullptr },
        { }};

    static PyGetSetDef _getset_Direct3D11CaptureFrame[] = {
        { "content_size", reinterpret_cast<getter>(Direct3D11CaptureFrame_get_ContentSize), nullptr, nullptr, nullptr },
        { "surface", reinterpret_cast<getter>(Direct3D11CaptureFrame_get_Surface), nullptr, nullptr, nullptr },
        { "system_relative_time", reinterpret_cast<getter>(Direct3D11CaptureFrame_get_SystemRelativeTime), nullptr, nullptr, nullptr },
        { "dirty_region_mode", reinterpret_cast<getter>(Direct3D11CaptureFrame_get_DirtyRegionMode), nullptr, nullptr, nullptr },
        { "dirty_regions", reinterpret_cast<getter>(Direct3D11CaptureFrame_get_DirtyRegions), nullptr, nullptr, nullptr },
        { }};

    static PyType_Slot _type_slots_Direct3D11CaptureFrame[] = {
        { Py_tp_new, reinterpret_cast<void*>(_new_Direct3D11CaptureFrame) },
        { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_Direct3D11CaptureFrame) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_Direct3D11CaptureFrame) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_Direct3D11CaptureFrame) },
        { }};

    static PyType_Spec type_spec_Direct3D11CaptureFrame = {
        "winrt._winrt_windows_graphics_capture.Direct3D11CaptureFrame",
        sizeof(py::wrapper::Windows::Graphics::Capture::Direct3D11CaptureFrame),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_Direct3D11CaptureFrame};

    // ----- Direct3D11CaptureFramePool class --------------------

    static PyObject* _new_Direct3D11CaptureFramePool(PyTypeObject* /*unused*/, PyObject* /*unused*/, PyObject* /*unused*/) noexcept
    {
        static_assert(py::py_type<winrt::Windows::Graphics::Capture::Direct3D11CaptureFramePool>::type_name);
        py::set_invalid_activation_error(py::py_type<winrt::Windows::Graphics::Capture::Direct3D11CaptureFramePool>::type_name);
        return nullptr;
    }

    static void _dealloc_Direct3D11CaptureFramePool(py::wrapper::Windows::Graphics::Capture::Direct3D11CaptureFramePool* self) noexcept
    {
        auto tp = Py_TYPE(self);
        std::destroy_at(&self->obj);
        tp->tp_free(self);
        Py_DECREF(tp);
    }

    static PyObject* Direct3D11CaptureFramePool_Close(py::wrapper::Windows::Graphics::Capture::Direct3D11CaptureFramePool* 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"Windows.Graphics.Capture.Direct3D11CaptureFramePool", 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* Direct3D11CaptureFramePool_Create(PyObject* /*unused*/, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_GET_SIZE(args);

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

                if (!is_overload_present.has_value())
                {
                    is_overload_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Graphics.Capture.Direct3D11CaptureFramePool", L"Create", 4);
                }

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

                auto param0 = py::convert_to<winrt::Windows::Graphics::DirectX::Direct3D11::IDirect3DDevice>(args, 0);
                auto param1 = py::convert_to<winrt::Windows::Graphics::DirectX::DirectXPixelFormat>(args, 1);
                auto param2 = py::convert_to<int32_t>(args, 2);
                auto param3 = py::convert_to<winrt::Windows::Graphics::SizeInt32>(args, 3);

                return py::convert([&]()
                {
                    auto _gil = release_gil();
                    return winrt::Windows::Graphics::Capture::Direct3D11CaptureFramePool::Create(param0, param1, param2, param3);
                }());
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* Direct3D11CaptureFramePool_CreateCaptureSession(py::wrapper::Windows::Graphics::Capture::Direct3D11CaptureFramePool* self, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_GET_SIZE(args);

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

                if (!is_overload_present.has_value())
                {
                    is_overload_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Graphics.Capture.Direct3D11CaptureFramePool", L"CreateCaptureSession", 1);
                }

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

                auto param0 = py::convert_to<winrt::Windows::Graphics::Capture::GraphicsCaptureItem>(args, 0);

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

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

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

                if (!is_overload_present.has_value())
                {
                    is_overload_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Graphics.Capture.Direct3D11CaptureFramePool", L"CreateFreeThreaded", 4);
                }

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

                auto param0 = py::convert_to<winrt::Windows::Graphics::DirectX::Direct3D11::IDirect3DDevice>(args, 0);
                auto param1 = py::convert_to<winrt::Windows::Graphics::DirectX::DirectXPixelFormat>(args, 1);
                auto param2 = py::convert_to<int32_t>(args, 2);
                auto param3 = py::convert_to<winrt::Windows::Graphics::SizeInt32>(args, 3);

                return py::convert([&]()
                {
                    auto _gil = release_gil();
                    return winrt::Windows::Graphics::Capture::Direct3D11CaptureFramePool::CreateFreeThreaded(param0, param1, param2, param3);
                }());
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* Direct3D11CaptureFramePool_Recreate(py::wrapper::Windows::Graphics::Capture::Direct3D11CaptureFramePool* self, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_GET_SIZE(args);

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

                if (!is_overload_present.has_value())
                {
                    is_overload_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Graphics.Capture.Direct3D11CaptureFramePool", L"Recreate", 4);
                }

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

                auto param0 = py::convert_to<winrt::Windows::Graphics::DirectX::Direct3D11::IDirect3DDevice>(args, 0);
                auto param1 = py::convert_to<winrt::Windows::Graphics::DirectX::DirectXPixelFormat>(args, 1);
                auto param2 = py::convert_to<int32_t>(args, 2);
                auto param3 = py::convert_to<winrt::Windows::Graphics::SizeInt32>(args, 3);

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

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

    static PyObject* Direct3D11CaptureFramePool_TryGetNextFrame(py::wrapper::Windows::Graphics::Capture::Direct3D11CaptureFramePool* 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"Windows.Graphics.Capture.Direct3D11CaptureFramePool", L"TryGetNextFrame", 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.TryGetNextFrame();
                }());
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* Direct3D11CaptureFramePool_get_DispatcherQueue(py::wrapper::Windows::Graphics::Capture::Direct3D11CaptureFramePool* self, void* /*unused*/) noexcept
    {
        try
        {
            static std::optional<bool> is_property_present{};

            if (!is_property_present.has_value())
            {
                is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Graphics.Capture.Direct3D11CaptureFramePool", L"DispatcherQueue");
            }

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

    static PyObject* Direct3D11CaptureFramePool_add_FrameArrived(py::wrapper::Windows::Graphics::Capture::Direct3D11CaptureFramePool* self, PyObject* arg) noexcept
    {
        try
        {
            static std::optional<bool> is_event_present{};

            if (!is_event_present.has_value())
            {
                is_event_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsEventPresent(L"Windows.Graphics.Capture.Direct3D11CaptureFramePool", L"FrameArrived");
            }

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

            auto param0 = py::convert_to<winrt::Windows::Foundation::TypedEventHandler<winrt::Windows::Graphics::Capture::Direct3D11CaptureFramePool, winrt::Windows::Foundation::IInspectable>>(arg);

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

    static PyObject* Direct3D11CaptureFramePool_remove_FrameArrived(py::wrapper::Windows::Graphics::Capture::Direct3D11CaptureFramePool* self, PyObject* arg) noexcept
    {
        try
        {
            static std::optional<bool> is_event_present{};

            if (!is_event_present.has_value())
            {
                is_event_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsEventPresent(L"Windows.Graphics.Capture.Direct3D11CaptureFramePool", L"FrameArrived");
            }

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

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

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

    static PyObject* _from_Direct3D11CaptureFramePool(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::Graphics::Capture::Direct3D11CaptureFramePool>());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* _enter_Direct3D11CaptureFramePool(py::wrapper::Windows::Graphics::Capture::Direct3D11CaptureFramePool* self, PyObject* /*unused*/) noexcept
    {
        return Py_NewRef(self);
    }

    static PyObject* _exit_Direct3D11CaptureFramePool(py::wrapper::Windows::Graphics::Capture::Direct3D11CaptureFramePool* 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_Direct3D11CaptureFramePool[] = {
        { "close", reinterpret_cast<PyCFunction>(Direct3D11CaptureFramePool_Close), METH_VARARGS, nullptr },
        { "create_capture_session", reinterpret_cast<PyCFunction>(Direct3D11CaptureFramePool_CreateCaptureSession), METH_VARARGS, nullptr },
        { "recreate", reinterpret_cast<PyCFunction>(Direct3D11CaptureFramePool_Recreate), METH_VARARGS, nullptr },
        { "try_get_next_frame", reinterpret_cast<PyCFunction>(Direct3D11CaptureFramePool_TryGetNextFrame), METH_VARARGS, nullptr },
        { "add_frame_arrived", reinterpret_cast<PyCFunction>(Direct3D11CaptureFramePool_add_FrameArrived), METH_O, nullptr },
        { "remove_frame_arrived", reinterpret_cast<PyCFunction>(Direct3D11CaptureFramePool_remove_FrameArrived), METH_O, nullptr },
        { "_assign_array_", _assign_array_Direct3D11CaptureFramePool, METH_O | METH_STATIC, nullptr },
        { "_from", reinterpret_cast<PyCFunction>(_from_Direct3D11CaptureFramePool), METH_O | METH_STATIC, nullptr },
        { "__enter__", reinterpret_cast<PyCFunction>(_enter_Direct3D11CaptureFramePool), METH_NOARGS, nullptr },
        { "__exit__", reinterpret_cast<PyCFunction>(_exit_Direct3D11CaptureFramePool), METH_VARARGS, nullptr },
        { }};

    static PyGetSetDef _getset_Direct3D11CaptureFramePool[] = {
        { "dispatcher_queue", reinterpret_cast<getter>(Direct3D11CaptureFramePool_get_DispatcherQueue), nullptr, nullptr, nullptr },
        { }};

    static PyType_Slot _type_slots_Direct3D11CaptureFramePool[] = {
        { Py_tp_new, reinterpret_cast<void*>(_new_Direct3D11CaptureFramePool) },
        { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_Direct3D11CaptureFramePool) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_Direct3D11CaptureFramePool) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_Direct3D11CaptureFramePool) },
        { }};

    static PyType_Spec type_spec_Direct3D11CaptureFramePool = {
        "winrt._winrt_windows_graphics_capture.Direct3D11CaptureFramePool",
        sizeof(py::wrapper::Windows::Graphics::Capture::Direct3D11CaptureFramePool),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_Direct3D11CaptureFramePool};

    static PyGetSetDef getset_Direct3D11CaptureFramePool_Static[] = {
        { }};

    static PyMethodDef methods_Direct3D11CaptureFramePool_Static[] = {
        { "create", reinterpret_cast<PyCFunction>(Direct3D11CaptureFramePool_Create), METH_VARARGS, nullptr },
        { "create_free_threaded", reinterpret_cast<PyCFunction>(Direct3D11CaptureFramePool_CreateFreeThreaded), METH_VARARGS, nullptr },
        { }};

    static PyType_Slot type_slots_Direct3D11CaptureFramePool_Static[] = 
    {
        { Py_tp_base, reinterpret_cast<void*>(&PyType_Type) },
        { Py_tp_getset, reinterpret_cast<void*>(getset_Direct3D11CaptureFramePool_Static) },
        { Py_tp_methods, reinterpret_cast<void*>(methods_Direct3D11CaptureFramePool_Static) },
        { }
    };

    static PyType_Spec type_spec_Direct3D11CaptureFramePool_Static = {
        "winrt._winrt_windows_graphics_capture.Direct3D11CaptureFramePool_Static",
        static_cast<int>(PyType_Type.tp_basicsize),
        static_cast<int>(PyType_Type.tp_itemsize),
        Py_TPFLAGS_DEFAULT,
        type_slots_Direct3D11CaptureFramePool_Static};

    // ----- GraphicsCaptureAccess class --------------------

    static PyObject* _new_GraphicsCaptureAccess(PyTypeObject* /*unused*/, PyObject* /*unused*/, PyObject* /*unused*/) noexcept
    {
        static_assert(py::py_type<winrt::Windows::Graphics::Capture::GraphicsCaptureAccess>::type_name);
        py::set_invalid_activation_error(py::py_type<winrt::Windows::Graphics::Capture::GraphicsCaptureAccess>::type_name);
        return nullptr;
    }

    static PyObject* GraphicsCaptureAccess_RequestAccessAsync(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"Windows.Graphics.Capture.GraphicsCaptureAccess", L"RequestAccessAsync", 1);
                }

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

                auto param0 = py::convert_to<winrt::Windows::Graphics::Capture::GraphicsCaptureAccessKind>(args, 0);

                return py::convert([&]()
                {
                    auto _gil = release_gil();
                    return winrt::Windows::Graphics::Capture::GraphicsCaptureAccess::RequestAccessAsync(param0);
                }());
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyMethodDef _methods_GraphicsCaptureAccess[] = {
        { }};

    static PyGetSetDef _getset_GraphicsCaptureAccess[] = {
        { }};

    static PyType_Slot _type_slots_GraphicsCaptureAccess[] = {
        { Py_tp_new, reinterpret_cast<void*>(_new_GraphicsCaptureAccess) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_GraphicsCaptureAccess) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_GraphicsCaptureAccess) },
        { }};

    static PyType_Spec type_spec_GraphicsCaptureAccess = {
        "winrt._winrt_windows_graphics_capture.GraphicsCaptureAccess",
        0,
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_GraphicsCaptureAccess};

    static PyGetSetDef getset_GraphicsCaptureAccess_Static[] = {
        { }};

    static PyMethodDef methods_GraphicsCaptureAccess_Static[] = {
        { "request_access_async", reinterpret_cast<PyCFunction>(GraphicsCaptureAccess_RequestAccessAsync), METH_VARARGS, nullptr },
        { }};

    static PyType_Slot type_slots_GraphicsCaptureAccess_Static[] = 
    {
        { Py_tp_base, reinterpret_cast<void*>(&PyType_Type) },
        { Py_tp_getset, reinterpret_cast<void*>(getset_GraphicsCaptureAccess_Static) },
        { Py_tp_methods, reinterpret_cast<void*>(methods_GraphicsCaptureAccess_Static) },
        { }
    };

    static PyType_Spec type_spec_GraphicsCaptureAccess_Static = {
        "winrt._winrt_windows_graphics_capture.GraphicsCaptureAccess_Static",
        static_cast<int>(PyType_Type.tp_basicsize),
        static_cast<int>(PyType_Type.tp_itemsize),
        Py_TPFLAGS_DEFAULT,
        type_slots_GraphicsCaptureAccess_Static};

    // ----- GraphicsCaptureItem class --------------------

    static PyObject* _new_GraphicsCaptureItem(PyTypeObject* /*unused*/, PyObject* /*unused*/, PyObject* /*unused*/) noexcept
    {
        static_assert(py::py_type<winrt::Windows::Graphics::Capture::GraphicsCaptureItem>::type_name);
        py::set_invalid_activation_error(py::py_type<winrt::Windows::Graphics::Capture::GraphicsCaptureItem>::type_name);
        return nullptr;
    }

    static void _dealloc_GraphicsCaptureItem(py::wrapper::Windows::Graphics::Capture::GraphicsCaptureItem* self) noexcept
    {
        auto tp = Py_TYPE(self);
        std::destroy_at(&self->obj);
        tp->tp_free(self);
        Py_DECREF(tp);
    }

    static PyObject* GraphicsCaptureItem_CreateFromVisual(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"Windows.Graphics.Capture.GraphicsCaptureItem", L"CreateFromVisual", 1);
                }

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

                auto param0 = py::convert_to<winrt::Windows::UI::Composition::Visual>(args, 0);

                return py::convert([&]()
                {
                    auto _gil = release_gil();
                    return winrt::Windows::Graphics::Capture::GraphicsCaptureItem::CreateFromVisual(param0);
                }());
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* GraphicsCaptureItem_TryCreateFromDisplayId(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"Windows.Graphics.Capture.GraphicsCaptureItem", L"TryCreateFromDisplayId", 1);
                }

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

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

                return py::convert([&]()
                {
                    auto _gil = release_gil();
                    return winrt::Windows::Graphics::Capture::GraphicsCaptureItem::TryCreateFromDisplayId(param0);
                }());
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* GraphicsCaptureItem_TryCreateFromWindowId(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"Windows.Graphics.Capture.GraphicsCaptureItem", L"TryCreateFromWindowId", 1);
                }

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

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

                return py::convert([&]()
                {
                    auto _gil = release_gil();
                    return winrt::Windows::Graphics::Capture::GraphicsCaptureItem::TryCreateFromWindowId(param0);
                }());
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* GraphicsCaptureItem_get_DisplayName(py::wrapper::Windows::Graphics::Capture::GraphicsCaptureItem* self, void* /*unused*/) noexcept
    {
        try
        {
            static std::optional<bool> is_property_present{};

            if (!is_property_present.has_value())
            {
                is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Graphics.Capture.GraphicsCaptureItem", L"DisplayName");
            }

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

    static PyObject* GraphicsCaptureItem_get_Size(py::wrapper::Windows::Graphics::Capture::GraphicsCaptureItem* self, void* /*unused*/) noexcept
    {
        try
        {
            static std::optional<bool> is_property_present{};

            if (!is_property_present.has_value())
            {
                is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Graphics.Capture.GraphicsCaptureItem", L"Size");
            }

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

    static PyObject* GraphicsCaptureItem_add_Closed(py::wrapper::Windows::Graphics::Capture::GraphicsCaptureItem* self, PyObject* arg) noexcept
    {
        try
        {
            static std::optional<bool> is_event_present{};

            if (!is_event_present.has_value())
            {
                is_event_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsEventPresent(L"Windows.Graphics.Capture.GraphicsCaptureItem", L"Closed");
            }

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

            auto param0 = py::convert_to<winrt::Windows::Foundation::TypedEventHandler<winrt::Windows::Graphics::Capture::GraphicsCaptureItem, winrt::Windows::Foundation::IInspectable>>(arg);

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

    static PyObject* GraphicsCaptureItem_remove_Closed(py::wrapper::Windows::Graphics::Capture::GraphicsCaptureItem* self, PyObject* arg) noexcept
    {
        try
        {
            static std::optional<bool> is_event_present{};

            if (!is_event_present.has_value())
            {
                is_event_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsEventPresent(L"Windows.Graphics.Capture.GraphicsCaptureItem", L"Closed");
            }

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

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

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

    static PyObject* _from_GraphicsCaptureItem(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::Graphics::Capture::GraphicsCaptureItem>());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyMethodDef _methods_GraphicsCaptureItem[] = {
        { "add_closed", reinterpret_cast<PyCFunction>(GraphicsCaptureItem_add_Closed), METH_O, nullptr },
        { "remove_closed", reinterpret_cast<PyCFunction>(GraphicsCaptureItem_remove_Closed), METH_O, nullptr },
        { "_assign_array_", _assign_array_GraphicsCaptureItem, METH_O | METH_STATIC, nullptr },
        { "_from", reinterpret_cast<PyCFunction>(_from_GraphicsCaptureItem), METH_O | METH_STATIC, nullptr },
        { }};

    static PyGetSetDef _getset_GraphicsCaptureItem[] = {
        { "display_name", reinterpret_cast<getter>(GraphicsCaptureItem_get_DisplayName), nullptr, nullptr, nullptr },
        { "size", reinterpret_cast<getter>(GraphicsCaptureItem_get_Size), nullptr, nullptr, nullptr },
        { }};

    static PyType_Slot _type_slots_GraphicsCaptureItem[] = {
        { Py_tp_new, reinterpret_cast<void*>(_new_GraphicsCaptureItem) },
        { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_GraphicsCaptureItem) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_GraphicsCaptureItem) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_GraphicsCaptureItem) },
        { }};

    static PyType_Spec type_spec_GraphicsCaptureItem = {
        "winrt._winrt_windows_graphics_capture.GraphicsCaptureItem",
        sizeof(py::wrapper::Windows::Graphics::Capture::GraphicsCaptureItem),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_GraphicsCaptureItem};

    static PyGetSetDef getset_GraphicsCaptureItem_Static[] = {
        { }};

    static PyMethodDef methods_GraphicsCaptureItem_Static[] = {
        { "create_from_visual", reinterpret_cast<PyCFunction>(GraphicsCaptureItem_CreateFromVisual), METH_VARARGS, nullptr },
        { "try_create_from_display_id", reinterpret_cast<PyCFunction>(GraphicsCaptureItem_TryCreateFromDisplayId), METH_VARARGS, nullptr },
        { "try_create_from_window_id", reinterpret_cast<PyCFunction>(GraphicsCaptureItem_TryCreateFromWindowId), METH_VARARGS, nullptr },
        { }};

    static PyType_Slot type_slots_GraphicsCaptureItem_Static[] = 
    {
        { Py_tp_base, reinterpret_cast<void*>(&PyType_Type) },
        { Py_tp_getset, reinterpret_cast<void*>(getset_GraphicsCaptureItem_Static) },
        { Py_tp_methods, reinterpret_cast<void*>(methods_GraphicsCaptureItem_Static) },
        { }
    };

    static PyType_Spec type_spec_GraphicsCaptureItem_Static = {
        "winrt._winrt_windows_graphics_capture.GraphicsCaptureItem_Static",
        static_cast<int>(PyType_Type.tp_basicsize),
        static_cast<int>(PyType_Type.tp_itemsize),
        Py_TPFLAGS_DEFAULT,
        type_slots_GraphicsCaptureItem_Static};

    // ----- GraphicsCapturePicker class --------------------

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

        auto arg_count = PyTuple_GET_SIZE(args);
        if (arg_count == 0)
        {
            try
            {
                winrt::Windows::Graphics::Capture::GraphicsCapturePicker 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_GraphicsCapturePicker(py::wrapper::Windows::Graphics::Capture::GraphicsCapturePicker* self) noexcept
    {
        auto tp = Py_TYPE(self);
        std::destroy_at(&self->obj);
        tp->tp_free(self);
        Py_DECREF(tp);
    }

    static PyObject* GraphicsCapturePicker_PickSingleItemAsync(py::wrapper::Windows::Graphics::Capture::GraphicsCapturePicker* 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"Windows.Graphics.Capture.GraphicsCapturePicker", L"PickSingleItemAsync", 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.PickSingleItemAsync();
                }());
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

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

    static PyObject* _from_GraphicsCapturePicker(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::Graphics::Capture::GraphicsCapturePicker>());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyMethodDef _methods_GraphicsCapturePicker[] = {
        { "pick_single_item_async", reinterpret_cast<PyCFunction>(GraphicsCapturePicker_PickSingleItemAsync), METH_VARARGS, nullptr },
        { "_assign_array_", _assign_array_GraphicsCapturePicker, METH_O | METH_STATIC, nullptr },
        { "_from", reinterpret_cast<PyCFunction>(_from_GraphicsCapturePicker), METH_O | METH_STATIC, nullptr },
        { }};

    static PyGetSetDef _getset_GraphicsCapturePicker[] = {
        { }};

    static PyType_Slot _type_slots_GraphicsCapturePicker[] = {
        { Py_tp_new, reinterpret_cast<void*>(_new_GraphicsCapturePicker) },
        { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_GraphicsCapturePicker) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_GraphicsCapturePicker) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_GraphicsCapturePicker) },
        { }};

    static PyType_Spec type_spec_GraphicsCapturePicker = {
        "winrt._winrt_windows_graphics_capture.GraphicsCapturePicker",
        sizeof(py::wrapper::Windows::Graphics::Capture::GraphicsCapturePicker),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_GraphicsCapturePicker};

    // ----- GraphicsCaptureSession class --------------------

    static PyObject* _new_GraphicsCaptureSession(PyTypeObject* /*unused*/, PyObject* /*unused*/, PyObject* /*unused*/) noexcept
    {
        static_assert(py::py_type<winrt::Windows::Graphics::Capture::GraphicsCaptureSession>::type_name);
        py::set_invalid_activation_error(py::py_type<winrt::Windows::Graphics::Capture::GraphicsCaptureSession>::type_name);
        return nullptr;
    }

    static void _dealloc_GraphicsCaptureSession(py::wrapper::Windows::Graphics::Capture::GraphicsCaptureSession* self) noexcept
    {
        auto tp = Py_TYPE(self);
        std::destroy_at(&self->obj);
        tp->tp_free(self);
        Py_DECREF(tp);
    }

    static PyObject* GraphicsCaptureSession_Close(py::wrapper::Windows::Graphics::Capture::GraphicsCaptureSession* 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"Windows.Graphics.Capture.GraphicsCaptureSession", 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* GraphicsCaptureSession_IsSupported(PyObject* /*unused*/, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_GET_SIZE(args);

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

                if (!is_overload_present.has_value())
                {
                    is_overload_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Graphics.Capture.GraphicsCaptureSession", L"IsSupported", 0);
                }

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

                return py::convert([&]()
                {
                    auto _gil = release_gil();
                    return winrt::Windows::Graphics::Capture::GraphicsCaptureSession::IsSupported();
                }());
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* GraphicsCaptureSession_StartCapture(py::wrapper::Windows::Graphics::Capture::GraphicsCaptureSession* 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"Windows.Graphics.Capture.GraphicsCaptureSession", L"StartCapture", 0);
                }

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

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

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

    static PyObject* GraphicsCaptureSession_get_IsCursorCaptureEnabled(py::wrapper::Windows::Graphics::Capture::GraphicsCaptureSession* self, void* /*unused*/) noexcept
    {
        try
        {
            static std::optional<bool> is_property_present{};

            if (!is_property_present.has_value())
            {
                is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Graphics.Capture.GraphicsCaptureSession", L"IsCursorCaptureEnabled");
            }

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

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

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

            if (!is_property_present.has_value())
            {
                is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Graphics.Capture.GraphicsCaptureSession", L"IsCursorCaptureEnabled");
            }

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

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

    static PyObject* GraphicsCaptureSession_get_IsBorderRequired(py::wrapper::Windows::Graphics::Capture::GraphicsCaptureSession* self, void* /*unused*/) noexcept
    {
        try
        {
            static std::optional<bool> is_property_present{};

            if (!is_property_present.has_value())
            {
                is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Graphics.Capture.GraphicsCaptureSession", L"IsBorderRequired");
            }

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

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

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

            if (!is_property_present.has_value())
            {
                is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Graphics.Capture.GraphicsCaptureSession", L"IsBorderRequired");
            }

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

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

    static PyObject* GraphicsCaptureSession_get_DirtyRegionMode(py::wrapper::Windows::Graphics::Capture::GraphicsCaptureSession* self, void* /*unused*/) noexcept
    {
        try
        {
            static std::optional<bool> is_property_present{};

            if (!is_property_present.has_value())
            {
                is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Graphics.Capture.GraphicsCaptureSession", L"DirtyRegionMode");
            }

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

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

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

            if (!is_property_present.has_value())
            {
                is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Graphics.Capture.GraphicsCaptureSession", L"DirtyRegionMode");
            }

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

            auto param0 = py::convert_to<winrt::Windows::Graphics::Capture::GraphicsCaptureDirtyRegionMode>(arg);

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

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

    static PyObject* GraphicsCaptureSession_get_MinUpdateInterval(py::wrapper::Windows::Graphics::Capture::GraphicsCaptureSession* self, void* /*unused*/) noexcept
    {
        try
        {
            static std::optional<bool> is_property_present{};

            if (!is_property_present.has_value())
            {
                is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Graphics.Capture.GraphicsCaptureSession", L"MinUpdateInterval");
            }

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

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

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

            if (!is_property_present.has_value())
            {
                is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Graphics.Capture.GraphicsCaptureSession", L"MinUpdateInterval");
            }

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

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

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

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

    static PyObject* GraphicsCaptureSession_get_IncludeSecondaryWindows(py::wrapper::Windows::Graphics::Capture::GraphicsCaptureSession* self, void* /*unused*/) noexcept
    {
        try
        {
            static std::optional<bool> is_property_present{};

            if (!is_property_present.has_value())
            {
                is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Graphics.Capture.GraphicsCaptureSession", L"IncludeSecondaryWindows");
            }

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

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

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

            if (!is_property_present.has_value())
            {
                is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Graphics.Capture.GraphicsCaptureSession", L"IncludeSecondaryWindows");
            }

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

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

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

    static PyObject* _from_GraphicsCaptureSession(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::Graphics::Capture::GraphicsCaptureSession>());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* _enter_GraphicsCaptureSession(py::wrapper::Windows::Graphics::Capture::GraphicsCaptureSession* self, PyObject* /*unused*/) noexcept
    {
        return Py_NewRef(self);
    }

    static PyObject* _exit_GraphicsCaptureSession(py::wrapper::Windows::Graphics::Capture::GraphicsCaptureSession* 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_GraphicsCaptureSession[] = {
        { "close", reinterpret_cast<PyCFunction>(GraphicsCaptureSession_Close), METH_VARARGS, nullptr },
        { "start_capture", reinterpret_cast<PyCFunction>(GraphicsCaptureSession_StartCapture), METH_VARARGS, nullptr },
        { "_assign_array_", _assign_array_GraphicsCaptureSession, METH_O | METH_STATIC, nullptr },
        { "_from", reinterpret_cast<PyCFunction>(_from_GraphicsCaptureSession), METH_O | METH_STATIC, nullptr },
        { "__enter__", reinterpret_cast<PyCFunction>(_enter_GraphicsCaptureSession), METH_NOARGS, nullptr },
        { "__exit__", reinterpret_cast<PyCFunction>(_exit_GraphicsCaptureSession), METH_VARARGS, nullptr },
        { }};

    static PyGetSetDef _getset_GraphicsCaptureSession[] = {
        { "is_cursor_capture_enabled", reinterpret_cast<getter>(GraphicsCaptureSession_get_IsCursorCaptureEnabled), reinterpret_cast<setter>(GraphicsCaptureSession_put_IsCursorCaptureEnabled), nullptr, nullptr },
        { "is_border_required", reinterpret_cast<getter>(GraphicsCaptureSession_get_IsBorderRequired), reinterpret_cast<setter>(GraphicsCaptureSession_put_IsBorderRequired), nullptr, nullptr },
        { "dirty_region_mode", reinterpret_cast<getter>(GraphicsCaptureSession_get_DirtyRegionMode), reinterpret_cast<setter>(GraphicsCaptureSession_put_DirtyRegionMode), nullptr, nullptr },
        { "min_update_interval", reinterpret_cast<getter>(GraphicsCaptureSession_get_MinUpdateInterval), reinterpret_cast<setter>(GraphicsCaptureSession_put_MinUpdateInterval), nullptr, nullptr },
        { "include_secondary_windows", reinterpret_cast<getter>(GraphicsCaptureSession_get_IncludeSecondaryWindows), reinterpret_cast<setter>(GraphicsCaptureSession_put_IncludeSecondaryWindows), nullptr, nullptr },
        { }};

    static PyType_Slot _type_slots_GraphicsCaptureSession[] = {
        { Py_tp_new, reinterpret_cast<void*>(_new_GraphicsCaptureSession) },
        { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_GraphicsCaptureSession) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_GraphicsCaptureSession) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_GraphicsCaptureSession) },
        { }};

    static PyType_Spec type_spec_GraphicsCaptureSession = {
        "winrt._winrt_windows_graphics_capture.GraphicsCaptureSession",
        sizeof(py::wrapper::Windows::Graphics::Capture::GraphicsCaptureSession),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_GraphicsCaptureSession};

    static PyGetSetDef getset_GraphicsCaptureSession_Static[] = {
        { }};

    static PyMethodDef methods_GraphicsCaptureSession_Static[] = {
        { "is_supported", reinterpret_cast<PyCFunction>(GraphicsCaptureSession_IsSupported), METH_VARARGS, nullptr },
        { }};

    static PyType_Slot type_slots_GraphicsCaptureSession_Static[] = 
    {
        { Py_tp_base, reinterpret_cast<void*>(&PyType_Type) },
        { Py_tp_getset, reinterpret_cast<void*>(getset_GraphicsCaptureSession_Static) },
        { Py_tp_methods, reinterpret_cast<void*>(methods_GraphicsCaptureSession_Static) },
        { }
    };

    static PyType_Spec type_spec_GraphicsCaptureSession_Static = {
        "winrt._winrt_windows_graphics_capture.GraphicsCaptureSession_Static",
        static_cast<int>(PyType_Type.tp_basicsize),
        static_cast<int>(PyType_Type.tp_itemsize),
        Py_TPFLAGS_DEFAULT,
        type_slots_GraphicsCaptureSession_Static};

    // ----- Windows.Graphics.Capture Initialization --------------------

    PyDoc_STRVAR(module_doc, "Windows.Graphics.Capture");

    static PyModuleDef module_def = {
        PyModuleDef_HEAD_INIT,
        "_winrt_windows_graphics_capture",
        module_doc,
        0,
        nullptr,
        nullptr,
        nullptr,
        nullptr,
        nullptr};
} // py::cpp::Windows::Graphics::Capture

PyMODINIT_FUNC PyInit__winrt_windows_graphics_capture(void) noexcept
{
    using namespace py::cpp::Windows::Graphics::Capture;

    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::pytype_handle Direct3D11CaptureFrame_type{py::register_python_type(module.get(), &type_spec_Direct3D11CaptureFrame, object_bases.get(), inspectable_meta_type)};
    if (!Direct3D11CaptureFrame_type)
    {
        return nullptr;
    }

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

    py::pyobj_handle type_Direct3D11CaptureFramePool_Static{PyType_FromSpecWithBases(&type_spec_Direct3D11CaptureFramePool_Static, Direct3D11CaptureFramePool_Static_bases.get())};
    if (!type_Direct3D11CaptureFramePool_Static)
    {
        return nullptr;
    }

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

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

    py::pyobj_handle type_GraphicsCaptureAccess_Static{PyType_FromSpecWithBases(&type_spec_GraphicsCaptureAccess_Static, GraphicsCaptureAccess_Static_bases.get())};
    if (!type_GraphicsCaptureAccess_Static)
    {
        return nullptr;
    }

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

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

    py::pyobj_handle type_GraphicsCaptureItem_Static{PyType_FromSpecWithBases(&type_spec_GraphicsCaptureItem_Static, GraphicsCaptureItem_Static_bases.get())};
    if (!type_GraphicsCaptureItem_Static)
    {
        return nullptr;
    }

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

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

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

    py::pyobj_handle type_GraphicsCaptureSession_Static{PyType_FromSpecWithBases(&type_spec_GraphicsCaptureSession_Static, GraphicsCaptureSession_Static_bases.get())};
    if (!type_GraphicsCaptureSession_Static)
    {
        return nullptr;
    }

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


    return module.detach();
}
