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

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


namespace py::cpp::Windows::Devices::Lights
{
    // ----- Lamp class --------------------

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

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

    static PyObject* Lamp_Close(py::wrapper::Windows::Devices::Lights::Lamp* self, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_Size(args);

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

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

    static PyObject* Lamp_FromIdAsync(PyObject* /*unused*/, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_Size(args);

        if (arg_count == 1)
        {
            if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Devices.Lights.Lamp", L"FromIdAsync", 1))
            {
                py::set_arg_count_version_error(1);
                return nullptr;
            }

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

                return py::convert(winrt::Windows::Devices::Lights::Lamp::FromIdAsync(param0));
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* Lamp_GetDefaultAsync(PyObject* /*unused*/, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_Size(args);

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

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

    static PyObject* Lamp_GetDeviceSelector(PyObject* /*unused*/, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_Size(args);

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

            try
            {
                return py::convert(winrt::Windows::Devices::Lights::Lamp::GetDeviceSelector());
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* Lamp_get_IsEnabled(py::wrapper::Windows::Devices::Lights::Lamp* self, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Devices.Lights.Lamp", L"IsEnabled"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return nullptr;
        }

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

    static int Lamp_put_IsEnabled(py::wrapper::Windows::Devices::Lights::Lamp* self, PyObject* arg, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Devices.Lights.Lamp", L"IsEnabled"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return -1;
        }

        if (arg == nullptr)
        {
            PyErr_SetString(PyExc_AttributeError, "can't delete attribute");
            return -1;
        }

        try
        {
            auto param0 = py::convert_to<bool>(arg);

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

    static PyObject* Lamp_get_Color(py::wrapper::Windows::Devices::Lights::Lamp* self, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Devices.Lights.Lamp", L"Color"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return nullptr;
        }

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

    static int Lamp_put_Color(py::wrapper::Windows::Devices::Lights::Lamp* self, PyObject* arg, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Devices.Lights.Lamp", L"Color"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return -1;
        }

        if (arg == nullptr)
        {
            PyErr_SetString(PyExc_AttributeError, "can't delete attribute");
            return -1;
        }

        try
        {
            auto param0 = py::convert_to<winrt::Windows::UI::Color>(arg);

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

    static PyObject* Lamp_get_BrightnessLevel(py::wrapper::Windows::Devices::Lights::Lamp* self, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Devices.Lights.Lamp", L"BrightnessLevel"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return nullptr;
        }

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

    static int Lamp_put_BrightnessLevel(py::wrapper::Windows::Devices::Lights::Lamp* self, PyObject* arg, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Devices.Lights.Lamp", L"BrightnessLevel"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return -1;
        }

        if (arg == nullptr)
        {
            PyErr_SetString(PyExc_AttributeError, "can't delete attribute");
            return -1;
        }

        try
        {
            auto param0 = py::convert_to<float>(arg);

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

    static PyObject* Lamp_get_DeviceId(py::wrapper::Windows::Devices::Lights::Lamp* self, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Devices.Lights.Lamp", L"DeviceId"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return nullptr;
        }

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

    static PyObject* Lamp_get_IsColorSettable(py::wrapper::Windows::Devices::Lights::Lamp* self, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Devices.Lights.Lamp", L"IsColorSettable"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return nullptr;
        }

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

    static PyObject* Lamp_add_AvailabilityChanged(py::wrapper::Windows::Devices::Lights::Lamp* self, PyObject* arg) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsEventPresent(L"Windows.Devices.Lights.Lamp", L"AvailabilityChanged"))
        {
            PyErr_SetString(PyExc_AttributeError, "event is not available in this version of Windows");
            return nullptr;
        }

        try
        {
            auto param0 = py::convert_to<winrt::Windows::Foundation::TypedEventHandler<winrt::Windows::Devices::Lights::Lamp, winrt::Windows::Devices::Lights::LampAvailabilityChangedEventArgs>>(arg);

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

    static PyObject* Lamp_remove_AvailabilityChanged(py::wrapper::Windows::Devices::Lights::Lamp* self, PyObject* arg) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsEventPresent(L"Windows.Devices.Lights.Lamp", L"AvailabilityChanged"))
        {
            PyErr_SetString(PyExc_AttributeError, "event is not available in this version of Windows");
            return nullptr;
        }

        try
        {
            auto param0 = py::convert_to<winrt::event_token>(arg);

            self->obj.AvailabilityChanged(param0);
            Py_RETURN_NONE;
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

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

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

    static PyObject* _enter_Lamp(py::wrapper::Windows::Devices::Lights::Lamp* self, PyObject* /*unused*/) noexcept
    {
        return Py_NewRef(self);
    }

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

    static PyMethodDef _methods_Lamp[] = {
        { "close", reinterpret_cast<PyCFunction>(Lamp_Close), METH_VARARGS, nullptr },
        { "add_availability_changed", reinterpret_cast<PyCFunction>(Lamp_add_AvailabilityChanged), METH_O, nullptr },
        { "remove_availability_changed", reinterpret_cast<PyCFunction>(Lamp_remove_AvailabilityChanged), METH_O, nullptr },
        { "_assign_array_", _assign_array_Lamp, METH_O | METH_STATIC, nullptr },
        { "_from", reinterpret_cast<PyCFunction>(_from_Lamp), METH_O | METH_STATIC, nullptr },
        { "__enter__", reinterpret_cast<PyCFunction>(_enter_Lamp), METH_NOARGS, nullptr },
        { "__exit__",  reinterpret_cast<PyCFunction>(_exit_Lamp), METH_VARARGS, nullptr },
        { }
    };

    static PyGetSetDef _getset_Lamp[] = {
        { "is_enabled", reinterpret_cast<getter>(Lamp_get_IsEnabled), reinterpret_cast<setter>(Lamp_put_IsEnabled), nullptr, nullptr },
        { "color", reinterpret_cast<getter>(Lamp_get_Color), reinterpret_cast<setter>(Lamp_put_Color), nullptr, nullptr },
        { "brightness_level", reinterpret_cast<getter>(Lamp_get_BrightnessLevel), reinterpret_cast<setter>(Lamp_put_BrightnessLevel), nullptr, nullptr },
        { "device_id", reinterpret_cast<getter>(Lamp_get_DeviceId), nullptr, nullptr, nullptr },
        { "is_color_settable", reinterpret_cast<getter>(Lamp_get_IsColorSettable), nullptr, nullptr, nullptr },
        { }
    };

    static PyType_Slot _type_slots_Lamp[] = 
    {
        { Py_tp_new, reinterpret_cast<void*>(_new_Lamp) },
        { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_Lamp) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_Lamp) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_Lamp) },
        { },
    };

    static PyType_Spec type_spec_Lamp =
    {
        "winrt._winrt_windows_devices_lights.Lamp",
        sizeof(py::wrapper::Windows::Devices::Lights::Lamp),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_Lamp
    };

    static PyGetSetDef getset_Lamp_Static[] = {
        { }
    };

    static PyMethodDef methods_Lamp_Static[] = {
        { "from_id_async", reinterpret_cast<PyCFunction>(Lamp_FromIdAsync), METH_VARARGS, nullptr },
        { "get_default_async", reinterpret_cast<PyCFunction>(Lamp_GetDefaultAsync), METH_VARARGS, nullptr },
        { "get_device_selector", reinterpret_cast<PyCFunction>(Lamp_GetDeviceSelector), METH_VARARGS, nullptr },
        { }
    };

    static PyType_Slot type_slots_Lamp_Static[] = 
    {
        { Py_tp_base, reinterpret_cast<void*>(&PyType_Type) },
        { Py_tp_getset, reinterpret_cast<void*>(getset_Lamp_Static) },
        { Py_tp_methods, reinterpret_cast<void*>(methods_Lamp_Static) },
        { }
    };

    static PyType_Spec type_spec_Lamp_Static =
    {
        "winrt._winrt_windows_devices_lights.Lamp_Static",
        static_cast<int>(PyType_Type.tp_basicsize),
        static_cast<int>(PyType_Type.tp_itemsize),
        Py_TPFLAGS_DEFAULT,
        type_slots_Lamp_Static
    };

    // ----- LampArray class --------------------

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

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

    static PyObject* LampArray_FromIdAsync(PyObject* /*unused*/, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_Size(args);

        if (arg_count == 1)
        {
            if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Devices.Lights.LampArray", L"FromIdAsync", 1))
            {
                py::set_arg_count_version_error(1);
                return nullptr;
            }

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

                return py::convert(winrt::Windows::Devices::Lights::LampArray::FromIdAsync(param0));
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* LampArray_GetDeviceSelector(PyObject* /*unused*/, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_Size(args);

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

            try
            {
                return py::convert(winrt::Windows::Devices::Lights::LampArray::GetDeviceSelector());
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* LampArray_GetIndicesForKey(py::wrapper::Windows::Devices::Lights::LampArray* self, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_Size(args);

        if (arg_count == 1)
        {
            if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Devices.Lights.LampArray", L"GetIndicesForKey", 1))
            {
                py::set_arg_count_version_error(1);
                return nullptr;
            }

            try
            {
                auto param0 = py::convert_to<winrt::Windows::System::VirtualKey>(args, 0);

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

    static PyObject* LampArray_GetIndicesForPurposes(py::wrapper::Windows::Devices::Lights::LampArray* self, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_Size(args);

        if (arg_count == 1)
        {
            if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Devices.Lights.LampArray", L"GetIndicesForPurposes", 1))
            {
                py::set_arg_count_version_error(1);
                return nullptr;
            }

            try
            {
                auto param0 = py::convert_to<winrt::Windows::Devices::Lights::LampPurposes>(args, 0);

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

    static PyObject* LampArray_GetLampInfo(py::wrapper::Windows::Devices::Lights::LampArray* self, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_Size(args);

        if (arg_count == 1)
        {
            if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Devices.Lights.LampArray", L"GetLampInfo", 1))
            {
                py::set_arg_count_version_error(1);
                return nullptr;
            }

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

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

    static PyObject* LampArray_RequestMessageAsync(py::wrapper::Windows::Devices::Lights::LampArray* self, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_Size(args);

        if (arg_count == 1)
        {
            if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Devices.Lights.LampArray", L"RequestMessageAsync", 1))
            {
                py::set_arg_count_version_error(1);
                return nullptr;
            }

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

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

    static PyObject* LampArray_SendMessageAsync(py::wrapper::Windows::Devices::Lights::LampArray* self, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_Size(args);

        if (arg_count == 2)
        {
            if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Devices.Lights.LampArray", L"SendMessageAsync", 2))
            {
                py::set_arg_count_version_error(2);
                return nullptr;
            }

            try
            {
                auto param0 = py::convert_to<int32_t>(args, 0);
                auto param1 = py::convert_to<winrt::Windows::Storage::Streams::IBuffer>(args, 1);

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

    static PyObject* LampArray_SetColor(py::wrapper::Windows::Devices::Lights::LampArray* self, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_Size(args);

        if (arg_count == 1)
        {
            if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Devices.Lights.LampArray", L"SetColor", 1))
            {
                py::set_arg_count_version_error(1);
                return nullptr;
            }

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

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

    static PyObject* LampArray_SetColorForIndex(py::wrapper::Windows::Devices::Lights::LampArray* self, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_Size(args);

        if (arg_count == 2)
        {
            if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Devices.Lights.LampArray", L"SetColorForIndex", 2))
            {
                py::set_arg_count_version_error(2);
                return nullptr;
            }

            try
            {
                auto param0 = py::convert_to<int32_t>(args, 0);
                auto param1 = py::convert_to<winrt::Windows::UI::Color>(args, 1);

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

    static PyObject* LampArray_SetColorsForIndices(py::wrapper::Windows::Devices::Lights::LampArray* self, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_Size(args);

        if (arg_count == 2)
        {
            if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Devices.Lights.LampArray", L"SetColorsForIndices", 2))
            {
                py::set_arg_count_version_error(2);
                return nullptr;
            }

            try
            {
                auto param0 = py::convert_to<py::pybuf_view<winrt::Windows::UI::Color, false>>(args, 0);
                auto param1 = py::convert_to<py::pybuf_view<int32_t, false>>(args, 1);

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

    static PyObject* LampArray_SetColorsForKey(py::wrapper::Windows::Devices::Lights::LampArray* self, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_Size(args);

        if (arg_count == 2)
        {
            if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Devices.Lights.LampArray", L"SetColorsForKey", 2))
            {
                py::set_arg_count_version_error(2);
                return nullptr;
            }

            try
            {
                auto param0 = py::convert_to<winrt::Windows::UI::Color>(args, 0);
                auto param1 = py::convert_to<winrt::Windows::System::VirtualKey>(args, 1);

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

    static PyObject* LampArray_SetColorsForKeys(py::wrapper::Windows::Devices::Lights::LampArray* self, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_Size(args);

        if (arg_count == 2)
        {
            if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Devices.Lights.LampArray", L"SetColorsForKeys", 2))
            {
                py::set_arg_count_version_error(2);
                return nullptr;
            }

            try
            {
                auto param0 = py::convert_to<py::pybuf_view<winrt::Windows::UI::Color, false>>(args, 0);
                auto param1 = py::convert_to<py::pybuf_view<winrt::Windows::System::VirtualKey, false>>(args, 1);

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

    static PyObject* LampArray_SetColorsForPurposes(py::wrapper::Windows::Devices::Lights::LampArray* self, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_Size(args);

        if (arg_count == 2)
        {
            if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Devices.Lights.LampArray", L"SetColorsForPurposes", 2))
            {
                py::set_arg_count_version_error(2);
                return nullptr;
            }

            try
            {
                auto param0 = py::convert_to<winrt::Windows::UI::Color>(args, 0);
                auto param1 = py::convert_to<winrt::Windows::Devices::Lights::LampPurposes>(args, 1);

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

    static PyObject* LampArray_SetSingleColorForIndices(py::wrapper::Windows::Devices::Lights::LampArray* self, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_Size(args);

        if (arg_count == 2)
        {
            if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Devices.Lights.LampArray", L"SetSingleColorForIndices", 2))
            {
                py::set_arg_count_version_error(2);
                return nullptr;
            }

            try
            {
                auto param0 = py::convert_to<winrt::Windows::UI::Color>(args, 0);
                auto param1 = py::convert_to<py::pybuf_view<int32_t, false>>(args, 1);

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

    static PyObject* LampArray_get_IsEnabled(py::wrapper::Windows::Devices::Lights::LampArray* self, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Devices.Lights.LampArray", L"IsEnabled"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return nullptr;
        }

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

    static int LampArray_put_IsEnabled(py::wrapper::Windows::Devices::Lights::LampArray* self, PyObject* arg, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Devices.Lights.LampArray", L"IsEnabled"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return -1;
        }

        if (arg == nullptr)
        {
            PyErr_SetString(PyExc_AttributeError, "can't delete attribute");
            return -1;
        }

        try
        {
            auto param0 = py::convert_to<bool>(arg);

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

    static PyObject* LampArray_get_BrightnessLevel(py::wrapper::Windows::Devices::Lights::LampArray* self, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Devices.Lights.LampArray", L"BrightnessLevel"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return nullptr;
        }

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

    static int LampArray_put_BrightnessLevel(py::wrapper::Windows::Devices::Lights::LampArray* self, PyObject* arg, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Devices.Lights.LampArray", L"BrightnessLevel"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return -1;
        }

        if (arg == nullptr)
        {
            PyErr_SetString(PyExc_AttributeError, "can't delete attribute");
            return -1;
        }

        try
        {
            auto param0 = py::convert_to<double>(arg);

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

    static PyObject* LampArray_get_BoundingBox(py::wrapper::Windows::Devices::Lights::LampArray* self, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Devices.Lights.LampArray", L"BoundingBox"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return nullptr;
        }

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

    static PyObject* LampArray_get_DeviceId(py::wrapper::Windows::Devices::Lights::LampArray* self, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Devices.Lights.LampArray", L"DeviceId"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return nullptr;
        }

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

    static PyObject* LampArray_get_HardwareProductId(py::wrapper::Windows::Devices::Lights::LampArray* self, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Devices.Lights.LampArray", L"HardwareProductId"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return nullptr;
        }

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

    static PyObject* LampArray_get_HardwareVendorId(py::wrapper::Windows::Devices::Lights::LampArray* self, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Devices.Lights.LampArray", L"HardwareVendorId"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return nullptr;
        }

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

    static PyObject* LampArray_get_HardwareVersion(py::wrapper::Windows::Devices::Lights::LampArray* self, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Devices.Lights.LampArray", L"HardwareVersion"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return nullptr;
        }

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

    static PyObject* LampArray_get_IsConnected(py::wrapper::Windows::Devices::Lights::LampArray* self, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Devices.Lights.LampArray", L"IsConnected"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return nullptr;
        }

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

    static PyObject* LampArray_get_LampArrayKind(py::wrapper::Windows::Devices::Lights::LampArray* self, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Devices.Lights.LampArray", L"LampArrayKind"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return nullptr;
        }

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

    static PyObject* LampArray_get_LampCount(py::wrapper::Windows::Devices::Lights::LampArray* self, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Devices.Lights.LampArray", L"LampCount"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return nullptr;
        }

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

    static PyObject* LampArray_get_MinUpdateInterval(py::wrapper::Windows::Devices::Lights::LampArray* self, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Devices.Lights.LampArray", L"MinUpdateInterval"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return nullptr;
        }

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

    static PyObject* LampArray_get_SupportsVirtualKeys(py::wrapper::Windows::Devices::Lights::LampArray* self, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Devices.Lights.LampArray", L"SupportsVirtualKeys"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return nullptr;
        }

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

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

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

    static PyMethodDef _methods_LampArray[] = {
        { "get_indices_for_key", reinterpret_cast<PyCFunction>(LampArray_GetIndicesForKey), METH_VARARGS, nullptr },
        { "get_indices_for_purposes", reinterpret_cast<PyCFunction>(LampArray_GetIndicesForPurposes), METH_VARARGS, nullptr },
        { "get_lamp_info", reinterpret_cast<PyCFunction>(LampArray_GetLampInfo), METH_VARARGS, nullptr },
        { "request_message_async", reinterpret_cast<PyCFunction>(LampArray_RequestMessageAsync), METH_VARARGS, nullptr },
        { "send_message_async", reinterpret_cast<PyCFunction>(LampArray_SendMessageAsync), METH_VARARGS, nullptr },
        { "set_color", reinterpret_cast<PyCFunction>(LampArray_SetColor), METH_VARARGS, nullptr },
        { "set_color_for_index", reinterpret_cast<PyCFunction>(LampArray_SetColorForIndex), METH_VARARGS, nullptr },
        { "set_colors_for_indices", reinterpret_cast<PyCFunction>(LampArray_SetColorsForIndices), METH_VARARGS, nullptr },
        { "set_colors_for_key", reinterpret_cast<PyCFunction>(LampArray_SetColorsForKey), METH_VARARGS, nullptr },
        { "set_colors_for_keys", reinterpret_cast<PyCFunction>(LampArray_SetColorsForKeys), METH_VARARGS, nullptr },
        { "set_colors_for_purposes", reinterpret_cast<PyCFunction>(LampArray_SetColorsForPurposes), METH_VARARGS, nullptr },
        { "set_single_color_for_indices", reinterpret_cast<PyCFunction>(LampArray_SetSingleColorForIndices), METH_VARARGS, nullptr },
        { "_assign_array_", _assign_array_LampArray, METH_O | METH_STATIC, nullptr },
        { "_from", reinterpret_cast<PyCFunction>(_from_LampArray), METH_O | METH_STATIC, nullptr },
        { }
    };

    static PyGetSetDef _getset_LampArray[] = {
        { "is_enabled", reinterpret_cast<getter>(LampArray_get_IsEnabled), reinterpret_cast<setter>(LampArray_put_IsEnabled), nullptr, nullptr },
        { "brightness_level", reinterpret_cast<getter>(LampArray_get_BrightnessLevel), reinterpret_cast<setter>(LampArray_put_BrightnessLevel), nullptr, nullptr },
        { "bounding_box", reinterpret_cast<getter>(LampArray_get_BoundingBox), nullptr, nullptr, nullptr },
        { "device_id", reinterpret_cast<getter>(LampArray_get_DeviceId), nullptr, nullptr, nullptr },
        { "hardware_product_id", reinterpret_cast<getter>(LampArray_get_HardwareProductId), nullptr, nullptr, nullptr },
        { "hardware_vendor_id", reinterpret_cast<getter>(LampArray_get_HardwareVendorId), nullptr, nullptr, nullptr },
        { "hardware_version", reinterpret_cast<getter>(LampArray_get_HardwareVersion), nullptr, nullptr, nullptr },
        { "is_connected", reinterpret_cast<getter>(LampArray_get_IsConnected), nullptr, nullptr, nullptr },
        { "lamp_array_kind", reinterpret_cast<getter>(LampArray_get_LampArrayKind), nullptr, nullptr, nullptr },
        { "lamp_count", reinterpret_cast<getter>(LampArray_get_LampCount), nullptr, nullptr, nullptr },
        { "min_update_interval", reinterpret_cast<getter>(LampArray_get_MinUpdateInterval), nullptr, nullptr, nullptr },
        { "supports_virtual_keys", reinterpret_cast<getter>(LampArray_get_SupportsVirtualKeys), nullptr, nullptr, nullptr },
        { }
    };

    static PyType_Slot _type_slots_LampArray[] = 
    {
        { Py_tp_new, reinterpret_cast<void*>(_new_LampArray) },
        { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_LampArray) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_LampArray) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_LampArray) },
        { },
    };

    static PyType_Spec type_spec_LampArray =
    {
        "winrt._winrt_windows_devices_lights.LampArray",
        sizeof(py::wrapper::Windows::Devices::Lights::LampArray),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_LampArray
    };

    static PyGetSetDef getset_LampArray_Static[] = {
        { }
    };

    static PyMethodDef methods_LampArray_Static[] = {
        { "from_id_async", reinterpret_cast<PyCFunction>(LampArray_FromIdAsync), METH_VARARGS, nullptr },
        { "get_device_selector", reinterpret_cast<PyCFunction>(LampArray_GetDeviceSelector), METH_VARARGS, nullptr },
        { }
    };

    static PyType_Slot type_slots_LampArray_Static[] = 
    {
        { Py_tp_base, reinterpret_cast<void*>(&PyType_Type) },
        { Py_tp_getset, reinterpret_cast<void*>(getset_LampArray_Static) },
        { Py_tp_methods, reinterpret_cast<void*>(methods_LampArray_Static) },
        { }
    };

    static PyType_Spec type_spec_LampArray_Static =
    {
        "winrt._winrt_windows_devices_lights.LampArray_Static",
        static_cast<int>(PyType_Type.tp_basicsize),
        static_cast<int>(PyType_Type.tp_itemsize),
        Py_TPFLAGS_DEFAULT,
        type_slots_LampArray_Static
    };

    // ----- LampAvailabilityChangedEventArgs class --------------------

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

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

    static PyObject* LampAvailabilityChangedEventArgs_get_IsAvailable(py::wrapper::Windows::Devices::Lights::LampAvailabilityChangedEventArgs* self, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Devices.Lights.LampAvailabilityChangedEventArgs", L"IsAvailable"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return nullptr;
        }

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

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

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

    static PyMethodDef _methods_LampAvailabilityChangedEventArgs[] = {
        { "_assign_array_", _assign_array_LampAvailabilityChangedEventArgs, METH_O | METH_STATIC, nullptr },
        { "_from", reinterpret_cast<PyCFunction>(_from_LampAvailabilityChangedEventArgs), METH_O | METH_STATIC, nullptr },
        { }
    };

    static PyGetSetDef _getset_LampAvailabilityChangedEventArgs[] = {
        { "is_available", reinterpret_cast<getter>(LampAvailabilityChangedEventArgs_get_IsAvailable), nullptr, nullptr, nullptr },
        { }
    };

    static PyType_Slot _type_slots_LampAvailabilityChangedEventArgs[] = 
    {
        { Py_tp_new, reinterpret_cast<void*>(_new_LampAvailabilityChangedEventArgs) },
        { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_LampAvailabilityChangedEventArgs) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_LampAvailabilityChangedEventArgs) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_LampAvailabilityChangedEventArgs) },
        { },
    };

    static PyType_Spec type_spec_LampAvailabilityChangedEventArgs =
    {
        "winrt._winrt_windows_devices_lights.LampAvailabilityChangedEventArgs",
        sizeof(py::wrapper::Windows::Devices::Lights::LampAvailabilityChangedEventArgs),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_LampAvailabilityChangedEventArgs
    };

    // ----- LampInfo class --------------------

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

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

    static PyObject* LampInfo_GetNearestSupportedColor(py::wrapper::Windows::Devices::Lights::LampInfo* self, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_Size(args);

        if (arg_count == 1)
        {
            if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Devices.Lights.LampInfo", L"GetNearestSupportedColor", 1))
            {
                py::set_arg_count_version_error(1);
                return nullptr;
            }

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

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

    static PyObject* LampInfo_get_BlueLevelCount(py::wrapper::Windows::Devices::Lights::LampInfo* self, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Devices.Lights.LampInfo", L"BlueLevelCount"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return nullptr;
        }

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

    static PyObject* LampInfo_get_FixedColor(py::wrapper::Windows::Devices::Lights::LampInfo* self, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Devices.Lights.LampInfo", L"FixedColor"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return nullptr;
        }

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

    static PyObject* LampInfo_get_GainLevelCount(py::wrapper::Windows::Devices::Lights::LampInfo* self, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Devices.Lights.LampInfo", L"GainLevelCount"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return nullptr;
        }

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

    static PyObject* LampInfo_get_GreenLevelCount(py::wrapper::Windows::Devices::Lights::LampInfo* self, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Devices.Lights.LampInfo", L"GreenLevelCount"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return nullptr;
        }

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

    static PyObject* LampInfo_get_Index(py::wrapper::Windows::Devices::Lights::LampInfo* self, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Devices.Lights.LampInfo", L"Index"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return nullptr;
        }

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

    static PyObject* LampInfo_get_Position(py::wrapper::Windows::Devices::Lights::LampInfo* self, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Devices.Lights.LampInfo", L"Position"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return nullptr;
        }

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

    static PyObject* LampInfo_get_Purposes(py::wrapper::Windows::Devices::Lights::LampInfo* self, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Devices.Lights.LampInfo", L"Purposes"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return nullptr;
        }

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

    static PyObject* LampInfo_get_RedLevelCount(py::wrapper::Windows::Devices::Lights::LampInfo* self, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Devices.Lights.LampInfo", L"RedLevelCount"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return nullptr;
        }

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

    static PyObject* LampInfo_get_UpdateLatency(py::wrapper::Windows::Devices::Lights::LampInfo* self, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Devices.Lights.LampInfo", L"UpdateLatency"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return nullptr;
        }

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

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

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

    static PyMethodDef _methods_LampInfo[] = {
        { "get_nearest_supported_color", reinterpret_cast<PyCFunction>(LampInfo_GetNearestSupportedColor), METH_VARARGS, nullptr },
        { "_assign_array_", _assign_array_LampInfo, METH_O | METH_STATIC, nullptr },
        { "_from", reinterpret_cast<PyCFunction>(_from_LampInfo), METH_O | METH_STATIC, nullptr },
        { }
    };

    static PyGetSetDef _getset_LampInfo[] = {
        { "blue_level_count", reinterpret_cast<getter>(LampInfo_get_BlueLevelCount), nullptr, nullptr, nullptr },
        { "fixed_color", reinterpret_cast<getter>(LampInfo_get_FixedColor), nullptr, nullptr, nullptr },
        { "gain_level_count", reinterpret_cast<getter>(LampInfo_get_GainLevelCount), nullptr, nullptr, nullptr },
        { "green_level_count", reinterpret_cast<getter>(LampInfo_get_GreenLevelCount), nullptr, nullptr, nullptr },
        { "index", reinterpret_cast<getter>(LampInfo_get_Index), nullptr, nullptr, nullptr },
        { "position", reinterpret_cast<getter>(LampInfo_get_Position), nullptr, nullptr, nullptr },
        { "purposes", reinterpret_cast<getter>(LampInfo_get_Purposes), nullptr, nullptr, nullptr },
        { "red_level_count", reinterpret_cast<getter>(LampInfo_get_RedLevelCount), nullptr, nullptr, nullptr },
        { "update_latency", reinterpret_cast<getter>(LampInfo_get_UpdateLatency), nullptr, nullptr, nullptr },
        { }
    };

    static PyType_Slot _type_slots_LampInfo[] = 
    {
        { Py_tp_new, reinterpret_cast<void*>(_new_LampInfo) },
        { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_LampInfo) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_LampInfo) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_LampInfo) },
        { },
    };

    static PyType_Spec type_spec_LampInfo =
    {
        "winrt._winrt_windows_devices_lights.LampInfo",
        sizeof(py::wrapper::Windows::Devices::Lights::LampInfo),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_LampInfo
    };

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


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

} // py::cpp::Windows::Devices::Lights

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

    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::pyobj_handle type_Lamp_Static{PyType_FromSpec(&type_spec_Lamp_Static)};
    if (!type_Lamp_Static)
    {
        return nullptr;
    }

    if (py::register_python_type(module.get(), &type_spec_Lamp, object_bases.get(), reinterpret_cast<PyTypeObject*>(type_Lamp_Static.get())) == -1)
    {
        return nullptr;
    }

    py::pyobj_handle type_LampArray_Static{PyType_FromSpec(&type_spec_LampArray_Static)};
    if (!type_LampArray_Static)
    {
        return nullptr;
    }

    if (py::register_python_type(module.get(), &type_spec_LampArray, object_bases.get(), reinterpret_cast<PyTypeObject*>(type_LampArray_Static.get())) == -1)
    {
        return nullptr;
    }

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

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


    return module.detach();
}
