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

#include "py.Windows.Devices.Spi.h"

namespace py::cpp::Windows::Devices::Spi
{
    // ----- SpiBusInfo class --------------------

    static PyObject* _new_SpiBusInfo(PyTypeObject* /*unused*/, PyObject* /*unused*/, PyObject* /*unused*/) noexcept
    {
        static_assert(py::py_type<winrt::Windows::Devices::Spi::SpiBusInfo>::type_name);
        py::set_invalid_activation_error(py::py_type<winrt::Windows::Devices::Spi::SpiBusInfo>::type_name);
        return nullptr;
    }

    static void _dealloc_SpiBusInfo(py::wrapper::Windows::Devices::Spi::SpiBusInfo* self) noexcept
    {
        auto tp = Py_TYPE(self);
        std::destroy_at(&self->obj);
        tp->tp_free(self);
        Py_DECREF(tp);
    }

    static PyObject* SpiBusInfo_get_ChipSelectLineCount(py::wrapper::Windows::Devices::Spi::SpiBusInfo* 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.Devices.Spi.SpiBusInfo", L"ChipSelectLineCount");
            }

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

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

    static PyObject* SpiBusInfo_get_MaxClockFrequency(py::wrapper::Windows::Devices::Spi::SpiBusInfo* 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.Devices.Spi.SpiBusInfo", L"MaxClockFrequency");
            }

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

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

    static PyObject* SpiBusInfo_get_MinClockFrequency(py::wrapper::Windows::Devices::Spi::SpiBusInfo* 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.Devices.Spi.SpiBusInfo", L"MinClockFrequency");
            }

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

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

    static PyObject* SpiBusInfo_get_SupportedDataBitLengths(py::wrapper::Windows::Devices::Spi::SpiBusInfo* 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.Devices.Spi.SpiBusInfo", L"SupportedDataBitLengths");
            }

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

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

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

    static PyObject* _from_SpiBusInfo(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::Devices::Spi::SpiBusInfo>());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyMethodDef _methods_SpiBusInfo[] = {
        { "_assign_array_", _assign_array_SpiBusInfo, METH_O | METH_STATIC, nullptr },
        { "_from", reinterpret_cast<PyCFunction>(_from_SpiBusInfo), METH_O | METH_STATIC, nullptr },
        { }
    };

    static PyGetSetDef _getset_SpiBusInfo[] = {
        { "chip_select_line_count", reinterpret_cast<getter>(SpiBusInfo_get_ChipSelectLineCount), nullptr, nullptr, nullptr },
        { "max_clock_frequency", reinterpret_cast<getter>(SpiBusInfo_get_MaxClockFrequency), nullptr, nullptr, nullptr },
        { "min_clock_frequency", reinterpret_cast<getter>(SpiBusInfo_get_MinClockFrequency), nullptr, nullptr, nullptr },
        { "supported_data_bit_lengths", reinterpret_cast<getter>(SpiBusInfo_get_SupportedDataBitLengths), nullptr, nullptr, nullptr },
        { }
    };

