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

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


PyObject* py::converter<winrt::Windows::Graphics::DisplayAdapterId>::convert(winrt::Windows::Graphics::DisplayAdapterId instance) noexcept
{
    auto type = py::get_python_type<winrt::Windows::Graphics::DisplayAdapterId>();
    if (!type)
    {
        return nullptr;
    }

    return py::wrap_struct(instance, type);
}
winrt::Windows::Graphics::DisplayAdapterId py::converter<winrt::Windows::Graphics::DisplayAdapterId>::convert_to(PyObject* obj)
{
    throw_if_pyobj_null(obj);

    auto type =  py::get_python_type<winrt::Windows::Graphics::DisplayAdapterId>();

    if (!type) {
        throw python_exception();
    }

    if (Py_TYPE(obj) == type)
    {
        return reinterpret_cast<py::winrt_struct_wrapper<winrt::Windows::Graphics::DisplayAdapterId>*>(obj)->obj;
    }

    PyErr_SetString(PyExc_TypeError, "expecting winrt::Windows::Graphics::DisplayAdapterId");
    throw python_exception();
}

PyObject* py::converter<winrt::Windows::Graphics::DisplayId>::convert(winrt::Windows::Graphics::DisplayId instance) noexcept
{
    auto type = py::get_python_type<winrt::Windows::Graphics::DisplayId>();
    if (!type)
    {
        return nullptr;
    }

    return py::wrap_struct(instance, type);
}
winrt::Windows::Graphics::DisplayId py::converter<winrt::Windows::Graphics::DisplayId>::convert_to(PyObject* obj)
{
    throw_if_pyobj_null(obj);

    auto type =  py::get_python_type<winrt::Windows::Graphics::DisplayId>();

    if (!type) {
        throw python_exception();
    }

    if (Py_TYPE(obj) == type)
    {
        return reinterpret_cast<py::winrt_struct_wrapper<winrt::Windows::Graphics::DisplayId>*>(obj)->obj;
    }

    PyErr_SetString(PyExc_TypeError, "expecting winrt::Windows::Graphics::DisplayId");
    throw python_exception();
}

PyObject* py::converter<winrt::Windows::Graphics::PointInt32>::convert(winrt::Windows::Graphics::PointInt32 instance) noexcept
{
    auto type = py::get_python_type<winrt::Windows::Graphics::PointInt32>();
    if (!type)
    {
        return nullptr;
    }

    return py::wrap_struct(instance, type);
}
winrt::Windows::Graphics::PointInt32 py::converter<winrt::Windows::Graphics::PointInt32>::convert_to(PyObject* obj)
{
    throw_if_pyobj_null(obj);

    auto type =  py::get_python_type<winrt::Windows::Graphics::PointInt32>();

    if (!type) {
        throw python_exception();
    }

    if (Py_TYPE(obj) == type)
    {
        return reinterpret_cast<py::winrt_struct_wrapper<winrt::Windows::Graphics::PointInt32>*>(obj)->obj;
    }

    PyErr_SetString(PyExc_TypeError, "expecting winrt::Windows::Graphics::PointInt32");
    throw python_exception();
}

PyObject* py::converter<winrt::Windows::Graphics::RectInt32>::convert(winrt::Windows::Graphics::RectInt32 instance) noexcept
{
    auto type = py::get_python_type<winrt::Windows::Graphics::RectInt32>();
    if (!type)
    {
        return nullptr;
    }

    return py::wrap_struct(instance, type);
}
winrt::Windows::Graphics::RectInt32 py::converter<winrt::Windows::Graphics::RectInt32>::convert_to(PyObject* obj)
{
    throw_if_pyobj_null(obj);

    auto type =  py::get_python_type<winrt::Windows::Graphics::RectInt32>();

    if (!type) {
        throw python_exception();
    }

    if (Py_TYPE(obj) == type)
    {
        return reinterpret_cast<py::winrt_struct_wrapper<winrt::Windows::Graphics::RectInt32>*>(obj)->obj;
    }

    PyErr_SetString(PyExc_TypeError, "expecting winrt::Windows::Graphics::RectInt32");
    throw python_exception();
}

