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

#include "py.Microsoft.Graphics.Display.h"

namespace py::cpp::Microsoft::Graphics::Display
{
    // ----- DisplayAdvancedColorInfo class --------------------

    static PyObject* _new_DisplayAdvancedColorInfo(PyTypeObject* /*unused*/, PyObject* /*unused*/, PyObject* /*unused*/) noexcept
    {
        static_assert(py::py_type<winrt::Microsoft::Graphics::Display::DisplayAdvancedColorInfo>::type_name);
        py::set_invalid_activation_error(py::py_type<winrt::Microsoft::Graphics::Display::DisplayAdvancedColorInfo>::type_name);
        return nullptr;
    }

    static void _dealloc_DisplayAdvancedColorInfo(py::wrapper::Microsoft::Graphics::Display::DisplayAdvancedColorInfo* self) noexcept
    {
        auto tp = Py_TYPE(self);
        std::destroy_at(&self->obj);
        tp->tp_free(self);
        Py_DECREF(tp);
    }

    static PyObject* DisplayAdvancedColorInfo_IsAdvancedColorKindAvailable(py::wrapper::Microsoft::Graphics::Display::DisplayAdvancedColorInfo* self, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_GET_SIZE(args);

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

                if (!is_overload_present.has_value())
                {
                    is_overload_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Microsoft.Graphics.Display.DisplayAdvancedColorInfo", L"IsAdvancedColorKindAvailable", 1);
                }

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

                auto param0 = py::convert_to<winrt::Microsoft::Graphics::Display::DisplayAdvancedColorKind>(args, 0);

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

    static PyObject* DisplayAdvancedColorInfo_IsHdrMetadataFormatCurrentlySupported(py::wrapper::Microsoft::Graphics::Display::DisplayAdvancedColorInfo* self, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_GET_SIZE(args);

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

                if (!is_overload_present.has_value())
                {
                    is_overload_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Microsoft.Graphics.Display.DisplayAdvancedColorInfo", L"IsHdrMetadataFormatCurrentlySupported", 1);
                }

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

                auto param0 = py::convert_to<winrt::Microsoft::Graphics::Display::DisplayHdrMetadataFormat>(args, 0);

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

    static PyObject* DisplayAdvancedColorInfo_get_BluePrimary(py::wrapper::Microsoft::Graphics::Display::DisplayAdvancedColorInfo* 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"Microsoft.Graphics.Display.DisplayAdvancedColorInfo", L"BluePrimary");
            }

            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.BluePrimary();
            }());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* DisplayAdvancedColorInfo_get_CurrentAdvancedColorKind(py::wrapper::Microsoft::Graphics::Display::DisplayAdvancedColorInfo* 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"Microsoft.Graphics.Display.DisplayAdvancedColorInfo", L"CurrentAdvancedColorKind");
            }

            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.CurrentAdvancedColorKind();
            }());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* DisplayAdvancedColorInfo_get_GreenPrimary(py::wrapper::Microsoft::Graphics::Display::DisplayAdvancedColorInfo* 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"Microsoft.Graphics.Display.DisplayAdvancedColorInfo", L"GreenPrimary");
            }

            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.GreenPrimary();
            }());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* DisplayAdvancedColorInfo_get_MaxAverageFullFrameLuminanceInNits(py::wrapper::Microsoft::Graphics::Display::DisplayAdvancedColorInfo* 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"Microsoft.Graphics.Display.DisplayAdvancedColorInfo", L"MaxAverageFullFrameLuminanceInNits");
            }

            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.MaxAverageFullFrameLuminanceInNits();
            }());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* DisplayAdvancedColorInfo_get_MaxLuminanceInNits(py::wrapper::Microsoft::Graphics::Display::DisplayAdvancedColorInfo* 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"Microsoft.Graphics.Display.DisplayAdvancedColorInfo", L"MaxLuminanceInNits");
            }

            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.MaxLuminanceInNits();
            }());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* DisplayAdvancedColorInfo_get_MinLuminanceInNits(py::wrapper::Microsoft::Graphics::Display::DisplayAdvancedColorInfo* 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"Microsoft.Graphics.Display.DisplayAdvancedColorInfo", L"MinLuminanceInNits");
            }

            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.MinLuminanceInNits();
            }());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* DisplayAdvancedColorInfo_get_RedPrimary(py::wrapper::Microsoft::Graphics::Display::DisplayAdvancedColorInfo* 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"Microsoft.Graphics.Display.DisplayAdvancedColorInfo", L"RedPrimary");
            }

            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.RedPrimary();
            }());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* DisplayAdvancedColorInfo_get_SdrWhiteLevelInNits(py::wrapper::Microsoft::Graphics::Display::DisplayAdvancedColorInfo* 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"Microsoft.Graphics.Display.DisplayAdvancedColorInfo", L"SdrWhiteLevelInNits");
            }

            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.SdrWhiteLevelInNits();
            }());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* DisplayAdvancedColorInfo_get_WhitePoint(py::wrapper::Microsoft::Graphics::Display::DisplayAdvancedColorInfo* 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"Microsoft.Graphics.Display.DisplayAdvancedColorInfo", L"WhitePoint");
            }

            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.WhitePoint();
            }());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

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

    static PyObject* _from_DisplayAdvancedColorInfo(PyObject* /*unused*/, PyObject* arg) noexcept
    {
        try
        {
            auto return_value = py::convert_to<winrt::Windows::Foundation::IInspectable>(arg);
            return py::convert(return_value.as<winrt::Microsoft::Graphics::Display::DisplayAdvancedColorInfo>());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyMethodDef _methods_DisplayAdvancedColorInfo[] = {
        { "is_advanced_color_kind_available", reinterpret_cast<PyCFunction>(DisplayAdvancedColorInfo_IsAdvancedColorKindAvailable), METH_VARARGS, nullptr },
        { "is_hdr_metadata_format_currently_supported", reinterpret_cast<PyCFunction>(DisplayAdvancedColorInfo_IsHdrMetadataFormatCurrentlySupported), METH_VARARGS, nullptr },
        { "_assign_array_", _assign_array_DisplayAdvancedColorInfo, METH_O | METH_STATIC, nullptr },
        { "_from", reinterpret_cast<PyCFunction>(_from_DisplayAdvancedColorInfo), METH_O | METH_STATIC, nullptr },
        { }};

    static PyGetSetDef _getset_DisplayAdvancedColorInfo[] = {
        { "blue_primary", reinterpret_cast<getter>(DisplayAdvancedColorInfo_get_BluePrimary), nullptr, nullptr, nullptr },
        { "current_advanced_color_kind", reinterpret_cast<getter>(DisplayAdvancedColorInfo_get_CurrentAdvancedColorKind), nullptr, nullptr, nullptr },
        { "green_primary", reinterpret_cast<getter>(DisplayAdvancedColorInfo_get_GreenPrimary), nullptr, nullptr, nullptr },
        { "max_average_full_frame_luminance_in_nits", reinterpret_cast<getter>(DisplayAdvancedColorInfo_get_MaxAverageFullFrameLuminanceInNits), nullptr, nullptr, nullptr },
        { "max_luminance_in_nits", reinterpret_cast<getter>(DisplayAdvancedColorInfo_get_MaxLuminanceInNits), nullptr, nullptr, nullptr },
        { "min_luminance_in_nits", reinterpret_cast<getter>(DisplayAdvancedColorInfo_get_MinLuminanceInNits), nullptr, nullptr, nullptr },
        { "red_primary", reinterpret_cast<getter>(DisplayAdvancedColorInfo_get_RedPrimary), nullptr, nullptr, nullptr },
        { "sdr_white_level_in_nits", reinterpret_cast<getter>(DisplayAdvancedColorInfo_get_SdrWhiteLevelInNits), nullptr, nullptr, nullptr },
        { "white_point", reinterpret_cast<getter>(DisplayAdvancedColorInfo_get_WhitePoint), nullptr, nullptr, nullptr },
        { }};

    static PyType_Slot _type_slots_DisplayAdvancedColorInfo[] = {
        { Py_tp_new, reinterpret_cast<void*>(_new_DisplayAdvancedColorInfo) },
        { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_DisplayAdvancedColorInfo) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_DisplayAdvancedColorInfo) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_DisplayAdvancedColorInfo) },
        { }};

    static PyType_Spec type_spec_DisplayAdvancedColorInfo = {
        "winui3._winui3_microsoft_graphics_display.DisplayAdvancedColorInfo",
        sizeof(py::wrapper::Microsoft::Graphics::Display::DisplayAdvancedColorInfo),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_DisplayAdvancedColorInfo};

    // ----- DisplayInformation class --------------------

    static PyObject* _new_DisplayInformation(PyTypeObject* /*unused*/, PyObject* /*unused*/, PyObject* /*unused*/) noexcept
    {
        static_assert(py::py_type<winrt::Microsoft::Graphics::Display::DisplayInformation>::type_name);
        py::set_invalid_activation_error(py::py_type<winrt::Microsoft::Graphics::Display::DisplayInformation>::type_name);
        return nullptr;
    }

    static void _dealloc_DisplayInformation(py::wrapper::Microsoft::Graphics::Display::DisplayInformation* self) noexcept
    {
        auto tp = Py_TYPE(self);
        std::destroy_at(&self->obj);
        tp->tp_free(self);
        Py_DECREF(tp);
    }

    static PyObject* DisplayInformation_Close(py::wrapper::Microsoft::Graphics::Display::DisplayInformation* self, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_GET_SIZE(args);

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

                if (!is_overload_present.has_value())
                {
                    is_overload_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Microsoft.Graphics.Display.DisplayInformation", L"Close", 0);
                }

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

                {
                    auto _gil = release_gil();
                    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* DisplayInformation_CreateForDisplayId(PyObject* /*unused*/, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_GET_SIZE(args);

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

                if (!is_overload_present.has_value())
                {
                    is_overload_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Microsoft.Graphics.Display.DisplayInformation", L"CreateForDisplayId", 1);
                }

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

                auto param0 = py::convert_to<winrt::Microsoft::UI::DisplayId>(args, 0);

                return py::convert([&]()
                {
                    auto _gil = release_gil();
                    return winrt::Microsoft::Graphics::Display::DisplayInformation::CreateForDisplayId(param0);
                }());
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* DisplayInformation_CreateForWindowId(PyObject* /*unused*/, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_GET_SIZE(args);

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

                if (!is_overload_present.has_value())
                {
                    is_overload_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Microsoft.Graphics.Display.DisplayInformation", L"CreateForWindowId", 1);
                }

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

                auto param0 = py::convert_to<winrt::Microsoft::UI::WindowId>(args, 0);

                return py::convert([&]()
                {
                    auto _gil = release_gil();
                    return winrt::Microsoft::Graphics::Display::DisplayInformation::CreateForWindowId(param0);
                }());
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* DisplayInformation_GetAdvancedColorInfo(py::wrapper::Microsoft::Graphics::Display::DisplayInformation* self, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_GET_SIZE(args);

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

                if (!is_overload_present.has_value())
                {
                    is_overload_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Microsoft.Graphics.Display.DisplayInformation", L"GetAdvancedColorInfo", 0);
                }

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

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

    static PyObject* DisplayInformation_GetColorProfile(py::wrapper::Microsoft::Graphics::Display::DisplayInformation* self, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_GET_SIZE(args);

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

                if (!is_overload_present.has_value())
                {
                    is_overload_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Microsoft.Graphics.Display.DisplayInformation", L"GetColorProfile", 0);
                }

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

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

    static PyObject* DisplayInformation_GetColorProfileAsync(py::wrapper::Microsoft::Graphics::Display::DisplayInformation* self, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_GET_SIZE(args);

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

                if (!is_overload_present.has_value())
                {
                    is_overload_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Microsoft.Graphics.Display.DisplayInformation", L"GetColorProfileAsync", 0);
                }

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

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

    static PyObject* DisplayInformation_get_DispatcherQueue(py::wrapper::Microsoft::Graphics::Display::DisplayInformation* 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"Microsoft.Graphics.Display.DisplayInformation", L"DispatcherQueue");
            }

            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.DispatcherQueue();
            }());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* DisplayInformation_get_IsStereoEnabled(py::wrapper::Microsoft::Graphics::Display::DisplayInformation* 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"Microsoft.Graphics.Display.DisplayInformation", L"IsStereoEnabled");
            }

            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.IsStereoEnabled();
            }());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* DisplayInformation_add_AdvancedColorInfoChanged(py::wrapper::Microsoft::Graphics::Display::DisplayInformation* self, PyObject* arg) noexcept
    {
        try
        {
            static std::optional<bool> is_event_present{};

            if (!is_event_present.has_value())
            {
                is_event_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsEventPresent(L"Microsoft.Graphics.Display.DisplayInformation", L"AdvancedColorInfoChanged");
            }

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

            auto param0 = py::convert_to<winrt::Windows::Foundation::TypedEventHandler<winrt::Microsoft::Graphics::Display::DisplayInformation, winrt::Windows::Foundation::IInspectable>>(arg);

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

    static PyObject* DisplayInformation_remove_AdvancedColorInfoChanged(py::wrapper::Microsoft::Graphics::Display::DisplayInformation* self, PyObject* arg) noexcept
    {
        try
        {
            static std::optional<bool> is_event_present{};

            if (!is_event_present.has_value())
            {
                is_event_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsEventPresent(L"Microsoft.Graphics.Display.DisplayInformation", L"AdvancedColorInfoChanged");
            }

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

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

            {
                auto _gil = release_gil();
                self->obj.AdvancedColorInfoChanged(param0);
            }

            Py_RETURN_NONE;
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* DisplayInformation_add_ColorProfileChanged(py::wrapper::Microsoft::Graphics::Display::DisplayInformation* self, PyObject* arg) noexcept
    {
        try
        {
            static std::optional<bool> is_event_present{};

            if (!is_event_present.has_value())
            {
                is_event_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsEventPresent(L"Microsoft.Graphics.Display.DisplayInformation", L"ColorProfileChanged");
            }

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

            auto param0 = py::convert_to<winrt::Windows::Foundation::TypedEventHandler<winrt::Microsoft::Graphics::Display::DisplayInformation, winrt::Windows::Foundation::IInspectable>>(arg);

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

    static PyObject* DisplayInformation_remove_ColorProfileChanged(py::wrapper::Microsoft::Graphics::Display::DisplayInformation* self, PyObject* arg) noexcept
    {
        try
        {
            static std::optional<bool> is_event_present{};

            if (!is_event_present.has_value())
            {
                is_event_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsEventPresent(L"Microsoft.Graphics.Display.DisplayInformation", L"ColorProfileChanged");
            }

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

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

            {
                auto _gil = release_gil();
                self->obj.ColorProfileChanged(param0);
            }

            Py_RETURN_NONE;
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* DisplayInformation_add_Destroyed(py::wrapper::Microsoft::Graphics::Display::DisplayInformation* self, PyObject* arg) noexcept
    {
        try
        {
            static std::optional<bool> is_event_present{};

            if (!is_event_present.has_value())
            {
                is_event_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsEventPresent(L"Microsoft.Graphics.Display.DisplayInformation", L"Destroyed");
            }

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

            auto param0 = py::convert_to<winrt::Windows::Foundation::TypedEventHandler<winrt::Microsoft::Graphics::Display::DisplayInformation, winrt::Windows::Foundation::IInspectable>>(arg);

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

    static PyObject* DisplayInformation_remove_Destroyed(py::wrapper::Microsoft::Graphics::Display::DisplayInformation* self, PyObject* arg) noexcept
    {
        try
        {
            static std::optional<bool> is_event_present{};

            if (!is_event_present.has_value())
            {
                is_event_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsEventPresent(L"Microsoft.Graphics.Display.DisplayInformation", L"Destroyed");
            }

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

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

            {
                auto _gil = release_gil();
                self->obj.Destroyed(param0);
            }

            Py_RETURN_NONE;
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* DisplayInformation_add_IsStereoEnabledChanged(py::wrapper::Microsoft::Graphics::Display::DisplayInformation* self, PyObject* arg) noexcept
    {
        try
        {
            static std::optional<bool> is_event_present{};

            if (!is_event_present.has_value())
            {
                is_event_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsEventPresent(L"Microsoft.Graphics.Display.DisplayInformation", L"IsStereoEnabledChanged");
            }

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

            auto param0 = py::convert_to<winrt::Windows::Foundation::TypedEventHandler<winrt::Microsoft::Graphics::Display::DisplayInformation, winrt::Windows::Foundation::IInspectable>>(arg);

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

    static PyObject* DisplayInformation_remove_IsStereoEnabledChanged(py::wrapper::Microsoft::Graphics::Display::DisplayInformation* self, PyObject* arg) noexcept
    {
        try
        {
            static std::optional<bool> is_event_present{};

            if (!is_event_present.has_value())
            {
                is_event_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsEventPresent(L"Microsoft.Graphics.Display.DisplayInformation", L"IsStereoEnabledChanged");
            }

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

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

            {
                auto _gil = release_gil();
                self->obj.IsStereoEnabledChanged(param0);
            }

            Py_RETURN_NONE;
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

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

    static PyObject* _from_DisplayInformation(PyObject* /*unused*/, PyObject* arg) noexcept
    {
        try
        {
            auto return_value = py::convert_to<winrt::Windows::Foundation::IInspectable>(arg);
            return py::convert(return_value.as<winrt::Microsoft::Graphics::Display::DisplayInformation>());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* _enter_DisplayInformation(py::wrapper::Microsoft::Graphics::Display::DisplayInformation* self, PyObject* /*unused*/) noexcept
    {
        return Py_NewRef(self);
    }

    static PyObject* _exit_DisplayInformation(py::wrapper::Microsoft::Graphics::Display::DisplayInformation* self, PyObject* /*unused*/) noexcept
    {
        try
        {
            {
                auto _gil = py::release_gil();
                self->obj.Close();
            }

            Py_RETURN_FALSE;
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyMethodDef _methods_DisplayInformation[] = {
        { "close", reinterpret_cast<PyCFunction>(DisplayInformation_Close), METH_VARARGS, nullptr },
        { "get_advanced_color_info", reinterpret_cast<PyCFunction>(DisplayInformation_GetAdvancedColorInfo), METH_VARARGS, nullptr },
        { "get_color_profile", reinterpret_cast<PyCFunction>(DisplayInformation_GetColorProfile), METH_VARARGS, nullptr },
        { "get_color_profile_async", reinterpret_cast<PyCFunction>(DisplayInformation_GetColorProfileAsync), METH_VARARGS, nullptr },
        { "add_advanced_color_info_changed", reinterpret_cast<PyCFunction>(DisplayInformation_add_AdvancedColorInfoChanged), METH_O, nullptr },
        { "remove_advanced_color_info_changed", reinterpret_cast<PyCFunction>(DisplayInformation_remove_AdvancedColorInfoChanged), METH_O, nullptr },
        { "add_color_profile_changed", reinterpret_cast<PyCFunction>(DisplayInformation_add_ColorProfileChanged), METH_O, nullptr },
        { "remove_color_profile_changed", reinterpret_cast<PyCFunction>(DisplayInformation_remove_ColorProfileChanged), METH_O, nullptr },
        { "add_destroyed", reinterpret_cast<PyCFunction>(DisplayInformation_add_Destroyed), METH_O, nullptr },
        { "remove_destroyed", reinterpret_cast<PyCFunction>(DisplayInformation_remove_Destroyed), METH_O, nullptr },
        { "add_is_stereo_enabled_changed", reinterpret_cast<PyCFunction>(DisplayInformation_add_IsStereoEnabledChanged), METH_O, nullptr },
        { "remove_is_stereo_enabled_changed", reinterpret_cast<PyCFunction>(DisplayInformation_remove_IsStereoEnabledChanged), METH_O, nullptr },
        { "_assign_array_", _assign_array_DisplayInformation, METH_O | METH_STATIC, nullptr },
        { "_from", reinterpret_cast<PyCFunction>(_from_DisplayInformation), METH_O | METH_STATIC, nullptr },
        { "__enter__", reinterpret_cast<PyCFunction>(_enter_DisplayInformation), METH_NOARGS, nullptr },
        { "__exit__", reinterpret_cast<PyCFunction>(_exit_DisplayInformation), METH_VARARGS, nullptr },
        { }};

    static PyGetSetDef _getset_DisplayInformation[] = {
        { "dispatcher_queue", reinterpret_cast<getter>(DisplayInformation_get_DispatcherQueue), nullptr, nullptr, nullptr },
        { "is_stereo_enabled", reinterpret_cast<getter>(DisplayInformation_get_IsStereoEnabled), nullptr, nullptr, nullptr },
        { }};

    static PyType_Slot _type_slots_DisplayInformation[] = {
        { Py_tp_new, reinterpret_cast<void*>(_new_DisplayInformation) },
        { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_DisplayInformation) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_DisplayInformation) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_DisplayInformation) },
        { }};

    static PyType_Spec type_spec_DisplayInformation = {
        "winui3._winui3_microsoft_graphics_display.DisplayInformation",
        sizeof(py::wrapper::Microsoft::Graphics::Display::DisplayInformation),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_DisplayInformation};

    static PyGetSetDef getset_DisplayInformation_Static[] = {
        { }};

    static PyMethodDef methods_DisplayInformation_Static[] = {
        { "create_for_display_id", reinterpret_cast<PyCFunction>(DisplayInformation_CreateForDisplayId), METH_VARARGS, nullptr },
        { "create_for_window_id", reinterpret_cast<PyCFunction>(DisplayInformation_CreateForWindowId), METH_VARARGS, nullptr },
        { }};

    static PyType_Slot type_slots_DisplayInformation_Static[] = 
    {
        { Py_tp_base, reinterpret_cast<void*>(&PyType_Type) },
        { Py_tp_getset, reinterpret_cast<void*>(getset_DisplayInformation_Static) },
        { Py_tp_methods, reinterpret_cast<void*>(methods_DisplayInformation_Static) },
        { }
    };

    static PyType_Spec type_spec_DisplayInformation_Static = {
        "winui3._winui3_microsoft_graphics_display.DisplayInformation_Static",
        static_cast<int>(PyType_Type.tp_basicsize),
        static_cast<int>(PyType_Type.tp_itemsize),
        Py_TPFLAGS_DEFAULT,
        type_slots_DisplayInformation_Static};

    // ----- Microsoft.Graphics.Display Initialization --------------------

    PyDoc_STRVAR(module_doc, "Microsoft.Graphics.Display");

    static PyModuleDef module_def = {
        PyModuleDef_HEAD_INIT,
        "_winui3_microsoft_graphics_display",
        module_doc,
        0,
        nullptr,
        nullptr,
        nullptr,
        nullptr,
        nullptr};
} // py::cpp::Microsoft::Graphics::Display

PyMODINIT_FUNC PyInit__winui3_microsoft_graphics_display(void) noexcept
{
    using namespace py::cpp::Microsoft::Graphics::Display;

    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 DisplayAdvancedColorInfo_type{py::register_python_type(module.get(), &type_spec_DisplayAdvancedColorInfo, object_bases.get(), inspectable_meta_type)};
    if (!DisplayAdvancedColorInfo_type)
    {
        return nullptr;
    }

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

    py::pyobj_handle type_DisplayInformation_Static{PyType_FromSpecWithBases(&type_spec_DisplayInformation_Static, DisplayInformation_Static_bases.get())};
    if (!type_DisplayInformation_Static)
    {
        return nullptr;
    }

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


    return module.detach();
}
