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

#include "py.Windows.UI.Notifications.Management.h"

namespace py::cpp::Windows::UI::Notifications::Management
{
    // ----- UserNotificationListener class --------------------

    static PyObject* _new_UserNotificationListener(PyTypeObject* /*unused*/, PyObject* /*unused*/, PyObject* /*unused*/) noexcept
    {
        static_assert(py::py_type<winrt::Windows::UI::Notifications::Management::UserNotificationListener>::type_name);
        py::set_invalid_activation_error(py::py_type<winrt::Windows::UI::Notifications::Management::UserNotificationListener>::type_name);
        return nullptr;
    }

    static void _dealloc_UserNotificationListener(py::wrapper::Windows::UI::Notifications::Management::UserNotificationListener* self) noexcept
    {
        auto tp = Py_TYPE(self);
        std::destroy_at(&self->obj);
        tp->tp_free(self);
        Py_DECREF(tp);
    }

    static PyObject* UserNotificationListener_ClearNotifications(py::wrapper::Windows::UI::Notifications::Management::UserNotificationListener* self, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_Size(args);

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

                if (!is_overload_present.has_value())
                {
                    is_overload_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.UI.Notifications.Management.UserNotificationListener", L"ClearNotifications", 0);
                }

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

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

    static PyObject* UserNotificationListener_GetAccessStatus(py::wrapper::Windows::UI::Notifications::Management::UserNotificationListener* self, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_Size(args);

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

                if (!is_overload_present.has_value())
                {
                    is_overload_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.UI.Notifications.Management.UserNotificationListener", L"GetAccessStatus", 0);
                }

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

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

    static PyObject* UserNotificationListener_GetNotification(py::wrapper::Windows::UI::Notifications::Management::UserNotificationListener* self, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_Size(args);

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

                if (!is_overload_present.has_value())
                {
                    is_overload_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.UI.Notifications.Management.UserNotificationListener", L"GetNotification", 1);
                }

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

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

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

    static PyObject* UserNotificationListener_GetNotificationsAsync(py::wrapper::Windows::UI::Notifications::Management::UserNotificationListener* self, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_Size(args);

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

                if (!is_overload_present.has_value())
                {
                    is_overload_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.UI.Notifications.Management.UserNotificationListener", L"GetNotificationsAsync", 1);
                }

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

                auto param0 = py::convert_to<winrt::Windows::UI::Notifications::NotificationKinds>(args, 0);

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

    static PyObject* UserNotificationListener_RemoveNotification(py::wrapper::Windows::UI::Notifications::Management::UserNotificationListener* self, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_Size(args);

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

                if (!is_overload_present.has_value())
                {
                    is_overload_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.UI.Notifications.Management.UserNotificationListener", L"RemoveNotification", 1);
                }

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

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

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

    static PyObject* UserNotificationListener_RequestAccessAsync(py::wrapper::Windows::UI::Notifications::Management::UserNotificationListener* self, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_Size(args);

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

                if (!is_overload_present.has_value())
                {
                    is_overload_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.UI.Notifications.Management.UserNotificationListener", L"RequestAccessAsync", 0);
                }

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

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

    static PyObject* UserNotificationListener_get_Current(PyObject* /*unused*/, void* /*unused*/) noexcept
    {
        try
        {
            static std::optional<bool> is_property_present{};

            if (!is_property_present.has_value())
            {
                is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.UI.Notifications.Management.UserNotificationListener", L"Current");
            }

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

            return py::convert(winrt::Windows::UI::Notifications::Management::UserNotificationListener::Current());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* UserNotificationListener_add_NotificationChanged(py::wrapper::Windows::UI::Notifications::Management::UserNotificationListener* 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.UI.Notifications.Management.UserNotificationListener", L"NotificationChanged");
            }

            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::UI::Notifications::Management::UserNotificationListener, winrt::Windows::UI::Notifications::UserNotificationChangedEventArgs>>(arg);

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

    static PyObject* UserNotificationListener_remove_NotificationChanged(py::wrapper::Windows::UI::Notifications::Management::UserNotificationListener* 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.UI.Notifications.Management.UserNotificationListener", L"NotificationChanged");
            }

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

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

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

    static PyObject* _from_UserNotificationListener(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::UI::Notifications::Management::UserNotificationListener>());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyMethodDef _methods_UserNotificationListener[] = {
        { "clear_notifications", reinterpret_cast<PyCFunction>(UserNotificationListener_ClearNotifications), METH_VARARGS, nullptr },
        { "get_access_status", reinterpret_cast<PyCFunction>(UserNotificationListener_GetAccessStatus), METH_VARARGS, nullptr },
        { "get_notification", reinterpret_cast<PyCFunction>(UserNotificationListener_GetNotification), METH_VARARGS, nullptr },
        { "get_notifications_async", reinterpret_cast<PyCFunction>(UserNotificationListener_GetNotificationsAsync), METH_VARARGS, nullptr },
        { "remove_notification", reinterpret_cast<PyCFunction>(UserNotificationListener_RemoveNotification), METH_VARARGS, nullptr },
        { "request_access_async", reinterpret_cast<PyCFunction>(UserNotificationListener_RequestAccessAsync), METH_VARARGS, nullptr },
        { "add_notification_changed", reinterpret_cast<PyCFunction>(UserNotificationListener_add_NotificationChanged), METH_O, nullptr },
        { "remove_notification_changed", reinterpret_cast<PyCFunction>(UserNotificationListener_remove_NotificationChanged), METH_O, nullptr },
        { "_assign_array_", _assign_array_UserNotificationListener, METH_O | METH_STATIC, nullptr },
        { "_from", reinterpret_cast<PyCFunction>(_from_UserNotificationListener), METH_O | METH_STATIC, nullptr },
        { }
    };

    static PyGetSetDef _getset_UserNotificationListener[] = {
        { }
    };

    static PyType_Slot _type_slots_UserNotificationListener[] = {
        { Py_tp_new, reinterpret_cast<void*>(_new_UserNotificationListener) },
        { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_UserNotificationListener) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_UserNotificationListener) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_UserNotificationListener) },
        { }
    };

    static PyType_Spec type_spec_UserNotificationListener = {
        "winrt._winrt_windows_ui_notifications_management.UserNotificationListener",
        sizeof(py::wrapper::Windows::UI::Notifications::Management::UserNotificationListener),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_UserNotificationListener};

    static PyGetSetDef getset_UserNotificationListener_Static[] = {
        { "current", reinterpret_cast<getter>(UserNotificationListener_get_Current), nullptr, nullptr, nullptr },
        { }
    };

    static PyMethodDef methods_UserNotificationListener_Static[] = {
        { }
    };

    static PyType_Slot type_slots_UserNotificationListener_Static[] = 
    {
        { Py_tp_base, reinterpret_cast<void*>(&PyType_Type) },
        { Py_tp_getset, reinterpret_cast<void*>(getset_UserNotificationListener_Static) },
        { Py_tp_methods, reinterpret_cast<void*>(methods_UserNotificationListener_Static) },
        { }
    };

    static PyType_Spec type_spec_UserNotificationListener_Static =
    {
        "winrt._winrt_windows_ui_notifications_management.UserNotificationListener_Static",
        static_cast<int>(PyType_Type.tp_basicsize),
        static_cast<int>(PyType_Type.tp_itemsize),
        Py_TPFLAGS_DEFAULT,
        type_slots_UserNotificationListener_Static
    };

    // ----- Windows.UI.Notifications.Management Initialization --------------------

    PyDoc_STRVAR(module_doc, "Windows.UI.Notifications.Management");

    static PyModuleDef module_def = {
        PyModuleDef_HEAD_INIT,
        "_winrt_windows_ui_notifications_management",
        module_doc,
        0,
        nullptr,
        nullptr,
        nullptr,
        nullptr,
        nullptr};
} // py::cpp::Windows::UI::Notifications::Management

PyMODINIT_FUNC PyInit__winrt_windows_ui_notifications_management(void) noexcept
{
    using namespace py::cpp::Windows::UI::Notifications::Management;

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

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

    if (!module)
    {
        return nullptr;
    }

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

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

    if (!object_bases)
    {
        return nullptr;
    }

    py::pyobj_handle type_UserNotificationListener_Static{PyType_FromSpec(&type_spec_UserNotificationListener_Static)};
    if (!type_UserNotificationListener_Static)
    {
        return nullptr;
    }

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


    return module.detach();
}
