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

#include "py.Windows.Graphics.DirectX.Direct3D11.h"


namespace py::cpp::Windows::Graphics::DirectX::Direct3D11
{
    // ----- IDirect3DDevice interface --------------------

    static PyObject* _new_IDirect3DDevice(PyTypeObject* /*unused*/, PyObject* /*unused*/, PyObject* /*unused*/) noexcept
    {
        static_assert(py::py_type<winrt::Windows::Graphics::DirectX::Direct3D11::IDirect3DDevice>::type_name);
        py::set_invalid_activation_error(py::py_type<winrt::Windows::Graphics::DirectX::Direct3D11::IDirect3DDevice>::type_name);
        return nullptr;
    }

    static void _dealloc_IDirect3DDevice(py::wrapper::Windows::Graphics::DirectX::Direct3D11::IDirect3DDevice* self) noexcept
    {
        auto tp = Py_TYPE(self);
        std::destroy_at(&self->obj);
        tp->tp_free(self);
        Py_DECREF(tp);
    }

    static PyObject* IDirect3DDevice_Close(py::wrapper::Windows::Graphics::DirectX::Direct3D11::IDirect3DDevice* self, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_Size(args);

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

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

    static PyObject* IDirect3DDevice_Trim(py::wrapper::Windows::Graphics::DirectX::Direct3D11::IDirect3DDevice* self, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_Size(args);

        if (arg_count == 0)
        {
            if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Graphics.DirectX.Direct3D11.IDirect3DDevice", L"Trim", 0))
            {
                py::set_arg_count_version_error(0);
                return nullptr;
            }

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

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

    static PyObject* _from_IDirect3DDevice(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::DirectX::Direct3D11::IDirect3DDevice>());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* _enter_IDirect3DDevice(py::wrapper::Windows::Graphics::DirectX::Direct3D11::IDirect3DDevice* self, PyObject* /*unused*/) noexcept
    {
        return Py_NewRef(self);
    }

    static PyObject* _exit_IDirect3DDevice(py::wrapper::Windows::Graphics::DirectX::Direct3D11::IDirect3DDevice* self, PyObject* /*unused*/) noexcept
    {
        try
        {
            self->obj.Close();
            Py_RETURN_FALSE;
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyMethodDef _methods_IDirect3DDevice[] = {
        { "close", reinterpret_cast<PyCFunction>(IDirect3DDevice_Close), METH_VARARGS, nullptr },
        { "trim", reinterpret_cast<PyCFunction>(IDirect3DDevice_Trim), METH_VARARGS, nullptr },
        { "_assign_array_", _assign_array_IDirect3DDevice, METH_O | METH_STATIC, nullptr },
        { "_from", reinterpret_cast<PyCFunction>(_from_IDirect3DDevice), METH_O | METH_STATIC, nullptr },
        { "__enter__", reinterpret_cast<PyCFunction>(_enter_IDirect3DDevice), METH_NOARGS, nullptr },
        { "__exit__",  reinterpret_cast<PyCFunction>(_exit_IDirect3DDevice), METH_VARARGS, nullptr },
        { }
    };

    static PyGetSetDef _getset_IDirect3DDevice[] = {
        { }
    };

    static PyType_Slot _type_slots_IDirect3DDevice[] = 
    {
        { Py_tp_new, reinterpret_cast<void*>(_new_IDirect3DDevice) },
        { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_IDirect3DDevice) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_IDirect3DDevice) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_IDirect3DDevice) },
        { },
    };

    static PyType_Spec type_spec_IDirect3DDevice =
    {
        "winrt._winrt_windows_graphics_directx_direct3d11.IDirect3DDevice",
        sizeof(py::wrapper::Windows::Graphics::DirectX::Direct3D11::IDirect3DDevice),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_IDirect3DDevice
    };

    // ----- IDirect3DSurface interface --------------------

    static PyObject* _new_IDirect3DSurface(PyTypeObject* /*unused*/, PyObject* /*unused*/, PyObject* /*unused*/) noexcept
    {
        static_assert(py::py_type<winrt::Windows::Graphics::DirectX::Direct3D11::IDirect3DSurface>::type_name);
        py::set_invalid_activation_error(py::py_type<winrt::Windows::Graphics::DirectX::Direct3D11::IDirect3DSurface>::type_name);
        return nullptr;
    }

    static void _dealloc_IDirect3DSurface(py::wrapper::Windows::Graphics::DirectX::Direct3D11::IDirect3DSurface* self) noexcept
    {
        auto tp = Py_TYPE(self);
        std::destroy_at(&self->obj);
        tp->tp_free(self);
        Py_DECREF(tp);
    }

    static PyObject* IDirect3DSurface_Close(py::wrapper::Windows::Graphics::DirectX::Direct3D11::IDirect3DSurface* self, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_Size(args);

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

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

    static PyObject* IDirect3DSurface_get_Description(py::wrapper::Windows::Graphics::DirectX::Direct3D11::IDirect3DSurface* self, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Graphics.DirectX.Direct3D11.IDirect3DSurface", L"Description"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return nullptr;
        }

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

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

    static PyObject* _from_IDirect3DSurface(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::DirectX::Direct3D11::IDirect3DSurface>());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* _enter_IDirect3DSurface(py::wrapper::Windows::Graphics::DirectX::Direct3D11::IDirect3DSurface* self, PyObject* /*unused*/) noexcept
    {
        return Py_NewRef(self);
    }

    static PyObject* _exit_IDirect3DSurface(py::wrapper::Windows::Graphics::DirectX::Direct3D11::IDirect3DSurface* self, PyObject* /*unused*/) noexcept
    {
        try
        {
            self->obj.Close();
            Py_RETURN_FALSE;
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyMethodDef _methods_IDirect3DSurface[] = {
        { "close", reinterpret_cast<PyCFunction>(IDirect3DSurface_Close), METH_VARARGS, nullptr },
        { "_assign_array_", _assign_array_IDirect3DSurface, METH_O | METH_STATIC, nullptr },
        { "_from", reinterpret_cast<PyCFunction>(_from_IDirect3DSurface), METH_O | METH_STATIC, nullptr },
        { "__enter__", reinterpret_cast<PyCFunction>(_enter_IDirect3DSurface), METH_NOARGS, nullptr },
        { "__exit__",  reinterpret_cast<PyCFunction>(_exit_IDirect3DSurface), METH_VARARGS, nullptr },
        { }
    };

    static PyGetSetDef _getset_IDirect3DSurface[] = {
        { "description", reinterpret_cast<getter>(IDirect3DSurface_get_Description), nullptr, nullptr, nullptr },
        { }
    };

    static PyType_Slot _type_slots_IDirect3DSurface[] = 
    {
        { Py_tp_new, reinterpret_cast<void*>(_new_IDirect3DSurface) },
        { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_IDirect3DSurface) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_IDirect3DSurface) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_IDirect3DSurface) },
        { },
    };

    static PyType_Spec type_spec_IDirect3DSurface =
    {
        "winrt._winrt_windows_graphics_directx_direct3d11.IDirect3DSurface",
        sizeof(py::wrapper::Windows::Graphics::DirectX::Direct3D11::IDirect3DSurface),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_IDirect3DSurface
    };

    // ----- Direct3DMultisampleDescription struct --------------------

    winrt_struct_wrapper<winrt::Windows::Graphics::DirectX::Direct3D11::Direct3DMultisampleDescription>* _new_Direct3DMultisampleDescription(PyTypeObject* subclass, PyObject* /*unused*/, PyObject* /*unused*/) noexcept
    {
        auto self = reinterpret_cast<winrt_struct_wrapper<winrt::Windows::Graphics::DirectX::Direct3D11::Direct3DMultisampleDescription>*>(subclass->tp_alloc(subclass, 0));

        if (!self)
        {
            return nullptr;
        }

        std::construct_at(&self->obj);

        return self;
    }

    int _init_Direct3DMultisampleDescription(winrt_struct_wrapper<winrt::Windows::Graphics::DirectX::Direct3D11::Direct3DMultisampleDescription>* self, PyObject* args, PyObject* kwds) noexcept
    {
        auto tuple_size = PyTuple_Size(args);

        if ((tuple_size == 0) && (kwds == nullptr))
        {
            self->obj = {};
            return 0;
        }

        int32_t _Count{};
        int32_t _Quality{};

        static const char* kwlist[] = {"count", "quality", nullptr};
        if (!PyArg_ParseTupleAndKeywords(args, kwds, "ii", const_cast<char**>(kwlist), &_Count, &_Quality))
        {
            return -1;
        }

        try
        {
            self->obj = {_Count, _Quality};
            return 0;
        }
        catch (...)
        {
            py::to_PyErr();
            return -1;
        }
    }

    static void _dealloc_Direct3DMultisampleDescription(py::wrapper::Windows::Graphics::DirectX::Direct3D11::Direct3DMultisampleDescription* self) noexcept
    {
        auto tp = Py_TYPE(self);
        std::destroy_at(&self->obj);
        tp->tp_free(self);
        Py_DECREF(tp);
    }

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

    static PyMethodDef _methods_Direct3DMultisampleDescription[] = {
        { "_assign_array_", _assign_array_Direct3DMultisampleDescription, METH_O | METH_STATIC, nullptr },
        { }
    };

    static PyObject* Direct3DMultisampleDescription_get_Count(py::wrapper::Windows::Graphics::DirectX::Direct3D11::Direct3DMultisampleDescription* self, void* /*unused*/) noexcept
    {
        try
        {
            return py::convert(self->obj.Count);
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static int Direct3DMultisampleDescription_set_Count(py::wrapper::Windows::Graphics::DirectX::Direct3D11::Direct3DMultisampleDescription* self, PyObject* arg, void* /*unused*/) noexcept
    {
        if (arg == nullptr)
        {
            PyErr_SetString(PyExc_AttributeError, "can't delete attribute");
            return -1;
        }

        try
        {
            self->obj.Count = py::converter<int32_t>::convert_to(arg);
            return 0;
        }
        catch (...)
        {
            py::to_PyErr();
            return -1;
        }
    }

    static PyObject* Direct3DMultisampleDescription_get_Quality(py::wrapper::Windows::Graphics::DirectX::Direct3D11::Direct3DMultisampleDescription* self, void* /*unused*/) noexcept
    {
        try
        {
            return py::convert(self->obj.Quality);
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static int Direct3DMultisampleDescription_set_Quality(py::wrapper::Windows::Graphics::DirectX::Direct3D11::Direct3DMultisampleDescription* self, PyObject* arg, void* /*unused*/) noexcept
    {
        if (arg == nullptr)
        {
            PyErr_SetString(PyExc_AttributeError, "can't delete attribute");
            return -1;
        }

        try
        {
            self->obj.Quality = py::converter<int32_t>::convert_to(arg);
            return 0;
        }
        catch (...)
        {
            py::to_PyErr();
            return -1;
        }
    }

    static PyGetSetDef _getset_Direct3DMultisampleDescription[] = {
        { "count", reinterpret_cast<getter>(Direct3DMultisampleDescription_get_Count), reinterpret_cast<setter>(Direct3DMultisampleDescription_set_Count), nullptr, nullptr },
        { "quality", reinterpret_cast<getter>(Direct3DMultisampleDescription_get_Quality), reinterpret_cast<setter>(Direct3DMultisampleDescription_set_Quality), nullptr, nullptr },
        { }
    };

    static PyType_Slot _type_slots_Direct3DMultisampleDescription[] = 
    {
        { Py_tp_new, reinterpret_cast<void*>(_new_Direct3DMultisampleDescription) },
        { Py_tp_init, reinterpret_cast<void*>(_init_Direct3DMultisampleDescription) },
        { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_Direct3DMultisampleDescription) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_Direct3DMultisampleDescription) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_Direct3DMultisampleDescription) },
        { },
    };

    static PyType_Spec type_spec_Direct3DMultisampleDescription =
    {
        "winrt._winrt_windows_graphics_directx_direct3d11.Direct3DMultisampleDescription",
        sizeof(py::wrapper::Windows::Graphics::DirectX::Direct3D11::Direct3DMultisampleDescription),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_Direct3DMultisampleDescription
    };

    // ----- Direct3DSurfaceDescription struct --------------------

    winrt_struct_wrapper<winrt::Windows::Graphics::DirectX::Direct3D11::Direct3DSurfaceDescription>* _new_Direct3DSurfaceDescription(PyTypeObject* subclass, PyObject* /*unused*/, PyObject* /*unused*/) noexcept
    {
        auto self = reinterpret_cast<winrt_struct_wrapper<winrt::Windows::Graphics::DirectX::Direct3D11::Direct3DSurfaceDescription>*>(subclass->tp_alloc(subclass, 0));

        if (!self)
        {
            return nullptr;
        }

        std::construct_at(&self->obj);

        return self;
    }

    int _init_Direct3DSurfaceDescription(winrt_struct_wrapper<winrt::Windows::Graphics::DirectX::Direct3D11::Direct3DSurfaceDescription>* self, PyObject* args, PyObject* kwds) noexcept
    {
        auto tuple_size = PyTuple_Size(args);

        if ((tuple_size == 0) && (kwds == nullptr))
        {
            self->obj = {};
            return 0;
        }

        int32_t _Width{};
        int32_t _Height{};
        int32_t _Format{};
        PyObject* _MultisampleDescription{};

        static const char* kwlist[] = {"width", "height", "format", "multisample_description", nullptr};
        if (!PyArg_ParseTupleAndKeywords(args, kwds, "iiiO", const_cast<char**>(kwlist), &_Width, &_Height, &_Format, &_MultisampleDescription))
        {
            return -1;
        }

        try
        {
            self->obj = {_Width, _Height, static_cast<winrt::Windows::Graphics::DirectX::DirectXPixelFormat>(_Format), py::converter<winrt::Windows::Graphics::DirectX::Direct3D11::Direct3DMultisampleDescription>::convert_to(_MultisampleDescription)};
            return 0;
        }
        catch (...)
        {
            py::to_PyErr();
            return -1;
        }
    }

    static void _dealloc_Direct3DSurfaceDescription(py::wrapper::Windows::Graphics::DirectX::Direct3D11::Direct3DSurfaceDescription* self) noexcept
    {
        auto tp = Py_TYPE(self);
        std::destroy_at(&self->obj);
        tp->tp_free(self);
        Py_DECREF(tp);
    }

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

    static PyMethodDef _methods_Direct3DSurfaceDescription[] = {
        { "_assign_array_", _assign_array_Direct3DSurfaceDescription, METH_O | METH_STATIC, nullptr },
        { }
    };

    static PyObject* Direct3DSurfaceDescription_get_Width(py::wrapper::Windows::Graphics::DirectX::Direct3D11::Direct3DSurfaceDescription* self, void* /*unused*/) noexcept
    {
        try
        {
            return py::convert(self->obj.Width);
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static int Direct3DSurfaceDescription_set_Width(py::wrapper::Windows::Graphics::DirectX::Direct3D11::Direct3DSurfaceDescription* self, PyObject* arg, void* /*unused*/) noexcept
    {
        if (arg == nullptr)
        {
            PyErr_SetString(PyExc_AttributeError, "can't delete attribute");
            return -1;
        }

        try
        {
            self->obj.Width = py::converter<int32_t>::convert_to(arg);
            return 0;
        }
        catch (...)
        {
            py::to_PyErr();
            return -1;
        }
    }

    static PyObject* Direct3DSurfaceDescription_get_Height(py::wrapper::Windows::Graphics::DirectX::Direct3D11::Direct3DSurfaceDescription* self, void* /*unused*/) noexcept
    {
        try
        {
            return py::convert(self->obj.Height);
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static int Direct3DSurfaceDescription_set_Height(py::wrapper::Windows::Graphics::DirectX::Direct3D11::Direct3DSurfaceDescription* self, PyObject* arg, void* /*unused*/) noexcept
    {
        if (arg == nullptr)
        {
            PyErr_SetString(PyExc_AttributeError, "can't delete attribute");
            return -1;
        }

        try
        {
            self->obj.Height = py::converter<int32_t>::convert_to(arg);
            return 0;
        }
        catch (...)
        {
            py::to_PyErr();
            return -1;
        }
    }

    static PyObject* Direct3DSurfaceDescription_get_Format(py::wrapper::Windows::Graphics::DirectX::Direct3D11::Direct3DSurfaceDescription* self, void* /*unused*/) noexcept
    {
        try
        {
            return py::convert(self->obj.Format);
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static int Direct3DSurfaceDescription_set_Format(py::wrapper::Windows::Graphics::DirectX::Direct3D11::Direct3DSurfaceDescription* self, PyObject* arg, void* /*unused*/) noexcept
    {
        if (arg == nullptr)
        {
            PyErr_SetString(PyExc_AttributeError, "can't delete attribute");
            return -1;
        }

        try
        {
            self->obj.Format = py::converter<winrt::Windows::Graphics::DirectX::DirectXPixelFormat>::convert_to(arg);
            return 0;
        }
        catch (...)
        {
            py::to_PyErr();
            return -1;
        }
    }

    static PyObject* Direct3DSurfaceDescription_get_MultisampleDescription(py::wrapper::Windows::Graphics::DirectX::Direct3D11::Direct3DSurfaceDescription* self, void* /*unused*/) noexcept
    {
        try
        {
            return py::convert(self->obj.MultisampleDescription);
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static int Direct3DSurfaceDescription_set_MultisampleDescription(py::wrapper::Windows::Graphics::DirectX::Direct3D11::Direct3DSurfaceDescription* self, PyObject* arg, void* /*unused*/) noexcept
    {
        if (arg == nullptr)
        {
            PyErr_SetString(PyExc_AttributeError, "can't delete attribute");
            return -1;
        }

        try
        {
            self->obj.MultisampleDescription = py::converter<winrt::Windows::Graphics::DirectX::Direct3D11::Direct3DMultisampleDescription>::convert_to(arg);
            return 0;
        }
        catch (...)
        {
            py::to_PyErr();
            return -1;
        }
    }

    static PyGetSetDef _getset_Direct3DSurfaceDescription[] = {
        { "width", reinterpret_cast<getter>(Direct3DSurfaceDescription_get_Width), reinterpret_cast<setter>(Direct3DSurfaceDescription_set_Width), nullptr, nullptr },
        { "height", reinterpret_cast<getter>(Direct3DSurfaceDescription_get_Height), reinterpret_cast<setter>(Direct3DSurfaceDescription_set_Height), nullptr, nullptr },
        { "format", reinterpret_cast<getter>(Direct3DSurfaceDescription_get_Format), reinterpret_cast<setter>(Direct3DSurfaceDescription_set_Format), nullptr, nullptr },
        { "multisample_description", reinterpret_cast<getter>(Direct3DSurfaceDescription_get_MultisampleDescription), reinterpret_cast<setter>(Direct3DSurfaceDescription_set_MultisampleDescription), nullptr, nullptr },
        { }
    };

    static PyType_Slot _type_slots_Direct3DSurfaceDescription[] = 
    {
        { Py_tp_new, reinterpret_cast<void*>(_new_Direct3DSurfaceDescription) },
        { Py_tp_init, reinterpret_cast<void*>(_init_Direct3DSurfaceDescription) },
        { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_Direct3DSurfaceDescription) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_Direct3DSurfaceDescription) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_Direct3DSurfaceDescription) },
        { },
    };

    static PyType_Spec type_spec_Direct3DSurfaceDescription =
    {
        "winrt._winrt_windows_graphics_directx_direct3d11.Direct3DSurfaceDescription",
        sizeof(py::wrapper::Windows::Graphics::DirectX::Direct3D11::Direct3DSurfaceDescription),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_Direct3DSurfaceDescription
    };

    // ----- Windows.Graphics.DirectX.Direct3D11 Initialization --------------------
    PyDoc_STRVAR(module_doc, "Windows::Graphics::DirectX::Direct3D11");


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

} // py::cpp::Windows::Graphics::DirectX::Direct3D11

PyMODINIT_FUNC PyInit__winrt_windows_graphics_directx_direct3d11(void) noexcept
{
    using namespace py::cpp::Windows::Graphics::DirectX::Direct3D11;

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

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

    if (!module)
    {
        return nullptr;
    }

    auto object_type = py::get_object_type();
    if (!object_type)
    {
        return nullptr;
    }

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

    if (!object_bases)
    {
        return nullptr;
    }

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

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

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

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


    return module.detach();
}