    static PyType_Slot _type_slots_SpiBusInfo[] = {
        { Py_tp_new, reinterpret_cast<void*>(_new_SpiBusInfo) },
        { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_SpiBusInfo) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_SpiBusInfo) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_SpiBusInfo) },
        { }
    };

    static PyType_Spec type_spec_SpiBusInfo = {
        "winrt._winrt_windows_devices_spi.SpiBusInfo",
        sizeof(py::wrapper::Windows::Devices::Spi::SpiBusInfo),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_SpiBusInfo};

    // ----- SpiConnectionSettings class --------------------

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

        auto arg_count = PyTuple_Size(args);
        if (arg_count == 1)
        {
            try
            {
                auto param0 = py::convert_to<int32_t>(args, 0);

                winrt::Windows::Devices::Spi::SpiConnectionSettings instance{param0};
                return py::wrap(instance, type);
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static void _dealloc_SpiConnectionSettings(py::wrapper::Windows::Devices::Spi::SpiConnectionSettings* self) noexcept
    {
        auto tp = Py_TYPE(self);
        std::destroy_at(&self->obj);
        tp->tp_free(self);
        Py_DECREF(tp);
    }

    static PyObject* SpiConnectionSettings_get_SharingMode(py::wrapper::Windows::Devices::Spi::SpiConnectionSettings* 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.Devices.Spi.SpiConnectionSettings", L"SharingMode");
            }

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

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

    static int SpiConnectionSettings_put_SharingMode(py::wrapper::Windows::Devices::Spi::SpiConnectionSettings* self, PyObject* arg, void* /*unused*/) noexcept
    {
        if (arg == nullptr)
        {
            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.Devices.Spi.SpiConnectionSettings", L"SharingMode");
            }

            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::Devices::Spi::SpiSharingMode>(arg);

            self->obj.SharingMode(param0);
            return 0;
        }
        catch (...)
        {
            py::to_PyErr();
            return -1;
        }
    }

    static PyObject* SpiConnectionSettings_get_Mode(py::wrapper::Windows::Devices::Spi::SpiConnectionSettings* 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.Devices.Spi.SpiConnectionSettings", L"Mode");
            }

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

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

    static int SpiConnectionSettings_put_Mode(py::wrapper::Windows::Devices::Spi::SpiConnectionSettings* self, PyObject* arg, void* /*unused*/) noexcept
    {
        if (arg == nullptr)
        {
            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.Devices.Spi.SpiConnectionSettings", L"Mode");
            }

            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::Devices::Spi::SpiMode>(arg);

            self->obj.Mode(param0);
            return 0;
        }
        catch (...)
        {
            py::to_PyErr();
            return -1;
        }
    }

    static PyObject* SpiConnectionSettings_get_DataBitLength(py::wrapper::Windows::Devices::Spi::SpiConnectionSettings* 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.Devices.Spi.SpiConnectionSettings", L"DataBitLength");
            }

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

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

    static int SpiConnectionSettings_put_DataBitLength(py::wrapper::Windows::Devices::Spi::SpiConnectionSettings* self, PyObject* arg, void* /*unused*/) noexcept
    {
        if (arg == nullptr)
        {
            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.Devices.Spi.SpiConnectionSettings", L"DataBitLength");
            }

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

            self->obj.DataBitLength(param0);
            return 0;
        }
        catch (...)
        {
            py::to_PyErr();
            return -1;
        }
    }

    static PyObject* SpiConnectionSettings_get_ClockFrequency(py::wrapper::Windows::Devices::Spi::SpiConnectionSettings* 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.Devices.Spi.SpiConnectionSettings", L"ClockFrequency");
            }

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

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

    static int SpiConnectionSettings_put_ClockFrequency(py::wrapper::Windows::Devices::Spi::SpiConnectionSettings* self, PyObject* arg, void* /*unused*/) noexcept
    {
        if (arg == nullptr)
        {
            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.Devices.Spi.SpiConnectionSettings", L"ClockFrequency");
            }

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

            self->obj.ClockFrequency(param0);
            return 0;
        }
        catch (...)
        {
            py::to_PyErr();
            return -1;
        }
    }

    static PyObject* SpiConnectionSettings_get_ChipSelectLine(py::wrapper::Windows::Devices::Spi::SpiConnectionSettings* 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.Devices.Spi.SpiConnectionSettings", L"ChipSelectLine");
            }

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

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

    static int SpiConnectionSettings_put_ChipSelectLine(py::wrapper::Windows::Devices::Spi::SpiConnectionSettings* self, PyObject* arg, void* /*unused*/) noexcept
    {
        if (arg == nullptr)
        {
            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.Devices.Spi.SpiConnectionSettings", L"ChipSelectLine");
            }

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

            self->obj.ChipSelectLine(param0);
            return 0;
        }
        catch (...)
        {
            py::to_PyErr();
            return -1;
        }
    }

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

    static PyObject* _from_SpiConnectionSettings(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::Devices::Spi::SpiConnectionSettings>());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyMethodDef _methods_SpiConnectionSettings[] = {
        { "_assign_array_", _assign_array_SpiConnectionSettings, METH_O | METH_STATIC, nullptr },
        { "_from", reinterpret_cast<PyCFunction>(_from_SpiConnectionSettings), METH_O | METH_STATIC, nullptr },
        { }
    };

    static PyGetSetDef _getset_SpiConnectionSettings[] = {
        { "sharing_mode", reinterpret_cast<getter>(SpiConnectionSettings_get_SharingMode), reinterpret_cast<setter>(SpiConnectionSettings_put_SharingMode), nullptr, nullptr },
        { "mode", reinterpret_cast<getter>(SpiConnectionSettings_get_Mode), reinterpret_cast<setter>(SpiConnectionSettings_put_Mode), nullptr, nullptr },
        { "data_bit_length", reinterpret_cast<getter>(SpiConnectionSettings_get_DataBitLength), reinterpret_cast<setter>(SpiConnectionSettings_put_DataBitLength), nullptr, nullptr },
        { "clock_frequency", reinterpret_cast<getter>(SpiConnectionSettings_get_ClockFrequency), reinterpret_cast<setter>(SpiConnectionSettings_put_ClockFrequency), nullptr, nullptr },
        { "chip_select_line", reinterpret_cast<getter>(SpiConnectionSettings_get_ChipSelectLine), reinterpret_cast<setter>(SpiConnectionSettings_put_ChipSelectLine), nullptr, nullptr },
        { }
    };

    static PyType_Slot _type_slots_SpiConnectionSettings[] = {
        { Py_tp_new, reinterpret_cast<void*>(_new_SpiConnectionSettings) },
        { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_SpiConnectionSettings) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_SpiConnectionSettings) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_SpiConnectionSettings) },
        { }
    };

    static PyType_Spec type_spec_SpiConnectionSettings = {
        "winrt._winrt_windows_devices_spi.SpiConnectionSettings",
        sizeof(py::wrapper::Windows::Devices::Spi::SpiConnectionSettings),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_SpiConnectionSettings};

    // ----- SpiController class --------------------

    static PyObject* _new_SpiController(PyTypeObject* /*unused*/, PyObject* /*unused*/, PyObject* /*unused*/) noexcept
    {
        static_assert(py::py_type<winrt::Windows::Devices::Spi::SpiController>::type_name);
        py::set_invalid_activation_error(py::py_type<winrt::Windows::Devices::Spi::SpiController>::type_name);
        return nullptr;
    }

    static void _dealloc_SpiController(py::wrapper::Windows::Devices::Spi::SpiController* self) noexcept
    {
        auto tp = Py_TYPE(self);
        std::destroy_at(&self->obj);
        tp->tp_free(self);
        Py_DECREF(tp);
    }

    static PyObject* SpiController_GetControllersAsync(PyObject* /*unused*/, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_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.Devices.Spi.SpiController", L"GetControllersAsync", 1);
                }

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

                auto param0 = py::convert_to<winrt::Windows::Devices::Spi::Provider::ISpiProvider>(args, 0);

                return py::convert(winrt::Windows::Devices::Spi::SpiController::GetControllersAsync(param0));
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* SpiController_GetDefaultAsync(PyObject* /*unused*/, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_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.Devices.Spi.SpiController", L"GetDefaultAsync", 0);
                }

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

                return py::convert(winrt::Windows::Devices::Spi::SpiController::GetDefaultAsync());
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* SpiController_GetDevice(py::wrapper::Windows::Devices::Spi::SpiController* self, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_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.Devices.Spi.SpiController", L"GetDevice", 1);
                }

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

                auto param0 = py::convert_to<winrt::Windows::Devices::Spi::SpiConnectionSettings>(args, 0);

                return py::convert(self->obj.GetDevice(param0));
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

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

    static PyObject* _from_SpiController(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::Devices::Spi::SpiController>());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyMethodDef _methods_SpiController[] = {
        { "get_device", reinterpret_cast<PyCFunction>(SpiController_GetDevice), METH_VARARGS, nullptr },
        { "_assign_array_", _assign_array_SpiController, METH_O | METH_STATIC, nullptr },
        { "_from", reinterpret_cast<PyCFunction>(_from_SpiController), METH_O | METH_STATIC, nullptr },
        { }
    };

    static PyGetSetDef _getset_SpiController[] = {
        { }
    };

    static PyType_Slot _type_slots_SpiController[] = {
        { Py_tp_new, reinterpret_cast<void*>(_new_SpiController) },
        { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_SpiController) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_SpiController) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_SpiController) },
        { }
    };

    static PyType_Spec type_spec_SpiController = {
        "winrt._winrt_windows_devices_spi.SpiController",
        sizeof(py::wrapper::Windows::Devices::Spi::SpiController),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_SpiController};

    static PyGetSetDef getset_SpiController_Static[] = {
        { }
    };

    static PyMethodDef methods_SpiController_Static[] = {
        { "get_controllers_async", reinterpret_cast<PyCFunction>(SpiController_GetControllersAsync), METH_VARARGS, nullptr },
        { "get_default_async", reinterpret_cast<PyCFunction>(SpiController_GetDefaultAsync), METH_VARARGS, nullptr },
        { }
    };

    static PyType_Slot type_slots_SpiController_Static[] = 
    {
        { Py_tp_base, reinterpret_cast<void*>(&PyType_Type) },
        { Py_tp_getset, reinterpret_cast<void*>(getset_SpiController_Static) },
        { Py_tp_methods, reinterpret_cast<void*>(methods_SpiController_Static) },
        { }
    };

    static PyType_Spec type_spec_SpiController_Static =
    {
        "winrt._winrt_windows_devices_spi.SpiController_Static",
        static_cast<int>(PyType_Type.tp_basicsize),
        static_cast<int>(PyType_Type.tp_itemsize),
        Py_TPFLAGS_DEFAULT,
        type_slots_SpiController_Static
    };

    // ----- SpiDevice class --------------------

    static PyObject* _new_SpiDevice(PyTypeObject* /*unused*/, PyObject* /*unused*/, PyObject* /*unused*/) noexcept
    {
        static_assert(py::py_type<winrt::Windows::Devices::Spi::SpiDevice>::type_name);
        py::set_invalid_activation_error(py::py_type<winrt::Windows::Devices::Spi::SpiDevice>::type_name);
        return nullptr;
    }

    static void _dealloc_SpiDevice(py::wrapper::Windows::Devices::Spi::SpiDevice* self) noexcept
    {
        auto tp = Py_TYPE(self);
        std::destroy_at(&self->obj);
        tp->tp_free(self);
        Py_DECREF(tp);
    }

    static PyObject* SpiDevice_Close(py::wrapper::Windows::Devices::Spi::SpiDevice* self, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_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.Devices.Spi.SpiDevice", L"Close", 0);
                }

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

                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* SpiDevice_FromIdAsync(PyObject* /*unused*/, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_Size(args);

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

                if (!is_overload_present.has_value())
                {
                    is_overload_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Devices.Spi.SpiDevice", L"FromIdAsync", 2);
                }

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

                auto param0 = py::convert_to<winrt::hstring>(args, 0);
                auto param1 = py::convert_to<winrt::Windows::Devices::Spi::SpiConnectionSettings>(args, 1);

                return py::convert(winrt::Windows::Devices::Spi::SpiDevice::FromIdAsync(param0, param1));
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* SpiDevice_GetBusInfo(PyObject* /*unused*/, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_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.Devices.Spi.SpiDevice", L"GetBusInfo", 1);
                }

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

                auto param0 = py::convert_to<winrt::hstring>(args, 0);

                return py::convert(winrt::Windows::Devices::Spi::SpiDevice::GetBusInfo(param0));
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* SpiDevice_GetDeviceSelector(PyObject* /*unused*/, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_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.Devices.Spi.SpiDevice", L"GetDeviceSelector", 0);
                }

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

                return py::convert(winrt::Windows::Devices::Spi::SpiDevice::GetDeviceSelector());
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else 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.Devices.Spi.SpiDevice", L"GetDeviceSelector", 1);
                }

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

                auto param0 = py::convert_to<winrt::hstring>(args, 0);

                return py::convert(winrt::Windows::Devices::Spi::SpiDevice::GetDeviceSelector(param0));
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* SpiDevice_Read(py::wrapper::Windows::Devices::Spi::SpiDevice* self, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_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.Devices.Spi.SpiDevice", L"Read", 0);
                }

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

                auto param0 = py::convert_to<py::pybuf_view<uint8_t, true>>(args, 0);

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

    static PyObject* SpiDevice_TransferFullDuplex(py::wrapper::Windows::Devices::Spi::SpiDevice* self, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_Size(args);

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

                if (!is_overload_present.has_value())
                {
                    is_overload_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Devices.Spi.SpiDevice", L"TransferFullDuplex", 1);
                }

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

                auto param0 = py::convert_to<py::pybuf_view<uint8_t, false>>(args, 0);
                auto param1 = py::convert_to<py::pybuf_view<uint8_t, true>>(args, 1);

                self->obj.TransferFullDuplex(param0, param1);
                Py_RETURN_NONE;
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* SpiDevice_TransferSequential(py::wrapper::Windows::Devices::Spi::SpiDevice* self, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_Size(args);

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

                if (!is_overload_present.has_value())
                {
                    is_overload_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Devices.Spi.SpiDevice", L"TransferSequential", 1);
                }

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

                auto param0 = py::convert_to<py::pybuf_view<uint8_t, false>>(args, 0);
                auto param1 = py::convert_to<py::pybuf_view<uint8_t, true>>(args, 1);

                self->obj.TransferSequential(param0, param1);
                Py_RETURN_NONE;
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* SpiDevice_Write(py::wrapper::Windows::Devices::Spi::SpiDevice* self, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_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.Devices.Spi.SpiDevice", L"Write", 1);
                }

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

                auto param0 = py::convert_to<py::pybuf_view<uint8_t, false>>(args, 0);

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

    static PyObject* SpiDevice_get_ConnectionSettings(py::wrapper::Windows::Devices::Spi::SpiDevice* 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.Devices.Spi.SpiDevice", L"ConnectionSettings");
            }

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

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

    static PyObject* SpiDevice_get_DeviceId(py::wrapper::Windows::Devices::Spi::SpiDevice* 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.Devices.Spi.SpiDevice", L"DeviceId");
            }

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

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

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

    static PyObject* _from_SpiDevice(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::Devices::Spi::SpiDevice>());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* _enter_SpiDevice(py::wrapper::Windows::Devices::Spi::SpiDevice* self, PyObject* /*unused*/) noexcept
    {
        return Py_NewRef(self);
    }

    static PyObject* _exit_SpiDevice(py::wrapper::Windows::Devices::Spi::SpiDevice* self, PyObject* /*unused*/) noexcept
    {
        try
        {
            self->obj.Close();
            Py_RETURN_FALSE;
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyMethodDef _methods_SpiDevice[] = {
        { "close", reinterpret_cast<PyCFunction>(SpiDevice_Close), METH_VARARGS, nullptr },
        { "read", reinterpret_cast<PyCFunction>(SpiDevice_Read), METH_VARARGS, nullptr },
        { "transfer_full_duplex", reinterpret_cast<PyCFunction>(SpiDevice_TransferFullDuplex), METH_VARARGS, nullptr },
        { "transfer_sequential", reinterpret_cast<PyCFunction>(SpiDevice_TransferSequential), METH_VARARGS, nullptr },
        { "write", reinterpret_cast<PyCFunction>(SpiDevice_Write), METH_VARARGS, nullptr },
        { "_assign_array_", _assign_array_SpiDevice, METH_O | METH_STATIC, nullptr },
        { "_from", reinterpret_cast<PyCFunction>(_from_SpiDevice), METH_O | METH_STATIC, nullptr },
        { "__enter__", reinterpret_cast<PyCFunction>(_enter_SpiDevice), METH_NOARGS, nullptr },
        { "__exit__", reinterpret_cast<PyCFunction>(_exit_SpiDevice), METH_VARARGS, nullptr },
        { }
    };

    static PyGetSetDef _getset_SpiDevice[] = {
        { "connection_settings", reinterpret_cast<getter>(SpiDevice_get_ConnectionSettings), nullptr, nullptr, nullptr },
        { "device_id", reinterpret_cast<getter>(SpiDevice_get_DeviceId), nullptr, nullptr, nullptr },
        { }
    };

    static PyType_Slot _type_slots_SpiDevice[] = {
        { Py_tp_new, reinterpret_cast<void*>(_new_SpiDevice) },
        { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_SpiDevice) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_SpiDevice) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_SpiDevice) },
        { }
    };

    static PyType_Spec type_spec_SpiDevice = {
        "winrt._winrt_windows_devices_spi.SpiDevice",
        sizeof(py::wrapper::Windows::Devices::Spi::SpiDevice),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_SpiDevice};

    static PyGetSetDef getset_SpiDevice_Static[] = {
        { }
    };

    static PyMethodDef methods_SpiDevice_Static[] = {
        { "from_id_async", reinterpret_cast<PyCFunction>(SpiDevice_FromIdAsync), METH_VARARGS, nullptr },
        { "get_bus_info", reinterpret_cast<PyCFunction>(SpiDevice_GetBusInfo), METH_VARARGS, nullptr },
        { "get_device_selector", reinterpret_cast<PyCFunction>(SpiDevice_GetDeviceSelector), METH_VARARGS, nullptr },
        { }
    };

    static PyType_Slot type_slots_SpiDevice_Static[] = 
    {
        { Py_tp_base, reinterpret_cast<void*>(&PyType_Type) },
        { Py_tp_getset, reinterpret_cast<void*>(getset_SpiDevice_Static) },
        { Py_tp_methods, reinterpret_cast<void*>(methods_SpiDevice_Static) },
        { }
    };

    static PyType_Spec type_spec_SpiDevice_Static =
    {
        "winrt._winrt_windows_devices_spi.SpiDevice_Static",
        static_cast<int>(PyType_Type.tp_basicsize),
        static_cast<int>(PyType_Type.tp_itemsize),
        Py_TPFLAGS_DEFAULT,
        type_slots_SpiDevice_Static
    };

    // ----- ISpiDeviceStatics interface --------------------

    static PyObject* _new_ISpiDeviceStatics(PyTypeObject* /*unused*/, PyObject* /*unused*/, PyObject* /*unused*/) noexcept
    {
        static_assert(py::py_type<winrt::Windows::Devices::Spi::ISpiDeviceStatics>::type_name);
        py::set_invalid_activation_error(py::py_type<winrt::Windows::Devices::Spi::ISpiDeviceStatics>::type_name);
        return nullptr;
    }

    static void _dealloc_ISpiDeviceStatics(py::wrapper::Windows::Devices::Spi::ISpiDeviceStatics* self) noexcept
    {
        auto tp = Py_TYPE(self);
        std::destroy_at(&self->obj);
        tp->tp_free(self);
        Py_DECREF(tp);
    }

    static PyObject* ISpiDeviceStatics_FromIdAsync(py::wrapper::Windows::Devices::Spi::ISpiDeviceStatics* self, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_Size(args);

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

                if (!is_overload_present.has_value())
                {
                    is_overload_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Devices.Spi.ISpiDeviceStatics", L"FromIdAsync", 2);
                }

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

                auto param0 = py::convert_to<winrt::hstring>(args, 0);
                auto param1 = py::convert_to<winrt::Windows::Devices::Spi::SpiConnectionSettings>(args, 1);

                return py::convert(self->obj.FromIdAsync(param0, param1));
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* ISpiDeviceStatics_GetBusInfo(py::wrapper::Windows::Devices::Spi::ISpiDeviceStatics* self, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_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.Devices.Spi.ISpiDeviceStatics", L"GetBusInfo", 1);
                }

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

                auto param0 = py::convert_to<winrt::hstring>(args, 0);

                return py::convert(self->obj.GetBusInfo(param0));
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* ISpiDeviceStatics_GetDeviceSelector(py::wrapper::Windows::Devices::Spi::ISpiDeviceStatics* self, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_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.Devices.Spi.ISpiDeviceStatics", L"GetDeviceSelector", 0);
                }

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

                return py::convert(self->obj.GetDeviceSelector());
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else 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.Devices.Spi.ISpiDeviceStatics", L"GetDeviceSelector", 1);
                }

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

                auto param0 = py::convert_to<winrt::hstring>(args, 0);

                return py::convert(self->obj.GetDeviceSelector(param0));
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

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

    static PyObject* _from_ISpiDeviceStatics(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::Devices::Spi::ISpiDeviceStatics>());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyMethodDef _methods_ISpiDeviceStatics[] = {
        { "from_id_async", reinterpret_cast<PyCFunction>(ISpiDeviceStatics_FromIdAsync), METH_VARARGS, nullptr },
        { "get_bus_info", reinterpret_cast<PyCFunction>(ISpiDeviceStatics_GetBusInfo), METH_VARARGS, nullptr },
        { "get_device_selector", reinterpret_cast<PyCFunction>(ISpiDeviceStatics_GetDeviceSelector), METH_VARARGS, nullptr },
        { "_assign_array_", _assign_array_ISpiDeviceStatics, METH_O | METH_STATIC, nullptr },
        { "_from", reinterpret_cast<PyCFunction>(_from_ISpiDeviceStatics), METH_O | METH_STATIC, nullptr },
        { }
    };

    static PyGetSetDef _getset_ISpiDeviceStatics[] = {
        { }
    };

    static PyType_Slot _type_slots_ISpiDeviceStatics[] = {
        { Py_tp_new, reinterpret_cast<void*>(_new_ISpiDeviceStatics) },
        { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_ISpiDeviceStatics) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_ISpiDeviceStatics) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_ISpiDeviceStatics) },
        { }
    };

    static PyType_Spec type_spec_ISpiDeviceStatics = {
        "winrt._winrt_windows_devices_spi.ISpiDeviceStatics",
        sizeof(py::wrapper::Windows::Devices::Spi::ISpiDeviceStatics),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_ISpiDeviceStatics};

    // ----- Windows.Devices.Spi Initialization --------------------

    PyDoc_STRVAR(module_doc, "Windows.Devices.Spi");

    static PyModuleDef module_def = {
        PyModuleDef_HEAD_INIT,
        "_winrt_windows_devices_spi",
        module_doc,
        0,
        nullptr,
        nullptr,
        nullptr,
        nullptr,
        nullptr};
} // py::cpp::Windows::Devices::Spi