PyObject* py::converter<winrt::Windows::Graphics::SizeInt32>::convert(winrt::Windows::Graphics::SizeInt32 instance) noexcept
{
    auto type = py::get_python_type<winrt::Windows::Graphics::SizeInt32>();
    if (!type)
    {
        return nullptr;
    }

    return py::wrap_struct(instance, type);
}
winrt::Windows::Graphics::SizeInt32 py::converter<winrt::Windows::Graphics::SizeInt32>::convert_to(PyObject* obj)
{
    throw_if_pyobj_null(obj);

    auto type =  py::get_python_type<winrt::Windows::Graphics::SizeInt32>();

    if (!type) {
        throw python_exception();
    }

    if (Py_TYPE(obj) == type)
    {
        return reinterpret_cast<py::winrt_struct_wrapper<winrt::Windows::Graphics::SizeInt32>*>(obj)->obj;
    }

    PyErr_SetString(PyExc_TypeError, "expecting winrt::Windows::Graphics::SizeInt32");
    throw python_exception();
}

namespace py::cpp::Windows::Graphics
{
    struct module_state
    {
        PyTypeObject* type_IGeometrySource2D;
        PyTypeObject* type_DisplayAdapterId;
        PyTypeObject* type_DisplayId;
        PyTypeObject* type_PointInt32;
        PyTypeObject* type_RectInt32;
        PyTypeObject* type_SizeInt32;
    };

    // ----- IGeometrySource2D interface --------------------
    static constexpr const char* const type_name_IGeometrySource2D = "IGeometrySource2D";

    static PyObject* _new_IGeometrySource2D(PyTypeObject* /* unused */, PyObject* /* unused */, PyObject* /* unused */) noexcept
    {
        py::set_invalid_activation_error(type_name_IGeometrySource2D);
        return nullptr;
    }

    static void _dealloc_IGeometrySource2D(py::wrapper::Windows::Graphics::IGeometrySource2D* self) noexcept
    {
        auto tp = Py_TYPE(self);

        if (PyType_IS_GC(tp))
        {
            PyObject_GC_UnTrack(self);
        }

        std::destroy_at(&self->obj);
        tp->tp_free(self);
        Py_DECREF(tp);
    }

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

    static PyObject* _from_IGeometrySource2D(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::IGeometrySource2D>());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyMethodDef _methods_IGeometrySource2D[] = {
        { "_assign_array_", _assign_array_IGeometrySource2D, METH_O | METH_STATIC, nullptr },
        { "_from", reinterpret_cast<PyCFunction>(_from_IGeometrySource2D), METH_O | METH_STATIC, nullptr },
        { }
    };

    static PyGetSetDef _getset_IGeometrySource2D[] = {
        { }
    };

