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

#include "py.Windows.Services.TargetedContent.h"

namespace py::cpp::Windows::Services::TargetedContent
{
    // ----- TargetedContentAction class --------------------

    static PyObject* _new_TargetedContentAction(PyTypeObject* /*unused*/, PyObject* /*unused*/, PyObject* /*unused*/) noexcept
    {
        static_assert(py::py_type<winrt::Windows::Services::TargetedContent::TargetedContentAction>::type_name);
        py::set_invalid_activation_error(py::py_type<winrt::Windows::Services::TargetedContent::TargetedContentAction>::type_name);
        return nullptr;
    }

    static void _dealloc_TargetedContentAction(py::wrapper::Windows::Services::TargetedContent::TargetedContentAction* self) noexcept
    {
        auto tp = Py_TYPE(self);
        std::destroy_at(&self->obj);
        tp->tp_free(self);
        Py_DECREF(tp);
    }

    static PyObject* TargetedContentAction_InvokeAsync(py::wrapper::Windows::Services::TargetedContent::TargetedContentAction* 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"Windows.Services.TargetedContent.TargetedContentAction", L"InvokeAsync", 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.InvokeAsync();
                }());
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

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

    static PyObject* _from_TargetedContentAction(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::Services::TargetedContent::TargetedContentAction>());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyMethodDef _methods_TargetedContentAction[] = {
        { "invoke_async", reinterpret_cast<PyCFunction>(TargetedContentAction_InvokeAsync), METH_VARARGS, nullptr },
        { "_assign_array_", _assign_array_TargetedContentAction, METH_O | METH_STATIC, nullptr },
        { "_from", reinterpret_cast<PyCFunction>(_from_TargetedContentAction), METH_O | METH_STATIC, nullptr },
        { }};

    static PyGetSetDef _getset_TargetedContentAction[] = {
        { }};

    static PyType_Slot _type_slots_TargetedContentAction[] = {
        { Py_tp_new, reinterpret_cast<void*>(_new_TargetedContentAction) },
        { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_TargetedContentAction) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_TargetedContentAction) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_TargetedContentAction) },
        { }};

    static PyType_Spec type_spec_TargetedContentAction = {
        "winrt._winrt_windows_services_targetedcontent.TargetedContentAction",
        sizeof(py::wrapper::Windows::Services::TargetedContent::TargetedContentAction),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_TargetedContentAction};

    // ----- TargetedContentAvailabilityChangedEventArgs class --------------------

    static PyObject* _new_TargetedContentAvailabilityChangedEventArgs(PyTypeObject* /*unused*/, PyObject* /*unused*/, PyObject* /*unused*/) noexcept
    {
        static_assert(py::py_type<winrt::Windows::Services::TargetedContent::TargetedContentAvailabilityChangedEventArgs>::type_name);
        py::set_invalid_activation_error(py::py_type<winrt::Windows::Services::TargetedContent::TargetedContentAvailabilityChangedEventArgs>::type_name);
        return nullptr;
    }

    static void _dealloc_TargetedContentAvailabilityChangedEventArgs(py::wrapper::Windows::Services::TargetedContent::TargetedContentAvailabilityChangedEventArgs* self) noexcept
    {
        auto tp = Py_TYPE(self);
        std::destroy_at(&self->obj);
        tp->tp_free(self);
        Py_DECREF(tp);
    }

    static PyObject* TargetedContentAvailabilityChangedEventArgs_GetDeferral(py::wrapper::Windows::Services::TargetedContent::TargetedContentAvailabilityChangedEventArgs* 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"Windows.Services.TargetedContent.TargetedContentAvailabilityChangedEventArgs", L"GetDeferral", 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.GetDeferral();
                }());
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

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

    static PyObject* _from_TargetedContentAvailabilityChangedEventArgs(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::Services::TargetedContent::TargetedContentAvailabilityChangedEventArgs>());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyMethodDef _methods_TargetedContentAvailabilityChangedEventArgs[] = {
        { "get_deferral", reinterpret_cast<PyCFunction>(TargetedContentAvailabilityChangedEventArgs_GetDeferral), METH_VARARGS, nullptr },
        { "_assign_array_", _assign_array_TargetedContentAvailabilityChangedEventArgs, METH_O | METH_STATIC, nullptr },
        { "_from", reinterpret_cast<PyCFunction>(_from_TargetedContentAvailabilityChangedEventArgs), METH_O | METH_STATIC, nullptr },
        { }};

    static PyGetSetDef _getset_TargetedContentAvailabilityChangedEventArgs[] = {
        { }};

    static PyType_Slot _type_slots_TargetedContentAvailabilityChangedEventArgs[] = {
        { Py_tp_new, reinterpret_cast<void*>(_new_TargetedContentAvailabilityChangedEventArgs) },
        { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_TargetedContentAvailabilityChangedEventArgs) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_TargetedContentAvailabilityChangedEventArgs) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_TargetedContentAvailabilityChangedEventArgs) },
        { }};

    static PyType_Spec type_spec_TargetedContentAvailabilityChangedEventArgs = {
        "winrt._winrt_windows_services_targetedcontent.TargetedContentAvailabilityChangedEventArgs",
        sizeof(py::wrapper::Windows::Services::TargetedContent::TargetedContentAvailabilityChangedEventArgs),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_TargetedContentAvailabilityChangedEventArgs};

    // ----- TargetedContentChangedEventArgs class --------------------

    static PyObject* _new_TargetedContentChangedEventArgs(PyTypeObject* /*unused*/, PyObject* /*unused*/, PyObject* /*unused*/) noexcept
    {
        static_assert(py::py_type<winrt::Windows::Services::TargetedContent::TargetedContentChangedEventArgs>::type_name);
        py::set_invalid_activation_error(py::py_type<winrt::Windows::Services::TargetedContent::TargetedContentChangedEventArgs>::type_name);
        return nullptr;
    }

    static void _dealloc_TargetedContentChangedEventArgs(py::wrapper::Windows::Services::TargetedContent::TargetedContentChangedEventArgs* self) noexcept
    {
        auto tp = Py_TYPE(self);
        std::destroy_at(&self->obj);
        tp->tp_free(self);
        Py_DECREF(tp);
    }

    static PyObject* TargetedContentChangedEventArgs_GetDeferral(py::wrapper::Windows::Services::TargetedContent::TargetedContentChangedEventArgs* 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"Windows.Services.TargetedContent.TargetedContentChangedEventArgs", L"GetDeferral", 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.GetDeferral();
                }());
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* TargetedContentChangedEventArgs_get_HasPreviousContentExpired(py::wrapper::Windows::Services::TargetedContent::TargetedContentChangedEventArgs* self, void* /*unused*/) noexcept
    {
        try
        {
            static std::optional<bool> is_property_present{};

            if (!is_property_present.has_value())
            {
                is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Services.TargetedContent.TargetedContentChangedEventArgs", L"HasPreviousContentExpired");
            }

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

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

    static PyObject* _from_TargetedContentChangedEventArgs(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::Services::TargetedContent::TargetedContentChangedEventArgs>());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyMethodDef _methods_TargetedContentChangedEventArgs[] = {
        { "get_deferral", reinterpret_cast<PyCFunction>(TargetedContentChangedEventArgs_GetDeferral), METH_VARARGS, nullptr },
        { "_assign_array_", _assign_array_TargetedContentChangedEventArgs, METH_O | METH_STATIC, nullptr },
        { "_from", reinterpret_cast<PyCFunction>(_from_TargetedContentChangedEventArgs), METH_O | METH_STATIC, nullptr },
        { }};

    static PyGetSetDef _getset_TargetedContentChangedEventArgs[] = {
        { "has_previous_content_expired", reinterpret_cast<getter>(TargetedContentChangedEventArgs_get_HasPreviousContentExpired), nullptr, nullptr, nullptr },
        { }};

    static PyType_Slot _type_slots_TargetedContentChangedEventArgs[] = {
        { Py_tp_new, reinterpret_cast<void*>(_new_TargetedContentChangedEventArgs) },
        { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_TargetedContentChangedEventArgs) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_TargetedContentChangedEventArgs) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_TargetedContentChangedEventArgs) },
        { }};

    static PyType_Spec type_spec_TargetedContentChangedEventArgs = {
        "winrt._winrt_windows_services_targetedcontent.TargetedContentChangedEventArgs",
        sizeof(py::wrapper::Windows::Services::TargetedContent::TargetedContentChangedEventArgs),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_TargetedContentChangedEventArgs};

    // ----- TargetedContentCollection class --------------------

    static PyObject* _new_TargetedContentCollection(PyTypeObject* /*unused*/, PyObject* /*unused*/, PyObject* /*unused*/) noexcept
    {
        static_assert(py::py_type<winrt::Windows::Services::TargetedContent::TargetedContentCollection>::type_name);
        py::set_invalid_activation_error(py::py_type<winrt::Windows::Services::TargetedContent::TargetedContentCollection>::type_name);
        return nullptr;
    }

    static void _dealloc_TargetedContentCollection(py::wrapper::Windows::Services::TargetedContent::TargetedContentCollection* self) noexcept
    {
        auto tp = Py_TYPE(self);
        std::destroy_at(&self->obj);
        tp->tp_free(self);
        Py_DECREF(tp);
    }

    static PyObject* TargetedContentCollection_ReportCustomInteraction(py::wrapper::Windows::Services::TargetedContent::TargetedContentCollection* 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"Windows.Services.TargetedContent.TargetedContentCollection", L"ReportCustomInteraction", 1);
                }

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

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

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

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

    static PyObject* TargetedContentCollection_ReportInteraction(py::wrapper::Windows::Services::TargetedContent::TargetedContentCollection* 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"Windows.Services.TargetedContent.TargetedContentCollection", L"ReportInteraction", 1);
                }

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

                auto param0 = py::convert_to<winrt::Windows::Services::TargetedContent::TargetedContentInteraction>(args, 0);

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

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

    static PyObject* TargetedContentCollection_get_Collections(py::wrapper::Windows::Services::TargetedContent::TargetedContentCollection* self, void* /*unused*/) noexcept
    {
        try
        {
            static std::optional<bool> is_property_present{};

            if (!is_property_present.has_value())
            {
                is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Services.TargetedContent.TargetedContentCollection", L"Collections");
            }

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

    static PyObject* TargetedContentCollection_get_Id(py::wrapper::Windows::Services::TargetedContent::TargetedContentCollection* self, void* /*unused*/) noexcept
    {
        try
        {
            static std::optional<bool> is_property_present{};

            if (!is_property_present.has_value())
            {
                is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Services.TargetedContent.TargetedContentCollection", L"Id");
            }

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

    static PyObject* TargetedContentCollection_get_Items(py::wrapper::Windows::Services::TargetedContent::TargetedContentCollection* self, void* /*unused*/) noexcept
    {
        try
        {
            static std::optional<bool> is_property_present{};

            if (!is_property_present.has_value())
            {
                is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Services.TargetedContent.TargetedContentCollection", L"Items");
            }

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

    static PyObject* TargetedContentCollection_get_Path(py::wrapper::Windows::Services::TargetedContent::TargetedContentCollection* self, void* /*unused*/) noexcept
    {
        try
        {
            static std::optional<bool> is_property_present{};

            if (!is_property_present.has_value())
            {
                is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Services.TargetedContent.TargetedContentCollection", L"Path");
            }

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

    static PyObject* TargetedContentCollection_get_Properties(py::wrapper::Windows::Services::TargetedContent::TargetedContentCollection* self, void* /*unused*/) noexcept
    {
        try
        {
            static std::optional<bool> is_property_present{};

            if (!is_property_present.has_value())
            {
                is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Services.TargetedContent.TargetedContentCollection", L"Properties");
            }

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

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

    static PyObject* _from_TargetedContentCollection(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::Services::TargetedContent::TargetedContentCollection>());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyMethodDef _methods_TargetedContentCollection[] = {
        { "report_custom_interaction", reinterpret_cast<PyCFunction>(TargetedContentCollection_ReportCustomInteraction), METH_VARARGS, nullptr },
        { "report_interaction", reinterpret_cast<PyCFunction>(TargetedContentCollection_ReportInteraction), METH_VARARGS, nullptr },
        { "_assign_array_", _assign_array_TargetedContentCollection, METH_O | METH_STATIC, nullptr },
        { "_from", reinterpret_cast<PyCFunction>(_from_TargetedContentCollection), METH_O | METH_STATIC, nullptr },
        { }};

    static PyGetSetDef _getset_TargetedContentCollection[] = {
        { "collections", reinterpret_cast<getter>(TargetedContentCollection_get_Collections), nullptr, nullptr, nullptr },
        { "id", reinterpret_cast<getter>(TargetedContentCollection_get_Id), nullptr, nullptr, nullptr },
        { "items", reinterpret_cast<getter>(TargetedContentCollection_get_Items), nullptr, nullptr, nullptr },
        { "path", reinterpret_cast<getter>(TargetedContentCollection_get_Path), nullptr, nullptr, nullptr },
        { "properties", reinterpret_cast<getter>(TargetedContentCollection_get_Properties), nullptr, nullptr, nullptr },
        { }};

    static PyType_Slot _type_slots_TargetedContentCollection[] = {
        { Py_tp_new, reinterpret_cast<void*>(_new_TargetedContentCollection) },
        { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_TargetedContentCollection) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_TargetedContentCollection) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_TargetedContentCollection) },
        { }};

    static PyType_Spec type_spec_TargetedContentCollection = {
        "winrt._winrt_windows_services_targetedcontent.TargetedContentCollection",
        sizeof(py::wrapper::Windows::Services::TargetedContent::TargetedContentCollection),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_TargetedContentCollection};

    // ----- TargetedContentContainer class --------------------

    static PyObject* _new_TargetedContentContainer(PyTypeObject* /*unused*/, PyObject* /*unused*/, PyObject* /*unused*/) noexcept
    {
        static_assert(py::py_type<winrt::Windows::Services::TargetedContent::TargetedContentContainer>::type_name);
        py::set_invalid_activation_error(py::py_type<winrt::Windows::Services::TargetedContent::TargetedContentContainer>::type_name);
        return nullptr;
    }

    static void _dealloc_TargetedContentContainer(py::wrapper::Windows::Services::TargetedContent::TargetedContentContainer* self) noexcept
    {
        auto tp = Py_TYPE(self);
        std::destroy_at(&self->obj);
        tp->tp_free(self);
        Py_DECREF(tp);
    }

    static PyObject* TargetedContentContainer_GetAsync(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"Windows.Services.TargetedContent.TargetedContentContainer", L"GetAsync", 1);
                }

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

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

                return py::convert([&]()
                {
                    auto _gil = release_gil();
                    return winrt::Windows::Services::TargetedContent::TargetedContentContainer::GetAsync(param0);
                }());
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* TargetedContentContainer_SelectSingleObject(py::wrapper::Windows::Services::TargetedContent::TargetedContentContainer* 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"Windows.Services.TargetedContent.TargetedContentContainer", L"SelectSingleObject", 1);
                }

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

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

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

    static PyObject* TargetedContentContainer_get_Availability(py::wrapper::Windows::Services::TargetedContent::TargetedContentContainer* self, void* /*unused*/) noexcept
    {
        try
        {
            static std::optional<bool> is_property_present{};

            if (!is_property_present.has_value())
            {
                is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Services.TargetedContent.TargetedContentContainer", L"Availability");
            }

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

    static PyObject* TargetedContentContainer_get_Content(py::wrapper::Windows::Services::TargetedContent::TargetedContentContainer* self, void* /*unused*/) noexcept
    {
        try
        {
            static std::optional<bool> is_property_present{};

            if (!is_property_present.has_value())
            {
                is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Services.TargetedContent.TargetedContentContainer", L"Content");
            }

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

    static PyObject* TargetedContentContainer_get_Id(py::wrapper::Windows::Services::TargetedContent::TargetedContentContainer* self, void* /*unused*/) noexcept
    {
        try
        {
            static std::optional<bool> is_property_present{};

            if (!is_property_present.has_value())
            {
                is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Services.TargetedContent.TargetedContentContainer", L"Id");
            }

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

    static PyObject* TargetedContentContainer_get_Timestamp(py::wrapper::Windows::Services::TargetedContent::TargetedContentContainer* self, void* /*unused*/) noexcept
    {
        try
        {
            static std::optional<bool> is_property_present{};

            if (!is_property_present.has_value())
            {
                is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Services.TargetedContent.TargetedContentContainer", L"Timestamp");
            }

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

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

    static PyObject* _from_TargetedContentContainer(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::Services::TargetedContent::TargetedContentContainer>());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyMethodDef _methods_TargetedContentContainer[] = {
        { "select_single_object", reinterpret_cast<PyCFunction>(TargetedContentContainer_SelectSingleObject), METH_VARARGS, nullptr },
        { "_assign_array_", _assign_array_TargetedContentContainer, METH_O | METH_STATIC, nullptr },
        { "_from", reinterpret_cast<PyCFunction>(_from_TargetedContentContainer), METH_O | METH_STATIC, nullptr },
        { }};

    static PyGetSetDef _getset_TargetedContentContainer[] = {
        { "availability", reinterpret_cast<getter>(TargetedContentContainer_get_Availability), nullptr, nullptr, nullptr },
        { "content", reinterpret_cast<getter>(TargetedContentContainer_get_Content), nullptr, nullptr, nullptr },
        { "id", reinterpret_cast<getter>(TargetedContentContainer_get_Id), nullptr, nullptr, nullptr },
        { "timestamp", reinterpret_cast<getter>(TargetedContentContainer_get_Timestamp), nullptr, nullptr, nullptr },
        { }};

    static PyType_Slot _type_slots_TargetedContentContainer[] = {
        { Py_tp_new, reinterpret_cast<void*>(_new_TargetedContentContainer) },
        { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_TargetedContentContainer) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_TargetedContentContainer) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_TargetedContentContainer) },
        { }};

    static PyType_Spec type_spec_TargetedContentContainer = {
        "winrt._winrt_windows_services_targetedcontent.TargetedContentContainer",
        sizeof(py::wrapper::Windows::Services::TargetedContent::TargetedContentContainer),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_TargetedContentContainer};

    static PyGetSetDef getset_TargetedContentContainer_Static[] = {
        { }};

    static PyMethodDef methods_TargetedContentContainer_Static[] = {
        { "get_async", reinterpret_cast<PyCFunction>(TargetedContentContainer_GetAsync), METH_VARARGS, nullptr },
        { }};

    static PyType_Slot type_slots_TargetedContentContainer_Static[] = 
    {
        { Py_tp_base, reinterpret_cast<void*>(&PyType_Type) },
        { Py_tp_getset, reinterpret_cast<void*>(getset_TargetedContentContainer_Static) },
        { Py_tp_methods, reinterpret_cast<void*>(methods_TargetedContentContainer_Static) },
        { }
    };

    static PyType_Spec type_spec_TargetedContentContainer_Static = {
        "winrt._winrt_windows_services_targetedcontent.TargetedContentContainer_Static",
        static_cast<int>(PyType_Type.tp_basicsize),
        static_cast<int>(PyType_Type.tp_itemsize),
        Py_TPFLAGS_DEFAULT,
        type_slots_TargetedContentContainer_Static};

    // ----- TargetedContentFile class --------------------

    static PyObject* _new_TargetedContentFile(PyTypeObject* /*unused*/, PyObject* /*unused*/, PyObject* /*unused*/) noexcept
    {
        static_assert(py::py_type<winrt::Windows::Services::TargetedContent::TargetedContentFile>::type_name);
        py::set_invalid_activation_error(py::py_type<winrt::Windows::Services::TargetedContent::TargetedContentFile>::type_name);
        return nullptr;
    }

    static void _dealloc_TargetedContentFile(py::wrapper::Windows::Services::TargetedContent::TargetedContentFile* self) noexcept
    {
        auto tp = Py_TYPE(self);
        std::destroy_at(&self->obj);
        tp->tp_free(self);
        Py_DECREF(tp);
    }

    static PyObject* TargetedContentFile_OpenReadAsync(py::wrapper::Windows::Services::TargetedContent::TargetedContentFile* 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"Windows.Services.TargetedContent.TargetedContentFile", L"OpenReadAsync", 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.OpenReadAsync();
                }());
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

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

    static PyObject* _from_TargetedContentFile(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::Services::TargetedContent::TargetedContentFile>());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyMethodDef _methods_TargetedContentFile[] = {
        { "open_read_async", reinterpret_cast<PyCFunction>(TargetedContentFile_OpenReadAsync), METH_VARARGS, nullptr },
        { "_assign_array_", _assign_array_TargetedContentFile, METH_O | METH_STATIC, nullptr },
        { "_from", reinterpret_cast<PyCFunction>(_from_TargetedContentFile), METH_O | METH_STATIC, nullptr },
        { }};

    static PyGetSetDef _getset_TargetedContentFile[] = {
        { }};

    static PyType_Slot _type_slots_TargetedContentFile[] = {
        { Py_tp_new, reinterpret_cast<void*>(_new_TargetedContentFile) },
        { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_TargetedContentFile) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_TargetedContentFile) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_TargetedContentFile) },
        { }};

    static PyType_Spec type_spec_TargetedContentFile = {
        "winrt._winrt_windows_services_targetedcontent.TargetedContentFile",
        sizeof(py::wrapper::Windows::Services::TargetedContent::TargetedContentFile),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_TargetedContentFile};

    // ----- TargetedContentImage class --------------------

    static PyObject* _new_TargetedContentImage(PyTypeObject* /*unused*/, PyObject* /*unused*/, PyObject* /*unused*/) noexcept
    {
        static_assert(py::py_type<winrt::Windows::Services::TargetedContent::TargetedContentImage>::type_name);
        py::set_invalid_activation_error(py::py_type<winrt::Windows::Services::TargetedContent::TargetedContentImage>::type_name);
        return nullptr;
    }

    static void _dealloc_TargetedContentImage(py::wrapper::Windows::Services::TargetedContent::TargetedContentImage* self) noexcept
    {
        auto tp = Py_TYPE(self);
        std::destroy_at(&self->obj);
        tp->tp_free(self);
        Py_DECREF(tp);
    }

    static PyObject* TargetedContentImage_OpenReadAsync(py::wrapper::Windows::Services::TargetedContent::TargetedContentImage* 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"Windows.Services.TargetedContent.TargetedContentImage", L"OpenReadAsync", 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.OpenReadAsync();
                }());
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* TargetedContentImage_get_Height(py::wrapper::Windows::Services::TargetedContent::TargetedContentImage* self, void* /*unused*/) noexcept
    {
        try
        {
            static std::optional<bool> is_property_present{};

            if (!is_property_present.has_value())
            {
                is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Services.TargetedContent.TargetedContentImage", L"Height");
            }

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

    static PyObject* TargetedContentImage_get_Width(py::wrapper::Windows::Services::TargetedContent::TargetedContentImage* self, void* /*unused*/) noexcept
    {
        try
        {
            static std::optional<bool> is_property_present{};

            if (!is_property_present.has_value())
            {
                is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Services.TargetedContent.TargetedContentImage", L"Width");
            }

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

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

    static PyObject* _from_TargetedContentImage(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::Services::TargetedContent::TargetedContentImage>());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyMethodDef _methods_TargetedContentImage[] = {
        { "open_read_async", reinterpret_cast<PyCFunction>(TargetedContentImage_OpenReadAsync), METH_VARARGS, nullptr },
        { "_assign_array_", _assign_array_TargetedContentImage, METH_O | METH_STATIC, nullptr },
        { "_from", reinterpret_cast<PyCFunction>(_from_TargetedContentImage), METH_O | METH_STATIC, nullptr },
        { }};

    static PyGetSetDef _getset_TargetedContentImage[] = {
        { "height", reinterpret_cast<getter>(TargetedContentImage_get_Height), nullptr, nullptr, nullptr },
        { "width", reinterpret_cast<getter>(TargetedContentImage_get_Width), nullptr, nullptr, nullptr },
        { }};

    static PyType_Slot _type_slots_TargetedContentImage[] = {
        { Py_tp_new, reinterpret_cast<void*>(_new_TargetedContentImage) },
        { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_TargetedContentImage) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_TargetedContentImage) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_TargetedContentImage) },
        { }};

    static PyType_Spec type_spec_TargetedContentImage = {
        "winrt._winrt_windows_services_targetedcontent.TargetedContentImage",
        sizeof(py::wrapper::Windows::Services::TargetedContent::TargetedContentImage),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_TargetedContentImage};

    // ----- TargetedContentItem class --------------------

    static PyObject* _new_TargetedContentItem(PyTypeObject* /*unused*/, PyObject* /*unused*/, PyObject* /*unused*/) noexcept
    {
        static_assert(py::py_type<winrt::Windows::Services::TargetedContent::TargetedContentItem>::type_name);
        py::set_invalid_activation_error(py::py_type<winrt::Windows::Services::TargetedContent::TargetedContentItem>::type_name);
        return nullptr;
    }

    static void _dealloc_TargetedContentItem(py::wrapper::Windows::Services::TargetedContent::TargetedContentItem* self) noexcept
    {
        auto tp = Py_TYPE(self);
        std::destroy_at(&self->obj);
        tp->tp_free(self);
        Py_DECREF(tp);
    }

    static PyObject* TargetedContentItem_ReportCustomInteraction(py::wrapper::Windows::Services::TargetedContent::TargetedContentItem* 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"Windows.Services.TargetedContent.TargetedContentItem", L"ReportCustomInteraction", 1);
                }

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

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

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

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

    static PyObject* TargetedContentItem_ReportInteraction(py::wrapper::Windows::Services::TargetedContent::TargetedContentItem* 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"Windows.Services.TargetedContent.TargetedContentItem", L"ReportInteraction", 1);
                }

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

                auto param0 = py::convert_to<winrt::Windows::Services::TargetedContent::TargetedContentInteraction>(args, 0);

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

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

    static PyObject* TargetedContentItem_get_Collections(py::wrapper::Windows::Services::TargetedContent::TargetedContentItem* self, void* /*unused*/) noexcept
    {
        try
        {
            static std::optional<bool> is_property_present{};

            if (!is_property_present.has_value())
            {
                is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Services.TargetedContent.TargetedContentItem", L"Collections");
            }

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

    static PyObject* TargetedContentItem_get_Path(py::wrapper::Windows::Services::TargetedContent::TargetedContentItem* self, void* /*unused*/) noexcept
    {
        try
        {
            static std::optional<bool> is_property_present{};

            if (!is_property_present.has_value())
            {
                is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Services.TargetedContent.TargetedContentItem", L"Path");
            }

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

    static PyObject* TargetedContentItem_get_Properties(py::wrapper::Windows::Services::TargetedContent::TargetedContentItem* self, void* /*unused*/) noexcept
    {
        try
        {
            static std::optional<bool> is_property_present{};

            if (!is_property_present.has_value())
            {
                is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Services.TargetedContent.TargetedContentItem", L"Properties");
            }

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

    static PyObject* TargetedContentItem_get_State(py::wrapper::Windows::Services::TargetedContent::TargetedContentItem* self, void* /*unused*/) noexcept
    {
        try
        {
            static std::optional<bool> is_property_present{};

            if (!is_property_present.has_value())
            {
                is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Services.TargetedContent.TargetedContentItem", L"State");
            }

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

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

    static PyObject* _from_TargetedContentItem(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::Services::TargetedContent::TargetedContentItem>());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyMethodDef _methods_TargetedContentItem[] = {
        { "report_custom_interaction", reinterpret_cast<PyCFunction>(TargetedContentItem_ReportCustomInteraction), METH_VARARGS, nullptr },
        { "report_interaction", reinterpret_cast<PyCFunction>(TargetedContentItem_ReportInteraction), METH_VARARGS, nullptr },
        { "_assign_array_", _assign_array_TargetedContentItem, METH_O | METH_STATIC, nullptr },
        { "_from", reinterpret_cast<PyCFunction>(_from_TargetedContentItem), METH_O | METH_STATIC, nullptr },
        { }};

    static PyGetSetDef _getset_TargetedContentItem[] = {
        { "collections", reinterpret_cast<getter>(TargetedContentItem_get_Collections), nullptr, nullptr, nullptr },
        { "path", reinterpret_cast<getter>(TargetedContentItem_get_Path), nullptr, nullptr, nullptr },
        { "properties", reinterpret_cast<getter>(TargetedContentItem_get_Properties), nullptr, nullptr, nullptr },
        { "state", reinterpret_cast<getter>(TargetedContentItem_get_State), nullptr, nullptr, nullptr },
        { }};

    static PyType_Slot _type_slots_TargetedContentItem[] = {
        { Py_tp_new, reinterpret_cast<void*>(_new_TargetedContentItem) },
        { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_TargetedContentItem) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_TargetedContentItem) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_TargetedContentItem) },
        { }};

    static PyType_Spec type_spec_TargetedContentItem = {
        "winrt._winrt_windows_services_targetedcontent.TargetedContentItem",
        sizeof(py::wrapper::Windows::Services::TargetedContent::TargetedContentItem),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_TargetedContentItem};

    // ----- TargetedContentItemState class --------------------

    static PyObject* _new_TargetedContentItemState(PyTypeObject* /*unused*/, PyObject* /*unused*/, PyObject* /*unused*/) noexcept
    {
        static_assert(py::py_type<winrt::Windows::Services::TargetedContent::TargetedContentItemState>::type_name);
        py::set_invalid_activation_error(py::py_type<winrt::Windows::Services::TargetedContent::TargetedContentItemState>::type_name);
        return nullptr;
    }

    static void _dealloc_TargetedContentItemState(py::wrapper::Windows::Services::TargetedContent::TargetedContentItemState* self) noexcept
    {
        auto tp = Py_TYPE(self);
        std::destroy_at(&self->obj);
        tp->tp_free(self);
        Py_DECREF(tp);
    }

    static PyObject* TargetedContentItemState_get_AppInstallationState(py::wrapper::Windows::Services::TargetedContent::TargetedContentItemState* self, void* /*unused*/) noexcept
    {
        try
        {
            static std::optional<bool> is_property_present{};

            if (!is_property_present.has_value())
            {
                is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Services.TargetedContent.TargetedContentItemState", L"AppInstallationState");
            }

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

    static PyObject* TargetedContentItemState_get_ShouldDisplay(py::wrapper::Windows::Services::TargetedContent::TargetedContentItemState* self, void* /*unused*/) noexcept
    {
        try
        {
            static std::optional<bool> is_property_present{};

            if (!is_property_present.has_value())
            {
                is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Services.TargetedContent.TargetedContentItemState", L"ShouldDisplay");
            }

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

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

    static PyObject* _from_TargetedContentItemState(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::Services::TargetedContent::TargetedContentItemState>());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyMethodDef _methods_TargetedContentItemState[] = {
        { "_assign_array_", _assign_array_TargetedContentItemState, METH_O | METH_STATIC, nullptr },
        { "_from", reinterpret_cast<PyCFunction>(_from_TargetedContentItemState), METH_O | METH_STATIC, nullptr },
        { }};

    static PyGetSetDef _getset_TargetedContentItemState[] = {
        { "app_installation_state", reinterpret_cast<getter>(TargetedContentItemState_get_AppInstallationState), nullptr, nullptr, nullptr },
        { "should_display", reinterpret_cast<getter>(TargetedContentItemState_get_ShouldDisplay), nullptr, nullptr, nullptr },
        { }};

    static PyType_Slot _type_slots_TargetedContentItemState[] = {
        { Py_tp_new, reinterpret_cast<void*>(_new_TargetedContentItemState) },
        { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_TargetedContentItemState) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_TargetedContentItemState) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_TargetedContentItemState) },
        { }};

    static PyType_Spec type_spec_TargetedContentItemState = {
        "winrt._winrt_windows_services_targetedcontent.TargetedContentItemState",
        sizeof(py::wrapper::Windows::Services::TargetedContent::TargetedContentItemState),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_TargetedContentItemState};

    // ----- TargetedContentObject class --------------------

    static PyObject* _new_TargetedContentObject(PyTypeObject* /*unused*/, PyObject* /*unused*/, PyObject* /*unused*/) noexcept
    {
        static_assert(py::py_type<winrt::Windows::Services::TargetedContent::TargetedContentObject>::type_name);
        py::set_invalid_activation_error(py::py_type<winrt::Windows::Services::TargetedContent::TargetedContentObject>::type_name);
        return nullptr;
    }

    static void _dealloc_TargetedContentObject(py::wrapper::Windows::Services::TargetedContent::TargetedContentObject* self) noexcept
    {
        auto tp = Py_TYPE(self);
        std::destroy_at(&self->obj);
        tp->tp_free(self);
        Py_DECREF(tp);
    }

    static PyObject* TargetedContentObject_get_Collection(py::wrapper::Windows::Services::TargetedContent::TargetedContentObject* self, void* /*unused*/) noexcept
    {
        try
        {
            static std::optional<bool> is_property_present{};

            if (!is_property_present.has_value())
            {
                is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Services.TargetedContent.TargetedContentObject", L"Collection");
            }

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

    static PyObject* TargetedContentObject_get_Item(py::wrapper::Windows::Services::TargetedContent::TargetedContentObject* self, void* /*unused*/) noexcept
    {
        try
        {
            static std::optional<bool> is_property_present{};

            if (!is_property_present.has_value())
            {
                is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Services.TargetedContent.TargetedContentObject", L"Item");
            }

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

    static PyObject* TargetedContentObject_get_ObjectKind(py::wrapper::Windows::Services::TargetedContent::TargetedContentObject* self, void* /*unused*/) noexcept
    {
        try
        {
            static std::optional<bool> is_property_present{};

            if (!is_property_present.has_value())
            {
                is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Services.TargetedContent.TargetedContentObject", L"ObjectKind");
            }

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

    static PyObject* TargetedContentObject_get_Value(py::wrapper::Windows::Services::TargetedContent::TargetedContentObject* self, void* /*unused*/) noexcept
    {
        try
        {
            static std::optional<bool> is_property_present{};

            if (!is_property_present.has_value())
            {
                is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Services.TargetedContent.TargetedContentObject", L"Value");
            }

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

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

    static PyObject* _from_TargetedContentObject(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::Services::TargetedContent::TargetedContentObject>());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyMethodDef _methods_TargetedContentObject[] = {
        { "_assign_array_", _assign_array_TargetedContentObject, METH_O | METH_STATIC, nullptr },
        { "_from", reinterpret_cast<PyCFunction>(_from_TargetedContentObject), METH_O | METH_STATIC, nullptr },
        { }};

    static PyGetSetDef _getset_TargetedContentObject[] = {
        { "collection", reinterpret_cast<getter>(TargetedContentObject_get_Collection), nullptr, nullptr, nullptr },
        { "item", reinterpret_cast<getter>(TargetedContentObject_get_Item), nullptr, nullptr, nullptr },
        { "object_kind", reinterpret_cast<getter>(TargetedContentObject_get_ObjectKind), nullptr, nullptr, nullptr },
        { "value", reinterpret_cast<getter>(TargetedContentObject_get_Value), nullptr, nullptr, nullptr },
        { }};

    static PyType_Slot _type_slots_TargetedContentObject[] = {
        { Py_tp_new, reinterpret_cast<void*>(_new_TargetedContentObject) },
        { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_TargetedContentObject) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_TargetedContentObject) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_TargetedContentObject) },
        { }};

    static PyType_Spec type_spec_TargetedContentObject = {
        "winrt._winrt_windows_services_targetedcontent.TargetedContentObject",
        sizeof(py::wrapper::Windows::Services::TargetedContent::TargetedContentObject),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_TargetedContentObject};

    // ----- TargetedContentStateChangedEventArgs class --------------------

    static PyObject* _new_TargetedContentStateChangedEventArgs(PyTypeObject* /*unused*/, PyObject* /*unused*/, PyObject* /*unused*/) noexcept
    {
        static_assert(py::py_type<winrt::Windows::Services::TargetedContent::TargetedContentStateChangedEventArgs>::type_name);
        py::set_invalid_activation_error(py::py_type<winrt::Windows::Services::TargetedContent::TargetedContentStateChangedEventArgs>::type_name);
        return nullptr;
    }

    static void _dealloc_TargetedContentStateChangedEventArgs(py::wrapper::Windows::Services::TargetedContent::TargetedContentStateChangedEventArgs* self) noexcept
    {
        auto tp = Py_TYPE(self);
        std::destroy_at(&self->obj);
        tp->tp_free(self);
        Py_DECREF(tp);
    }

    static PyObject* TargetedContentStateChangedEventArgs_GetDeferral(py::wrapper::Windows::Services::TargetedContent::TargetedContentStateChangedEventArgs* 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"Windows.Services.TargetedContent.TargetedContentStateChangedEventArgs", L"GetDeferral", 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.GetDeferral();
                }());
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

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

    static PyObject* _from_TargetedContentStateChangedEventArgs(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::Services::TargetedContent::TargetedContentStateChangedEventArgs>());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyMethodDef _methods_TargetedContentStateChangedEventArgs[] = {
        { "get_deferral", reinterpret_cast<PyCFunction>(TargetedContentStateChangedEventArgs_GetDeferral), METH_VARARGS, nullptr },
        { "_assign_array_", _assign_array_TargetedContentStateChangedEventArgs, METH_O | METH_STATIC, nullptr },
        { "_from", reinterpret_cast<PyCFunction>(_from_TargetedContentStateChangedEventArgs), METH_O | METH_STATIC, nullptr },
        { }};

    static PyGetSetDef _getset_TargetedContentStateChangedEventArgs[] = {
        { }};

    static PyType_Slot _type_slots_TargetedContentStateChangedEventArgs[] = {
        { Py_tp_new, reinterpret_cast<void*>(_new_TargetedContentStateChangedEventArgs) },
        { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_TargetedContentStateChangedEventArgs) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_TargetedContentStateChangedEventArgs) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_TargetedContentStateChangedEventArgs) },
        { }};

    static PyType_Spec type_spec_TargetedContentStateChangedEventArgs = {
        "winrt._winrt_windows_services_targetedcontent.TargetedContentStateChangedEventArgs",
        sizeof(py::wrapper::Windows::Services::TargetedContent::TargetedContentStateChangedEventArgs),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_TargetedContentStateChangedEventArgs};

    // ----- TargetedContentSubscription class --------------------

    static PyObject* _new_TargetedContentSubscription(PyTypeObject* /*unused*/, PyObject* /*unused*/, PyObject* /*unused*/) noexcept
    {
        static_assert(py::py_type<winrt::Windows::Services::TargetedContent::TargetedContentSubscription>::type_name);
        py::set_invalid_activation_error(py::py_type<winrt::Windows::Services::TargetedContent::TargetedContentSubscription>::type_name);
        return nullptr;
    }

    static void _dealloc_TargetedContentSubscription(py::wrapper::Windows::Services::TargetedContent::TargetedContentSubscription* self) noexcept
    {
        auto tp = Py_TYPE(self);
        std::destroy_at(&self->obj);
        tp->tp_free(self);
        Py_DECREF(tp);
    }

    static PyObject* TargetedContentSubscription_GetAsync(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"Windows.Services.TargetedContent.TargetedContentSubscription", L"GetAsync", 1);
                }

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

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

                return py::convert([&]()
                {
                    auto _gil = release_gil();
                    return winrt::Windows::Services::TargetedContent::TargetedContentSubscription::GetAsync(param0);
                }());
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* TargetedContentSubscription_GetContentContainerAsync(py::wrapper::Windows::Services::TargetedContent::TargetedContentSubscription* 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"Windows.Services.TargetedContent.TargetedContentSubscription", L"GetContentContainerAsync", 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.GetContentContainerAsync();
                }());
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* TargetedContentSubscription_GetOptions(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"Windows.Services.TargetedContent.TargetedContentSubscription", L"GetOptions", 1);
                }

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

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

                return py::convert([&]()
                {
                    auto _gil = release_gil();
                    return winrt::Windows::Services::TargetedContent::TargetedContentSubscription::GetOptions(param0);
                }());
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* TargetedContentSubscription_get_Id(py::wrapper::Windows::Services::TargetedContent::TargetedContentSubscription* self, void* /*unused*/) noexcept
    {
        try
        {
            static std::optional<bool> is_property_present{};

            if (!is_property_present.has_value())
            {
                is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Services.TargetedContent.TargetedContentSubscription", L"Id");
            }

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

    static PyObject* TargetedContentSubscription_add_AvailabilityChanged(py::wrapper::Windows::Services::TargetedContent::TargetedContentSubscription* 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"Windows.Services.TargetedContent.TargetedContentSubscription", L"AvailabilityChanged");
            }

            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::Windows::Services::TargetedContent::TargetedContentSubscription, winrt::Windows::Services::TargetedContent::TargetedContentAvailabilityChangedEventArgs>>(arg);

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

    static PyObject* TargetedContentSubscription_remove_AvailabilityChanged(py::wrapper::Windows::Services::TargetedContent::TargetedContentSubscription* 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"Windows.Services.TargetedContent.TargetedContentSubscription", L"AvailabilityChanged");
            }

            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.AvailabilityChanged(param0);
            }

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

    static PyObject* TargetedContentSubscription_add_ContentChanged(py::wrapper::Windows::Services::TargetedContent::TargetedContentSubscription* 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"Windows.Services.TargetedContent.TargetedContentSubscription", L"ContentChanged");
            }

            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::Windows::Services::TargetedContent::TargetedContentSubscription, winrt::Windows::Services::TargetedContent::TargetedContentChangedEventArgs>>(arg);

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

    static PyObject* TargetedContentSubscription_remove_ContentChanged(py::wrapper::Windows::Services::TargetedContent::TargetedContentSubscription* 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"Windows.Services.TargetedContent.TargetedContentSubscription", L"ContentChanged");
            }

            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.ContentChanged(param0);
            }

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

    static PyObject* TargetedContentSubscription_add_StateChanged(py::wrapper::Windows::Services::TargetedContent::TargetedContentSubscription* 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"Windows.Services.TargetedContent.TargetedContentSubscription", L"StateChanged");
            }

            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::Windows::Services::TargetedContent::TargetedContentSubscription, winrt::Windows::Services::TargetedContent::TargetedContentStateChangedEventArgs>>(arg);

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

    static PyObject* TargetedContentSubscription_remove_StateChanged(py::wrapper::Windows::Services::TargetedContent::TargetedContentSubscription* 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"Windows.Services.TargetedContent.TargetedContentSubscription", L"StateChanged");
            }

            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.StateChanged(param0);
            }

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

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

    static PyObject* _from_TargetedContentSubscription(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::Services::TargetedContent::TargetedContentSubscription>());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyMethodDef _methods_TargetedContentSubscription[] = {
        { "get_content_container_async", reinterpret_cast<PyCFunction>(TargetedContentSubscription_GetContentContainerAsync), METH_VARARGS, nullptr },
        { "add_availability_changed", reinterpret_cast<PyCFunction>(TargetedContentSubscription_add_AvailabilityChanged), METH_O, nullptr },
        { "remove_availability_changed", reinterpret_cast<PyCFunction>(TargetedContentSubscription_remove_AvailabilityChanged), METH_O, nullptr },
        { "add_content_changed", reinterpret_cast<PyCFunction>(TargetedContentSubscription_add_ContentChanged), METH_O, nullptr },
        { "remove_content_changed", reinterpret_cast<PyCFunction>(TargetedContentSubscription_remove_ContentChanged), METH_O, nullptr },
        { "add_state_changed", reinterpret_cast<PyCFunction>(TargetedContentSubscription_add_StateChanged), METH_O, nullptr },
        { "remove_state_changed", reinterpret_cast<PyCFunction>(TargetedContentSubscription_remove_StateChanged), METH_O, nullptr },
        { "_assign_array_", _assign_array_TargetedContentSubscription, METH_O | METH_STATIC, nullptr },
        { "_from", reinterpret_cast<PyCFunction>(_from_TargetedContentSubscription), METH_O | METH_STATIC, nullptr },
        { }};

    static PyGetSetDef _getset_TargetedContentSubscription[] = {
        { "id", reinterpret_cast<getter>(TargetedContentSubscription_get_Id), nullptr, nullptr, nullptr },
        { }};

    static PyType_Slot _type_slots_TargetedContentSubscription[] = {
        { Py_tp_new, reinterpret_cast<void*>(_new_TargetedContentSubscription) },
        { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_TargetedContentSubscription) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_TargetedContentSubscription) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_TargetedContentSubscription) },
        { }};

    static PyType_Spec type_spec_TargetedContentSubscription = {
        "winrt._winrt_windows_services_targetedcontent.TargetedContentSubscription",
        sizeof(py::wrapper::Windows::Services::TargetedContent::TargetedContentSubscription),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_TargetedContentSubscription};

    static PyGetSetDef getset_TargetedContentSubscription_Static[] = {
        { }};

    static PyMethodDef methods_TargetedContentSubscription_Static[] = {
        { "get_async", reinterpret_cast<PyCFunction>(TargetedContentSubscription_GetAsync), METH_VARARGS, nullptr },
        { "get_options", reinterpret_cast<PyCFunction>(TargetedContentSubscription_GetOptions), METH_VARARGS, nullptr },
        { }};

    static PyType_Slot type_slots_TargetedContentSubscription_Static[] = 
    {
        { Py_tp_base, reinterpret_cast<void*>(&PyType_Type) },
        { Py_tp_getset, reinterpret_cast<void*>(getset_TargetedContentSubscription_Static) },
        { Py_tp_methods, reinterpret_cast<void*>(methods_TargetedContentSubscription_Static) },
        { }
    };

    static PyType_Spec type_spec_TargetedContentSubscription_Static = {
        "winrt._winrt_windows_services_targetedcontent.TargetedContentSubscription_Static",
        static_cast<int>(PyType_Type.tp_basicsize),
        static_cast<int>(PyType_Type.tp_itemsize),
        Py_TPFLAGS_DEFAULT,
        type_slots_TargetedContentSubscription_Static};

    // ----- TargetedContentSubscriptionOptions class --------------------

    static PyObject* _new_TargetedContentSubscriptionOptions(PyTypeObject* /*unused*/, PyObject* /*unused*/, PyObject* /*unused*/) noexcept
    {
        static_assert(py::py_type<winrt::Windows::Services::TargetedContent::TargetedContentSubscriptionOptions>::type_name);
        py::set_invalid_activation_error(py::py_type<winrt::Windows::Services::TargetedContent::TargetedContentSubscriptionOptions>::type_name);
        return nullptr;
    }

    static void _dealloc_TargetedContentSubscriptionOptions(py::wrapper::Windows::Services::TargetedContent::TargetedContentSubscriptionOptions* self) noexcept
    {
        auto tp = Py_TYPE(self);
        std::destroy_at(&self->obj);
        tp->tp_free(self);
        Py_DECREF(tp);
    }

    static PyObject* TargetedContentSubscriptionOptions_Update(py::wrapper::Windows::Services::TargetedContent::TargetedContentSubscriptionOptions* 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"Windows.Services.TargetedContent.TargetedContentSubscriptionOptions", L"Update", 0);
                }

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

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

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

    static PyObject* TargetedContentSubscriptionOptions_get_AllowPartialContentAvailability(py::wrapper::Windows::Services::TargetedContent::TargetedContentSubscriptionOptions* self, void* /*unused*/) noexcept
    {
        try
        {
            static std::optional<bool> is_property_present{};

            if (!is_property_present.has_value())
            {
                is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Services.TargetedContent.TargetedContentSubscriptionOptions", L"AllowPartialContentAvailability");
            }

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

    static int TargetedContentSubscriptionOptions_put_AllowPartialContentAvailability(py::wrapper::Windows::Services::TargetedContent::TargetedContentSubscriptionOptions* self, PyObject* arg, void* /*unused*/) noexcept
    {
        if (!arg)
        {
            PyErr_SetString(PyExc_AttributeError, "can't delete attribute");
            return -1;
        }

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

            if (!is_property_present.has_value())
            {
                is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Services.TargetedContent.TargetedContentSubscriptionOptions", L"AllowPartialContentAvailability");
            }

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

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

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

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

    static PyObject* TargetedContentSubscriptionOptions_get_CloudQueryParameters(py::wrapper::Windows::Services::TargetedContent::TargetedContentSubscriptionOptions* self, void* /*unused*/) noexcept
    {
        try
        {
            static std::optional<bool> is_property_present{};

            if (!is_property_present.has_value())
            {
                is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Services.TargetedContent.TargetedContentSubscriptionOptions", L"CloudQueryParameters");
            }

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

    static PyObject* TargetedContentSubscriptionOptions_get_LocalFilters(py::wrapper::Windows::Services::TargetedContent::TargetedContentSubscriptionOptions* self, void* /*unused*/) noexcept
    {
        try
        {
            static std::optional<bool> is_property_present{};

            if (!is_property_present.has_value())
            {
                is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Services.TargetedContent.TargetedContentSubscriptionOptions", L"LocalFilters");
            }

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

    static PyObject* TargetedContentSubscriptionOptions_get_SubscriptionId(py::wrapper::Windows::Services::TargetedContent::TargetedContentSubscriptionOptions* self, void* /*unused*/) noexcept
    {
        try
        {
            static std::optional<bool> is_property_present{};

            if (!is_property_present.has_value())
            {
                is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Services.TargetedContent.TargetedContentSubscriptionOptions", L"SubscriptionId");
            }

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

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

    static PyObject* _from_TargetedContentSubscriptionOptions(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::Services::TargetedContent::TargetedContentSubscriptionOptions>());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyMethodDef _methods_TargetedContentSubscriptionOptions[] = {
        { "update", reinterpret_cast<PyCFunction>(TargetedContentSubscriptionOptions_Update), METH_VARARGS, nullptr },
        { "_assign_array_", _assign_array_TargetedContentSubscriptionOptions, METH_O | METH_STATIC, nullptr },
        { "_from", reinterpret_cast<PyCFunction>(_from_TargetedContentSubscriptionOptions), METH_O | METH_STATIC, nullptr },
        { }};

    static PyGetSetDef _getset_TargetedContentSubscriptionOptions[] = {
        { "allow_partial_content_availability", reinterpret_cast<getter>(TargetedContentSubscriptionOptions_get_AllowPartialContentAvailability), reinterpret_cast<setter>(TargetedContentSubscriptionOptions_put_AllowPartialContentAvailability), nullptr, nullptr },
        { "cloud_query_parameters", reinterpret_cast<getter>(TargetedContentSubscriptionOptions_get_CloudQueryParameters), nullptr, nullptr, nullptr },
        { "local_filters", reinterpret_cast<getter>(TargetedContentSubscriptionOptions_get_LocalFilters), nullptr, nullptr, nullptr },
        { "subscription_id", reinterpret_cast<getter>(TargetedContentSubscriptionOptions_get_SubscriptionId), nullptr, nullptr, nullptr },
        { }};

    static PyType_Slot _type_slots_TargetedContentSubscriptionOptions[] = {
        { Py_tp_new, reinterpret_cast<void*>(_new_TargetedContentSubscriptionOptions) },
        { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_TargetedContentSubscriptionOptions) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_TargetedContentSubscriptionOptions) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_TargetedContentSubscriptionOptions) },
        { }};

    static PyType_Spec type_spec_TargetedContentSubscriptionOptions = {
        "winrt._winrt_windows_services_targetedcontent.TargetedContentSubscriptionOptions",
        sizeof(py::wrapper::Windows::Services::TargetedContent::TargetedContentSubscriptionOptions),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_TargetedContentSubscriptionOptions};

    // ----- TargetedContentValue class --------------------

    static PyObject* _new_TargetedContentValue(PyTypeObject* /*unused*/, PyObject* /*unused*/, PyObject* /*unused*/) noexcept
    {
        static_assert(py::py_type<winrt::Windows::Services::TargetedContent::TargetedContentValue>::type_name);
        py::set_invalid_activation_error(py::py_type<winrt::Windows::Services::TargetedContent::TargetedContentValue>::type_name);
        return nullptr;
    }

    static void _dealloc_TargetedContentValue(py::wrapper::Windows::Services::TargetedContent::TargetedContentValue* self) noexcept
    {
        auto tp = Py_TYPE(self);
        std::destroy_at(&self->obj);
        tp->tp_free(self);
        Py_DECREF(tp);
    }

    static PyObject* TargetedContentValue_get_Action(py::wrapper::Windows::Services::TargetedContent::TargetedContentValue* self, void* /*unused*/) noexcept
    {
        try
        {
            static std::optional<bool> is_property_present{};

            if (!is_property_present.has_value())
            {
                is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Services.TargetedContent.TargetedContentValue", L"Action");
            }

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

    static PyObject* TargetedContentValue_get_Actions(py::wrapper::Windows::Services::TargetedContent::TargetedContentValue* self, void* /*unused*/) noexcept
    {
        try
        {
            static std::optional<bool> is_property_present{};

            if (!is_property_present.has_value())
            {
                is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Services.TargetedContent.TargetedContentValue", L"Actions");
            }

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

    static PyObject* TargetedContentValue_get_Boolean(py::wrapper::Windows::Services::TargetedContent::TargetedContentValue* self, void* /*unused*/) noexcept
    {
        try
        {
            static std::optional<bool> is_property_present{};

            if (!is_property_present.has_value())
            {
                is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Services.TargetedContent.TargetedContentValue", L"Boolean");
            }

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

    static PyObject* TargetedContentValue_get_Booleans(py::wrapper::Windows::Services::TargetedContent::TargetedContentValue* self, void* /*unused*/) noexcept
    {
        try
        {
            static std::optional<bool> is_property_present{};

            if (!is_property_present.has_value())
            {
                is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Services.TargetedContent.TargetedContentValue", L"Booleans");
            }

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

    static PyObject* TargetedContentValue_get_File(py::wrapper::Windows::Services::TargetedContent::TargetedContentValue* self, void* /*unused*/) noexcept
    {
        try
        {
            static std::optional<bool> is_property_present{};

            if (!is_property_present.has_value())
            {
                is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Services.TargetedContent.TargetedContentValue", L"File");
            }

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

    static PyObject* TargetedContentValue_get_Files(py::wrapper::Windows::Services::TargetedContent::TargetedContentValue* self, void* /*unused*/) noexcept
    {
        try
        {
            static std::optional<bool> is_property_present{};

            if (!is_property_present.has_value())
            {
                is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Services.TargetedContent.TargetedContentValue", L"Files");
            }

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

    static PyObject* TargetedContentValue_get_ImageFile(py::wrapper::Windows::Services::TargetedContent::TargetedContentValue* self, void* /*unused*/) noexcept
    {
        try
        {
            static std::optional<bool> is_property_present{};

            if (!is_property_present.has_value())
            {
                is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Services.TargetedContent.TargetedContentValue", L"ImageFile");
            }

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

    static PyObject* TargetedContentValue_get_ImageFiles(py::wrapper::Windows::Services::TargetedContent::TargetedContentValue* self, void* /*unused*/) noexcept
    {
        try
        {
            static std::optional<bool> is_property_present{};

            if (!is_property_present.has_value())
            {
                is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Services.TargetedContent.TargetedContentValue", L"ImageFiles");
            }

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

    static PyObject* TargetedContentValue_get_Number(py::wrapper::Windows::Services::TargetedContent::TargetedContentValue* self, void* /*unused*/) noexcept
    {
        try
        {
            static std::optional<bool> is_property_present{};

            if (!is_property_present.has_value())
            {
                is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Services.TargetedContent.TargetedContentValue", L"Number");
            }

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

    static PyObject* TargetedContentValue_get_Numbers(py::wrapper::Windows::Services::TargetedContent::TargetedContentValue* self, void* /*unused*/) noexcept
    {
        try
        {
            static std::optional<bool> is_property_present{};

            if (!is_property_present.has_value())
            {
                is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Services.TargetedContent.TargetedContentValue", L"Numbers");
            }

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

    static PyObject* TargetedContentValue_get_Path(py::wrapper::Windows::Services::TargetedContent::TargetedContentValue* self, void* /*unused*/) noexcept
    {
        try
        {
            static std::optional<bool> is_property_present{};

            if (!is_property_present.has_value())
            {
                is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Services.TargetedContent.TargetedContentValue", L"Path");
            }

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

    static PyObject* TargetedContentValue_get_String(py::wrapper::Windows::Services::TargetedContent::TargetedContentValue* self, void* /*unused*/) noexcept
    {
        try
        {
            static std::optional<bool> is_property_present{};

            if (!is_property_present.has_value())
            {
                is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Services.TargetedContent.TargetedContentValue", L"String");
            }

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

    static PyObject* TargetedContentValue_get_Strings(py::wrapper::Windows::Services::TargetedContent::TargetedContentValue* self, void* /*unused*/) noexcept
    {
        try
        {
            static std::optional<bool> is_property_present{};

            if (!is_property_present.has_value())
            {
                is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Services.TargetedContent.TargetedContentValue", L"Strings");
            }

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

    static PyObject* TargetedContentValue_get_Uri(py::wrapper::Windows::Services::TargetedContent::TargetedContentValue* self, void* /*unused*/) noexcept
    {
        try
        {
            static std::optional<bool> is_property_present{};

            if (!is_property_present.has_value())
            {
                is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Services.TargetedContent.TargetedContentValue", L"Uri");
            }

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

    static PyObject* TargetedContentValue_get_Uris(py::wrapper::Windows::Services::TargetedContent::TargetedContentValue* self, void* /*unused*/) noexcept
    {
        try
        {
            static std::optional<bool> is_property_present{};

            if (!is_property_present.has_value())
            {
                is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Services.TargetedContent.TargetedContentValue", L"Uris");
            }

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

    static PyObject* TargetedContentValue_get_ValueKind(py::wrapper::Windows::Services::TargetedContent::TargetedContentValue* self, void* /*unused*/) noexcept
    {
        try
        {
            static std::optional<bool> is_property_present{};

            if (!is_property_present.has_value())
            {
                is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Services.TargetedContent.TargetedContentValue", L"ValueKind");
            }

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

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

    static PyObject* _from_TargetedContentValue(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::Services::TargetedContent::TargetedContentValue>());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyMethodDef _methods_TargetedContentValue[] = {
        { "_assign_array_", _assign_array_TargetedContentValue, METH_O | METH_STATIC, nullptr },
        { "_from", reinterpret_cast<PyCFunction>(_from_TargetedContentValue), METH_O | METH_STATIC, nullptr },
        { }};

    static PyGetSetDef _getset_TargetedContentValue[] = {
        { "action", reinterpret_cast<getter>(TargetedContentValue_get_Action), nullptr, nullptr, nullptr },
        { "actions", reinterpret_cast<getter>(TargetedContentValue_get_Actions), nullptr, nullptr, nullptr },
        { "boolean", reinterpret_cast<getter>(TargetedContentValue_get_Boolean), nullptr, nullptr, nullptr },
        { "booleans", reinterpret_cast<getter>(TargetedContentValue_get_Booleans), nullptr, nullptr, nullptr },
        { "file", reinterpret_cast<getter>(TargetedContentValue_get_File), nullptr, nullptr, nullptr },
        { "files", reinterpret_cast<getter>(TargetedContentValue_get_Files), nullptr, nullptr, nullptr },
        { "image_file", reinterpret_cast<getter>(TargetedContentValue_get_ImageFile), nullptr, nullptr, nullptr },
        { "image_files", reinterpret_cast<getter>(TargetedContentValue_get_ImageFiles), nullptr, nullptr, nullptr },
        { "number", reinterpret_cast<getter>(TargetedContentValue_get_Number), nullptr, nullptr, nullptr },
        { "numbers", reinterpret_cast<getter>(TargetedContentValue_get_Numbers), nullptr, nullptr, nullptr },
        { "path", reinterpret_cast<getter>(TargetedContentValue_get_Path), nullptr, nullptr, nullptr },
        { "string", reinterpret_cast<getter>(TargetedContentValue_get_String), nullptr, nullptr, nullptr },
        { "strings", reinterpret_cast<getter>(TargetedContentValue_get_Strings), nullptr, nullptr, nullptr },
        { "uri", reinterpret_cast<getter>(TargetedContentValue_get_Uri), nullptr, nullptr, nullptr },
        { "uris", reinterpret_cast<getter>(TargetedContentValue_get_Uris), nullptr, nullptr, nullptr },
        { "value_kind", reinterpret_cast<getter>(TargetedContentValue_get_ValueKind), nullptr, nullptr, nullptr },
        { }};

    static PyType_Slot _type_slots_TargetedContentValue[] = {
        { Py_tp_new, reinterpret_cast<void*>(_new_TargetedContentValue) },
        { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_TargetedContentValue) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_TargetedContentValue) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_TargetedContentValue) },
        { }};

    static PyType_Spec type_spec_TargetedContentValue = {
        "winrt._winrt_windows_services_targetedcontent.TargetedContentValue",
        sizeof(py::wrapper::Windows::Services::TargetedContent::TargetedContentValue),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_TargetedContentValue};

    // ----- Windows.Services.TargetedContent Initialization --------------------

    PyDoc_STRVAR(module_doc, "Windows.Services.TargetedContent");

    static PyModuleDef module_def = {
        PyModuleDef_HEAD_INIT,
        "_winrt_windows_services_targetedcontent",
        module_doc,
        0,
        nullptr,
        nullptr,
        nullptr,
        nullptr,
        nullptr};
} // py::cpp::Windows::Services::TargetedContent

PyMODINIT_FUNC PyInit__winrt_windows_services_targetedcontent(void) noexcept
{
    using namespace py::cpp::Windows::Services::TargetedContent;

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

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

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

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

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

    py::pyobj_handle type_TargetedContentContainer_Static{PyType_FromSpecWithBases(&type_spec_TargetedContentContainer_Static, TargetedContentContainer_Static_bases.get())};
    if (!type_TargetedContentContainer_Static)
    {
        return nullptr;
    }

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

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

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

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

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

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

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

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

    py::pyobj_handle type_TargetedContentSubscription_Static{PyType_FromSpecWithBases(&type_spec_TargetedContentSubscription_Static, TargetedContentSubscription_Static_bases.get())};
    if (!type_TargetedContentSubscription_Static)
    {
        return nullptr;
    }

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

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

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


    return module.detach();
}