PyMODINIT_FUNC PyInit__winrt_windows_devices_spi(void) noexcept
{
    using namespace py::cpp::Windows::Devices::Spi;

    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;
    }

    py::pytype_handle SpiBusInfo_type{py::register_python_type(module.get(), &type_spec_SpiBusInfo, object_bases.get(), nullptr)};
    if (!SpiBusInfo_type)
    {
        return nullptr;
    }

    py::pytype_handle SpiConnectionSettings_type{py::register_python_type(module.get(), &type_spec_SpiConnectionSettings, object_bases.get(), nullptr)};
    if (!SpiConnectionSettings_type)
    {
        return nullptr;
    }

    py::pyobj_handle type_SpiController_Static{PyType_FromSpec(&type_spec_SpiController_Static)};
    if (!type_SpiController_Static)
    {
        return nullptr;
    }

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

    py::pyobj_handle type_SpiDevice_Static{PyType_FromSpec(&type_spec_SpiDevice_Static)};
    if (!type_SpiDevice_Static)
    {
        return nullptr;
    }

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

    py::pytype_handle ISpiDeviceStatics_type{py::register_python_type(module.get(), &type_spec_ISpiDeviceStatics, object_bases.get(), nullptr)};
    if (!ISpiDeviceStatics_type)
    {
        return nullptr;
    }


    return module.detach();
}