    static PyType_Slot _type_slots_IGeometrySource2D[] = 
    {
        { Py_tp_new, reinterpret_cast<void*>(_new_IGeometrySource2D) },
        { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_IGeometrySource2D) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_IGeometrySource2D) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_IGeometrySource2D) },
        { },
    };

    static PyType_Spec type_spec_IGeometrySource2D =
    {
        "_winsdk_Windows_Graphics.IGeometrySource2D",
        sizeof(py::wrapper::Windows::Graphics::IGeometrySource2D),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_IGeometrySource2D
    };

    // ----- DisplayAdapterId struct --------------------
    static constexpr const char* const type_name_DisplayAdapterId = "DisplayAdapterId";

    PyObject* _new_DisplayAdapterId(PyTypeObject* type, PyObject* args, PyObject* kwds)
    {
        auto tuple_size = PyTuple_Size(args);

        if ((tuple_size == 0) && (kwds == nullptr))
        {
            try
            {
                winrt::Windows::Graphics::DisplayAdapterId return_value{};
                return py::convert(return_value);
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }

        uint32_t _LowPart{};
        int32_t _HighPart{};

        static const char* kwlist[] = {"low_part", "high_part", nullptr};
        if (!PyArg_ParseTupleAndKeywords(args, kwds, "Ii", const_cast<char**>(kwlist), &_LowPart, &_HighPart))
        {
            return nullptr;
        }

        try
        {
            winrt::Windows::Graphics::DisplayAdapterId return_value{ _LowPart, _HighPart };
            return py::convert(return_value);
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static void _dealloc_DisplayAdapterId(py::wrapper::Windows::Graphics::DisplayAdapterId* self) noexcept
    {
    }

    static PyObject* DisplayAdapterId_get_LowPart(py::wrapper::Windows::Graphics::DisplayAdapterId* self, void* /*unused*/) noexcept
    {
        try
        {
            return py::convert(self->obj.LowPart);
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

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

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

    static PyObject* DisplayAdapterId_get_HighPart(py::wrapper::Windows::Graphics::DisplayAdapterId* self, void* /*unused*/) noexcept
    {
        try
        {
            return py::convert(self->obj.HighPart);
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

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

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

    static PyGetSetDef _getset_DisplayAdapterId[] = {
        { "low_part", reinterpret_cast<getter>(DisplayAdapterId_get_LowPart), reinterpret_cast<setter>(DisplayAdapterId_set_LowPart), nullptr, nullptr },
        { "high_part", reinterpret_cast<getter>(DisplayAdapterId_get_HighPart), reinterpret_cast<setter>(DisplayAdapterId_set_HighPart), nullptr, nullptr },
        { }
    };

    static PyType_Slot _type_slots_DisplayAdapterId[] = 
    {
        { Py_tp_new, reinterpret_cast<void*>(_new_DisplayAdapterId) },
        { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_DisplayAdapterId) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_DisplayAdapterId) },
        { },
    };

    static PyType_Spec type_spec_DisplayAdapterId =
    {
        "_winsdk_Windows_Graphics.DisplayAdapterId",
        sizeof(py::wrapper::Windows::Graphics::DisplayAdapterId),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_DisplayAdapterId
    };

    // ----- DisplayId struct --------------------
    static constexpr const char* const type_name_DisplayId = "DisplayId";

    PyObject* _new_DisplayId(PyTypeObject* type, PyObject* args, PyObject* kwds)
    {
        auto tuple_size = PyTuple_Size(args);

        if ((tuple_size == 0) && (kwds == nullptr))
        {
            try
            {
                winrt::Windows::Graphics::DisplayId return_value{};
                return py::convert(return_value);
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }

        uint64_t _Value{};

        static const char* kwlist[] = {"value", nullptr};
        if (!PyArg_ParseTupleAndKeywords(args, kwds, "K", const_cast<char**>(kwlist), &_Value))
        {
            return nullptr;
        }

        try
        {
            winrt::Windows::Graphics::DisplayId return_value{ _Value };
            return py::convert(return_value);
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static void _dealloc_DisplayId(py::wrapper::Windows::Graphics::DisplayId* self) noexcept
    {
    }

    static PyObject* DisplayId_get_Value(py::wrapper::Windows::Graphics::DisplayId* self, void* /*unused*/) noexcept
    {
        try
        {
            return py::convert(self->obj.Value);
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

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

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

    static PyGetSetDef _getset_DisplayId[] = {
        { "value", reinterpret_cast<getter>(DisplayId_get_Value), reinterpret_cast<setter>(DisplayId_set_Value), nullptr, nullptr },
        { }
    };

    static PyType_Slot _type_slots_DisplayId[] = 
    {
        { Py_tp_new, reinterpret_cast<void*>(_new_DisplayId) },
        { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_DisplayId) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_DisplayId) },
        { },
    };

    static PyType_Spec type_spec_DisplayId =
    {
        "_winsdk_Windows_Graphics.DisplayId",
        sizeof(py::wrapper::Windows::Graphics::DisplayId),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_DisplayId
    };

    // ----- PointInt32 struct --------------------
    static constexpr const char* const type_name_PointInt32 = "PointInt32";

    PyObject* _new_PointInt32(PyTypeObject* type, PyObject* args, PyObject* kwds)
    {
        auto tuple_size = PyTuple_Size(args);

        if ((tuple_size == 0) && (kwds == nullptr))
        {
            try
            {
                winrt::Windows::Graphics::PointInt32 return_value{};
                return py::convert(return_value);
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }

        int32_t _X{};
        int32_t _Y{};

        static const char* kwlist[] = {"x", "y", nullptr};
        if (!PyArg_ParseTupleAndKeywords(args, kwds, "ii", const_cast<char**>(kwlist), &_X, &_Y))
        {
            return nullptr;
        }

        try
        {
            winrt::Windows::Graphics::PointInt32 return_value{ _X, _Y };
            return py::convert(return_value);
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static void _dealloc_PointInt32(py::wrapper::Windows::Graphics::PointInt32* self) noexcept
    {
    }

    static PyObject* PointInt32_get_X(py::wrapper::Windows::Graphics::PointInt32* self, void* /*unused*/) noexcept
    {
        try
        {
            return py::convert(self->obj.X);
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

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

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

    static PyObject* PointInt32_get_Y(py::wrapper::Windows::Graphics::PointInt32* self, void* /*unused*/) noexcept
    {
        try
        {
            return py::convert(self->obj.Y);
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

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

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

    static PyGetSetDef _getset_PointInt32[] = {
        { "x", reinterpret_cast<getter>(PointInt32_get_X), reinterpret_cast<setter>(PointInt32_set_X), nullptr, nullptr },
        { "y", reinterpret_cast<getter>(PointInt32_get_Y), reinterpret_cast<setter>(PointInt32_set_Y), nullptr, nullptr },
        { }
    };

    static PyType_Slot _type_slots_PointInt32[] = 
    {
        { Py_tp_new, reinterpret_cast<void*>(_new_PointInt32) },
        { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_PointInt32) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_PointInt32) },
        { },
    };

    static PyType_Spec type_spec_PointInt32 =
    {
        "_winsdk_Windows_Graphics.PointInt32",
        sizeof(py::wrapper::Windows::Graphics::PointInt32),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_PointInt32
    };

    // ----- RectInt32 struct --------------------
    static constexpr const char* const type_name_RectInt32 = "RectInt32";

    PyObject* _new_RectInt32(PyTypeObject* type, PyObject* args, PyObject* kwds)
    {
        auto tuple_size = PyTuple_Size(args);

        if ((tuple_size == 0) && (kwds == nullptr))
        {
            try
            {
                winrt::Windows::Graphics::RectInt32 return_value{};
                return py::convert(return_value);
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }

        int32_t _X{};
        int32_t _Y{};
        int32_t _Width{};
        int32_t _Height{};

        static const char* kwlist[] = {"x", "y", "width", "height", nullptr};
        if (!PyArg_ParseTupleAndKeywords(args, kwds, "iiii", const_cast<char**>(kwlist), &_X, &_Y, &_Width, &_Height))
        {
            return nullptr;
        }

        try
        {
            winrt::Windows::Graphics::RectInt32 return_value{ _X, _Y, _Width, _Height };
            return py::convert(return_value);
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static void _dealloc_RectInt32(py::wrapper::Windows::Graphics::RectInt32* self) noexcept
    {
    }

    static PyObject* RectInt32_get_X(py::wrapper::Windows::Graphics::RectInt32* self, void* /*unused*/) noexcept
    {
        try
        {
            return py::convert(self->obj.X);
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

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

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

    static PyObject* RectInt32_get_Y(py::wrapper::Windows::Graphics::RectInt32* self, void* /*unused*/) noexcept
    {
        try
        {
            return py::convert(self->obj.Y);
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

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

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

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

    static int RectInt32_set_Width(py::wrapper::Windows::Graphics::RectInt32* 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* RectInt32_get_Height(py::wrapper::Windows::Graphics::RectInt32* self, void* /*unused*/) noexcept
    {
        try
        {
            return py::convert(self->obj.Height);
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static int RectInt32_set_Height(py::wrapper::Windows::Graphics::RectInt32* 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 PyGetSetDef _getset_RectInt32[] = {
        { "x", reinterpret_cast<getter>(RectInt32_get_X), reinterpret_cast<setter>(RectInt32_set_X), nullptr, nullptr },
        { "y", reinterpret_cast<getter>(RectInt32_get_Y), reinterpret_cast<setter>(RectInt32_set_Y), nullptr, nullptr },
        { "width", reinterpret_cast<getter>(RectInt32_get_Width), reinterpret_cast<setter>(RectInt32_set_Width), nullptr, nullptr },
        { "height", reinterpret_cast<getter>(RectInt32_get_Height), reinterpret_cast<setter>(RectInt32_set_Height), nullptr, nullptr },
        { }
    };

    static PyType_Slot _type_slots_RectInt32[] = 
    {
        { Py_tp_new, reinterpret_cast<void*>(_new_RectInt32) },
        { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_RectInt32) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_RectInt32) },
        { },
    };

    static PyType_Spec type_spec_RectInt32 =
    {
        "_winsdk_Windows_Graphics.RectInt32",
        sizeof(py::wrapper::Windows::Graphics::RectInt32),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_RectInt32
    };

    // ----- SizeInt32 struct --------------------
    static constexpr const char* const type_name_SizeInt32 = "SizeInt32";

    PyObject* _new_SizeInt32(PyTypeObject* type, PyObject* args, PyObject* kwds)
    {
        auto tuple_size = PyTuple_Size(args);

        if ((tuple_size == 0) && (kwds == nullptr))
        {
            try
            {
                winrt::Windows::Graphics::SizeInt32 return_value{};
                return py::convert(return_value);
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }

        int32_t _Width{};
        int32_t _Height{};

        static const char* kwlist[] = {"width", "height", nullptr};
        if (!PyArg_ParseTupleAndKeywords(args, kwds, "ii", const_cast<char**>(kwlist), &_Width, &_Height))
        {
            return nullptr;
        }

        try
        {
            winrt::Windows::Graphics::SizeInt32 return_value{ _Width, _Height };
            return py::convert(return_value);
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static void _dealloc_SizeInt32(py::wrapper::Windows::Graphics::SizeInt32* self) noexcept
    {
    }

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

    static int SizeInt32_set_Width(py::wrapper::Windows::Graphics::SizeInt32* 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* SizeInt32_get_Height(py::wrapper::Windows::Graphics::SizeInt32* self, void* /*unused*/) noexcept
    {
        try
        {
            return py::convert(self->obj.Height);
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static int SizeInt32_set_Height(py::wrapper::Windows::Graphics::SizeInt32* 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 PyGetSetDef _getset_SizeInt32[] = {
        { "width", reinterpret_cast<getter>(SizeInt32_get_Width), reinterpret_cast<setter>(SizeInt32_set_Width), nullptr, nullptr },
        { "height", reinterpret_cast<getter>(SizeInt32_get_Height), reinterpret_cast<setter>(SizeInt32_set_Height), nullptr, nullptr },
        { }
    };

    static PyType_Slot _type_slots_SizeInt32[] = 
    {
        { Py_tp_new, reinterpret_cast<void*>(_new_SizeInt32) },
        { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_SizeInt32) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_SizeInt32) },
        { },
    };

    static PyType_Spec type_spec_SizeInt32 =
    {
        "_winsdk_Windows_Graphics.SizeInt32",
        sizeof(py::wrapper::Windows::Graphics::SizeInt32),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_SizeInt32
    };

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

    static PyMethodDef module_methods[] = {
        {}};


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

        if (!state)
        {
            return 0;
        }

        Py_VISIT(state->type_IGeometrySource2D);
        Py_VISIT(state->type_DisplayAdapterId);
        Py_VISIT(state->type_DisplayId);
        Py_VISIT(state->type_PointInt32);
        Py_VISIT(state->type_RectInt32);
        Py_VISIT(state->type_SizeInt32);

        return 0;
    }

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

        if (!state)
        {
            return 0;
        }

        Py_CLEAR(state->type_IGeometrySource2D);
        Py_CLEAR(state->type_DisplayAdapterId);
        Py_CLEAR(state->type_DisplayId);
        Py_CLEAR(state->type_PointInt32);
        Py_CLEAR(state->type_RectInt32);
        Py_CLEAR(state->type_SizeInt32);

        return 0;
    }


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

} // py::cpp::Windows::Graphics

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

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

    if (!module)
    {
        return nullptr;
    }

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

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

    if (!bases)
    {
        return nullptr;
    }

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

    if (!collections_abc_module)
    {
        return nullptr;
    }

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

    if (!sequence_type)
    {
        return nullptr;
    }

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

    if (!sequence_bases)
    {
        return nullptr;
    }

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

    if (!mutable_sequence_type)
    {
        return nullptr;
    }

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

    if (!mutable_sequence_bases)
    {
        return nullptr;
    }

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

    if (!mapping_type)
    {
        return nullptr;
    }

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

    if (!mapping_bases)
    {
        return nullptr;
    }

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

    if (!mutable_mapping_type)
    {
        return nullptr;
    }

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

    if (!mutable_mapping_bases)
    {
        return nullptr;
    }

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

    state->type_IGeometrySource2D = py::register_python_type(module.get(), type_name_IGeometrySource2D, &type_spec_IGeometrySource2D, bases.get(), nullptr);
    if (!state->type_IGeometrySource2D)
    {
        return nullptr;
    }

    state->type_DisplayAdapterId = py::register_python_type(module.get(), type_name_DisplayAdapterId, &type_spec_DisplayAdapterId, bases.get(), nullptr);
    if (!state->type_DisplayAdapterId)
    {
        return nullptr;
    }

    state->type_DisplayId = py::register_python_type(module.get(), type_name_DisplayId, &type_spec_DisplayId, bases.get(), nullptr);
    if (!state->type_DisplayId)
    {
        return nullptr;
    }

    state->type_PointInt32 = py::register_python_type(module.get(), type_name_PointInt32, &type_spec_PointInt32, bases.get(), nullptr);
    if (!state->type_PointInt32)
    {
        return nullptr;
    }

    state->type_RectInt32 = py::register_python_type(module.get(), type_name_RectInt32, &type_spec_RectInt32, bases.get(), nullptr);
    if (!state->type_RectInt32)
    {
        return nullptr;
    }

    state->type_SizeInt32 = py::register_python_type(module.get(), type_name_SizeInt32, &type_spec_SizeInt32, bases.get(), nullptr);
    if (!state->type_SizeInt32)
    {
        return nullptr;
    }


    return module.detach();
}

PyTypeObject* py::winrt_type<winrt::Windows::Graphics::IGeometrySource2D>::get_python_type() noexcept {
    using namespace py::cpp::Windows::Graphics;

    PyObject* module = PyState_FindModule(&module_def);

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

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

    auto python_type = state->type_IGeometrySource2D;

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

    return python_type;
}

PyTypeObject* py::winrt_type<winrt::Windows::Graphics::DisplayAdapterId>::get_python_type() noexcept {
    using namespace py::cpp::Windows::Graphics;

    PyObject* module = PyState_FindModule(&module_def);

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

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

    auto python_type = state->type_DisplayAdapterId;

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

    return python_type;
}

PyTypeObject* py::winrt_type<winrt::Windows::Graphics::DisplayId>::get_python_type() noexcept {
    using namespace py::cpp::Windows::Graphics;

    PyObject* module = PyState_FindModule(&module_def);

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

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

    auto python_type = state->type_DisplayId;

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

    return python_type;
}

PyTypeObject* py::winrt_type<winrt::Windows::Graphics::PointInt32>::get_python_type() noexcept {
    using namespace py::cpp::Windows::Graphics;

    PyObject* module = PyState_FindModule(&module_def);

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

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

    auto python_type = state->type_PointInt32;

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

    return python_type;
}

PyTypeObject* py::winrt_type<winrt::Windows::Graphics::RectInt32>::get_python_type() noexcept {
    using namespace py::cpp::Windows::Graphics;

    PyObject* module = PyState_FindModule(&module_def);

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

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

    auto python_type = state->type_RectInt32;

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

    return python_type;
}

PyTypeObject* py::winrt_type<winrt::Windows::Graphics::SizeInt32>::get_python_type() noexcept {
    using namespace py::cpp::Windows::Graphics;

    PyObject* module = PyState_FindModule(&module_def);

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

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

    auto python_type = state->type_SizeInt32;

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

    return python_type;
}
