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

#include "py.Windows.Devices.h"

namespace py::cpp::Windows::Devices
{
    // ----- LowLevelDevicesAggregateProvider class --------------------

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

        auto arg_count = PyTuple_GET_SIZE(args);
        if (arg_count == 5)
        {
            try
            {
                auto param0 = py::convert_to<winrt::Windows::Devices::Adc::Provider::IAdcControllerProvider>(args, 0);
                auto param1 = py::convert_to<winrt::Windows::Devices::Pwm::Provider::IPwmControllerProvider>(args, 1);
                auto param2 = py::convert_to<winrt::Windows::Devices::Gpio::Provider::IGpioControllerProvider>(args, 2);
                auto param3 = py::convert_to<winrt::Windows::Devices::I2c::Provider::II2cControllerProvider>(args, 3);
                auto param4 = py::convert_to<winrt::Windows::Devices::Spi::Provider::ISpiControllerProvider>(args, 4);

                winrt::Windows::Devices::LowLevelDevicesAggregateProvider instance{param0, param1, param2, param3, param4};
                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_LowLevelDevicesAggregateProvider(py::wrapper::Windows::Devices::LowLevelDevicesAggregateProvider* self) noexcept
    {
        auto tp = Py_TYPE(self);
        std::destroy_at(&self->obj);
        tp->tp_free(self);
        Py_DECREF(tp);
    }

    static PyObject* LowLevelDevicesAggregateProvider_get_AdcControllerProvider(py::wrapper::Windows::Devices::LowLevelDevicesAggregateProvider* 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.LowLevelDevicesAggregateProvider", L"AdcControllerProvider");
            }

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

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

    static PyObject* LowLevelDevicesAggregateProvider_get_GpioControllerProvider(py::wrapper::Windows::Devices::LowLevelDevicesAggregateProvider* 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.LowLevelDevicesAggregateProvider", L"GpioControllerProvider");
            }

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

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

    static PyObject* LowLevelDevicesAggregateProvider_get_I2cControllerProvider(py::wrapper::Windows::Devices::LowLevelDevicesAggregateProvider* 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.LowLevelDevicesAggregateProvider", L"I2cControllerProvider");
            }

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

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

    static PyObject* LowLevelDevicesAggregateProvider_get_PwmControllerProvider(py::wrapper::Windows::Devices::LowLevelDevicesAggregateProvider* 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.LowLevelDevicesAggregateProvider", L"PwmControllerProvider");
            }

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

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

    static PyObject* LowLevelDevicesAggregateProvider_get_SpiControllerProvider(py::wrapper::Windows::Devices::LowLevelDevicesAggregateProvider* 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.LowLevelDevicesAggregateProvider", L"SpiControllerProvider");
            }

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

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

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

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

    static PyMethodDef _methods_LowLevelDevicesAggregateProvider[] = {
        { "_assign_array_", _assign_array_LowLevelDevicesAggregateProvider, METH_O | METH_STATIC, nullptr },
        { "_from", reinterpret_cast<PyCFunction>(_from_LowLevelDevicesAggregateProvider), METH_O | METH_STATIC, nullptr },
        { }};

    static PyGetSetDef _getset_LowLevelDevicesAggregateProvider[] = {
        { "adc_controller_provider", reinterpret_cast<getter>(LowLevelDevicesAggregateProvider_get_AdcControllerProvider), nullptr, nullptr, nullptr },
        { "gpio_controller_provider", reinterpret_cast<getter>(LowLevelDevicesAggregateProvider_get_GpioControllerProvider), nullptr, nullptr, nullptr },
        { "i2c_controller_provider", reinterpret_cast<getter>(LowLevelDevicesAggregateProvider_get_I2cControllerProvider), nullptr, nullptr, nullptr },
        { "pwm_controller_provider", reinterpret_cast<getter>(LowLevelDevicesAggregateProvider_get_PwmControllerProvider), nullptr, nullptr, nullptr },
        { "spi_controller_provider", reinterpret_cast<getter>(LowLevelDevicesAggregateProvider_get_SpiControllerProvider), nullptr, nullptr, nullptr },
        { }};

    static PyType_Slot _type_slots_LowLevelDevicesAggregateProvider[] = {
        { Py_tp_new, reinterpret_cast<void*>(_new_LowLevelDevicesAggregateProvider) },
        { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_LowLevelDevicesAggregateProvider) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_LowLevelDevicesAggregateProvider) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_LowLevelDevicesAggregateProvider) },
        { }};

    static PyType_Spec type_spec_LowLevelDevicesAggregateProvider = {
        "winrt._winrt_windows_devices.LowLevelDevicesAggregateProvider",
        sizeof(py::wrapper::Windows::Devices::LowLevelDevicesAggregateProvider),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_LowLevelDevicesAggregateProvider};

    // ----- LowLevelDevicesController class --------------------

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

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

    static PyObject* LowLevelDevicesController_get_DefaultProvider(PyObject* /*unused*/, 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.LowLevelDevicesController", L"DefaultProvider");
            }

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

            return py::convert([&]()
            {
                auto _gil = release_gil();
                return winrt::Windows::Devices::LowLevelDevicesController::DefaultProvider();
            }());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static int LowLevelDevicesController_put_DefaultProvider(PyObject* /*unused*/, PyObject* arg, void* /*unused*/) noexcept
    {
        if (!arg)
        {
            PyErr_SetString(PyExc_AttributeError, "can't delete attribute");
            return -1;
        }

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

            if (!is_property_present.has_value())
            {
                is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Devices.LowLevelDevicesController", L"DefaultProvider");
            }

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

            {
                auto _gil = release_gil();
                winrt::Windows::Devices::LowLevelDevicesController::DefaultProvider(param0);
            }

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

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

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

    static PyMethodDef _methods_LowLevelDevicesController[] = {
        { "_assign_array_", _assign_array_LowLevelDevicesController, METH_O | METH_STATIC, nullptr },
        { "_from", reinterpret_cast<PyCFunction>(_from_LowLevelDevicesController), METH_O | METH_STATIC, nullptr },
        { }};

    static PyGetSetDef _getset_LowLevelDevicesController[] = {
        { }};

    static PyType_Slot _type_slots_LowLevelDevicesController[] = {
        { Py_tp_new, reinterpret_cast<void*>(_new_LowLevelDevicesController) },
        { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_LowLevelDevicesController) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_LowLevelDevicesController) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_LowLevelDevicesController) },
        { }};

    static PyType_Spec type_spec_LowLevelDevicesController = {
        "winrt._winrt_windows_devices.LowLevelDevicesController",
        sizeof(py::wrapper::Windows::Devices::LowLevelDevicesController),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_LowLevelDevicesController};

    static PyGetSetDef getset_LowLevelDevicesController_Static[] = {
        { "default_provider", reinterpret_cast<getter>(LowLevelDevicesController_get_DefaultProvider), reinterpret_cast<setter>(LowLevelDevicesController_put_DefaultProvider), nullptr, nullptr },
        { }};

    static PyMethodDef methods_LowLevelDevicesController_Static[] = {
        { }};

    static PyType_Slot type_slots_LowLevelDevicesController_Static[] = 
    {
        { Py_tp_base, reinterpret_cast<void*>(&PyType_Type) },
        { Py_tp_getset, reinterpret_cast<void*>(getset_LowLevelDevicesController_Static) },
        { Py_tp_methods, reinterpret_cast<void*>(methods_LowLevelDevicesController_Static) },
        { }
    };

    static PyType_Spec type_spec_LowLevelDevicesController_Static = {
        "winrt._winrt_windows_devices.LowLevelDevicesController_Static",
        static_cast<int>(PyType_Type.tp_basicsize),
        static_cast<int>(PyType_Type.tp_itemsize),
        Py_TPFLAGS_DEFAULT,
        type_slots_LowLevelDevicesController_Static};

    // ----- ILowLevelDevicesAggregateProvider interface --------------------

    #if PY_VERSION_HEX < 0x030A0000
    static PyObject* _new_ILowLevelDevicesAggregateProvider(PyTypeObject* /*unused*/, PyObject* /*unused*/, PyObject* /*unused*/) noexcept
    {
        static_assert(py::py_type<winrt::Windows::Devices::ILowLevelDevicesAggregateProvider>::type_name);
        py::set_invalid_activation_error(py::py_type<winrt::Windows::Devices::ILowLevelDevicesAggregateProvider>::type_name);
        return nullptr;
    }
    #endif

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

    static PyObject* ILowLevelDevicesAggregateProvider_get_AdcControllerProvider(py::wrapper::Windows::Devices::ILowLevelDevicesAggregateProvider* 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.ILowLevelDevicesAggregateProvider", L"AdcControllerProvider");
            }

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

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

    static PyObject* ILowLevelDevicesAggregateProvider_get_GpioControllerProvider(py::wrapper::Windows::Devices::ILowLevelDevicesAggregateProvider* 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.ILowLevelDevicesAggregateProvider", L"GpioControllerProvider");
            }

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

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

    static PyObject* ILowLevelDevicesAggregateProvider_get_I2cControllerProvider(py::wrapper::Windows::Devices::ILowLevelDevicesAggregateProvider* 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.ILowLevelDevicesAggregateProvider", L"I2cControllerProvider");
            }

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

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

    static PyObject* ILowLevelDevicesAggregateProvider_get_PwmControllerProvider(py::wrapper::Windows::Devices::ILowLevelDevicesAggregateProvider* 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.ILowLevelDevicesAggregateProvider", L"PwmControllerProvider");
            }

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

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

    static PyObject* ILowLevelDevicesAggregateProvider_get_SpiControllerProvider(py::wrapper::Windows::Devices::ILowLevelDevicesAggregateProvider* 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.ILowLevelDevicesAggregateProvider", L"SpiControllerProvider");
            }

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

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

    static PyMethodDef _methods_ILowLevelDevicesAggregateProvider[] = {
        { }};

    static PyGetSetDef _getset_ILowLevelDevicesAggregateProvider[] = {
        { "adc_controller_provider", reinterpret_cast<getter>(ILowLevelDevicesAggregateProvider_get_AdcControllerProvider), nullptr, nullptr, nullptr },
        { "gpio_controller_provider", reinterpret_cast<getter>(ILowLevelDevicesAggregateProvider_get_GpioControllerProvider), nullptr, nullptr, nullptr },
        { "i2c_controller_provider", reinterpret_cast<getter>(ILowLevelDevicesAggregateProvider_get_I2cControllerProvider), nullptr, nullptr, nullptr },
        { "pwm_controller_provider", reinterpret_cast<getter>(ILowLevelDevicesAggregateProvider_get_PwmControllerProvider), nullptr, nullptr, nullptr },
        { "spi_controller_provider", reinterpret_cast<getter>(ILowLevelDevicesAggregateProvider_get_SpiControllerProvider), nullptr, nullptr, nullptr },
        { }};

    static PyType_Slot _type_slots_ILowLevelDevicesAggregateProvider[] = {
        #if PY_VERSION_HEX < 0x030A0000
        { Py_tp_new, reinterpret_cast<void*>(_new_ILowLevelDevicesAggregateProvider) },
        #endif
        { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_ILowLevelDevicesAggregateProvider) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_ILowLevelDevicesAggregateProvider) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_ILowLevelDevicesAggregateProvider) },
        { }};

    static PyType_Spec type_spec_ILowLevelDevicesAggregateProvider = {
        "winrt._winrt_windows_devices._ILowLevelDevicesAggregateProvider",
        sizeof(py::wrapper::Windows::Devices::ILowLevelDevicesAggregateProvider),
        0,
        Py_TPFLAGS_DEFAULT
        #if PY_VERSION_HEX >= 0x030A0000
        | Py_TPFLAGS_DISALLOW_INSTANTIATION
        #endif
        ,
        _type_slots_ILowLevelDevicesAggregateProvider};

    struct ImplementsILowLevelDevicesAggregateProvider : py::ImplementsInterfaceT<ImplementsILowLevelDevicesAggregateProvider, winrt::Windows::Devices::ILowLevelDevicesAggregateProvider>
    {
        ImplementsILowLevelDevicesAggregateProvider() = delete;
        ImplementsILowLevelDevicesAggregateProvider(PyObject* py_obj, winrt::impl::inspectable_abi* runtime_class) : py::ImplementsInterfaceT<ImplementsILowLevelDevicesAggregateProvider, winrt::Windows::Devices::ILowLevelDevicesAggregateProvider>(py_obj, runtime_class)
        {
        }

        auto AdcControllerProvider()
        {
            try
            {
                py::pyobj_handle self{this->get_py_obj()};

                py::pyobj_handle value{PyObject_GetAttrString(self.get(), "adc_controller_provider")};
                if (!value)
                {
                    throw python_exception();
                }

                return py::convert_to<winrt::Windows::Devices::Adc::Provider::IAdcControllerProvider>(value.get());
            }
            catch (python_exception)
            {
                py::write_unraisable_and_throw();
            }
        }

        auto GpioControllerProvider()
        {
            try
            {
                py::pyobj_handle self{this->get_py_obj()};

                py::pyobj_handle value{PyObject_GetAttrString(self.get(), "gpio_controller_provider")};
                if (!value)
                {
                    throw python_exception();
                }

                return py::convert_to<winrt::Windows::Devices::Gpio::Provider::IGpioControllerProvider>(value.get());
            }
            catch (python_exception)
            {
                py::write_unraisable_and_throw();
            }
        }

        auto I2cControllerProvider()
        {
            try
            {
                py::pyobj_handle self{this->get_py_obj()};

                py::pyobj_handle value{PyObject_GetAttrString(self.get(), "i2c_controller_provider")};
                if (!value)
                {
                    throw python_exception();
                }

                return py::convert_to<winrt::Windows::Devices::I2c::Provider::II2cControllerProvider>(value.get());
            }
            catch (python_exception)
            {
                py::write_unraisable_and_throw();
            }
        }

        auto PwmControllerProvider()
        {
            try
            {
                py::pyobj_handle self{this->get_py_obj()};

                py::pyobj_handle value{PyObject_GetAttrString(self.get(), "pwm_controller_provider")};
                if (!value)
                {
                    throw python_exception();
                }

                return py::convert_to<winrt::Windows::Devices::Pwm::Provider::IPwmControllerProvider>(value.get());
            }
            catch (python_exception)
            {
                py::write_unraisable_and_throw();
            }
        }

        auto SpiControllerProvider()
        {
            try
            {
                py::pyobj_handle self{this->get_py_obj()};

                py::pyobj_handle value{PyObject_GetAttrString(self.get(), "spi_controller_provider")};
                if (!value)
                {
                    throw python_exception();
                }

                return py::convert_to<winrt::Windows::Devices::Spi::Provider::ISpiControllerProvider>(value.get());
            }
            catch (python_exception)
            {
                py::write_unraisable_and_throw();
            }
        }
    };

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

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

    static PyObject* _guid_ImplementsILowLevelDevicesAggregateProvider(PyObject* /*unused*/, PyObject* /*unused*/) noexcept
    {
        try
        {
            return py::convert(winrt::guid_of<winrt::Windows::Devices::ILowLevelDevicesAggregateProvider>());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* _make_ImplementsILowLevelDevicesAggregateProvider(PyObject* /*unused*/, PyObject* args) noexcept
    {
        try
        {
            PyObject* py_obj;
            winrt::impl::inspectable_abi* runtime_class;

            if (!PyArg_ParseTuple(args, "On", &py_obj, &runtime_class))
            {
                return nullptr;
            }

            auto iface{std::make_unique<ImplementsILowLevelDevicesAggregateProvider>(py_obj, runtime_class)};

            return PyLong_FromVoidPtr(iface.release());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyMethodDef methods_ImplementsILowLevelDevicesAggregateProvider[] = {
        { "_assign_array_", _assign_array_ILowLevelDevicesAggregateProvider, METH_O | METH_STATIC, nullptr },
        { "_from", reinterpret_cast<PyCFunction>(_from_ILowLevelDevicesAggregateProvider), METH_O | METH_STATIC, nullptr },
        { "_guid_", reinterpret_cast<PyCFunction>(_guid_ImplementsILowLevelDevicesAggregateProvider), METH_NOARGS | METH_STATIC, nullptr },
        { "_make_", reinterpret_cast<PyCFunction>(_make_ImplementsILowLevelDevicesAggregateProvider), METH_VARARGS | METH_STATIC, nullptr },
        { }};

    static PyType_Slot type_slots_ImplementsILowLevelDevicesAggregateProvider[] = {
        { Py_tp_methods, reinterpret_cast<void*>(methods_ImplementsILowLevelDevicesAggregateProvider) },
        { }};

    static PyType_Spec type_spec_ImplementsILowLevelDevicesAggregateProvider = {
        "winrt._winrt_windows_devices.ILowLevelDevicesAggregateProvider",
        0,
        0,
        Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE
        #if PY_VERSION_HEX >= 0x030A0000
        | Py_TPFLAGS_DISALLOW_INSTANTIATION
        #endif
        ,
        type_slots_ImplementsILowLevelDevicesAggregateProvider};

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

    PyDoc_STRVAR(module_doc, "Windows.Devices");

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

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

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

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

    if (!module)
    {
        return nullptr;
    }

    auto inspectable_meta_type = py::get_inspectable_meta_type();
    if (!inspectable_meta_type)
    {
        return nullptr;
    }

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

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

    if (!object_bases)
    {
        return nullptr;
    }

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

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

    py::pyobj_handle type_LowLevelDevicesController_Static{PyType_FromSpecWithBases(&type_spec_LowLevelDevicesController_Static, LowLevelDevicesController_Static_bases.get())};
    if (!type_LowLevelDevicesController_Static)
    {
        return nullptr;
    }

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

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

    py::pytype_handle ImplementsILowLevelDevicesAggregateProvider_type{py::register_python_type(module.get(), &type_spec_ImplementsILowLevelDevicesAggregateProvider, nullptr, inspectable_meta_type)};
    if (!ImplementsILowLevelDevicesAggregateProvider_type)
    {
        return nullptr;
    }

    if (PyModule_AddType(module.get(), ImplementsILowLevelDevicesAggregateProvider_type.get()) == -1)
    {
        return nullptr;
    }


    return module.detach();
}
