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

#include "pybase.h"
#include "py.Windows.ApplicationModel.Search.Core.h"


namespace py::cpp::Windows::ApplicationModel::Search::Core
{
    struct module_state
    {
        PyObject* type_SearchSuggestionKind;
        PyTypeObject* type_RequestingFocusOnKeyboardInputEventArgs;
        PyTypeObject* type_SearchSuggestion;
        PyTypeObject* type_SearchSuggestionManager;
        PyTypeObject* type_SearchSuggestionsRequestedEventArgs;
    };

    static PyObject* register_SearchSuggestionKind(PyObject* module, PyObject* type) noexcept
    {
        auto state = reinterpret_cast<module_state*>(PyModule_GetState(module));
        assert(state);

        if (state->type_SearchSuggestionKind)
        {
            PyErr_SetString(PyExc_RuntimeError, "type has already been registered");
            return nullptr;
        }

        if (!PyType_Check(type))
        {
            PyErr_SetString(PyExc_TypeError, "argument is not a type");
            return nullptr;
        }

        state->type_SearchSuggestionKind = type;
        Py_INCREF(state->type_SearchSuggestionKind);


        Py_RETURN_NONE;
    }

    // ----- RequestingFocusOnKeyboardInputEventArgs class --------------------
    static constexpr const char* const type_name_RequestingFocusOnKeyboardInputEventArgs = "RequestingFocusOnKeyboardInputEventArgs";

    static PyObject* _new_RequestingFocusOnKeyboardInputEventArgs(PyTypeObject* type, PyObject* args, PyObject* kwds) noexcept
    {
        py::set_invalid_activation_error(type_name_RequestingFocusOnKeyboardInputEventArgs);
        return nullptr;
    }

    static void _dealloc_RequestingFocusOnKeyboardInputEventArgs(py::wrapper::Windows::ApplicationModel::Search::Core::RequestingFocusOnKeyboardInputEventArgs* self) noexcept
    {
        auto tp = Py_TYPE(self);

        if (PyType_IS_GC(tp))
        {
            PyObject_GC_UnTrack(self);
        }

        std::destroy_at(&self->obj);
        tp->tp_free(self);
        Py_DECREF(tp);
    }

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

    static PyObject* _from_RequestingFocusOnKeyboardInputEventArgs(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::ApplicationModel::Search::Core::RequestingFocusOnKeyboardInputEventArgs>());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyMethodDef _methods_RequestingFocusOnKeyboardInputEventArgs[] = {
        { "_assign_array_", _assign_array_RequestingFocusOnKeyboardInputEventArgs, METH_O | METH_STATIC, nullptr },
        { "_from", reinterpret_cast<PyCFunction>(_from_RequestingFocusOnKeyboardInputEventArgs), METH_O | METH_STATIC, nullptr },
        { }
    };

    static PyGetSetDef _getset_RequestingFocusOnKeyboardInputEventArgs[] = {
        { }
    };

    static PyType_Slot _type_slots_RequestingFocusOnKeyboardInputEventArgs[] = 
    {
        { Py_tp_new, reinterpret_cast<void*>(_new_RequestingFocusOnKeyboardInputEventArgs) },
        { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_RequestingFocusOnKeyboardInputEventArgs) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_RequestingFocusOnKeyboardInputEventArgs) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_RequestingFocusOnKeyboardInputEventArgs) },
        { },
    };

    static PyType_Spec type_spec_RequestingFocusOnKeyboardInputEventArgs =
    {
        "_winsdk_Windows_ApplicationModel_Search_Core.RequestingFocusOnKeyboardInputEventArgs",
        sizeof(py::wrapper::Windows::ApplicationModel::Search::Core::RequestingFocusOnKeyboardInputEventArgs),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_RequestingFocusOnKeyboardInputEventArgs
    };

    // ----- SearchSuggestion class --------------------
    static constexpr const char* const type_name_SearchSuggestion = "SearchSuggestion";

    static PyObject* _new_SearchSuggestion(PyTypeObject* type, PyObject* args, PyObject* kwds) noexcept
    {
        py::set_invalid_activation_error(type_name_SearchSuggestion);
        return nullptr;
    }

    static void _dealloc_SearchSuggestion(py::wrapper::Windows::ApplicationModel::Search::Core::SearchSuggestion* self) noexcept
    {
        auto tp = Py_TYPE(self);

        if (PyType_IS_GC(tp))
        {
            PyObject_GC_UnTrack(self);
        }

        std::destroy_at(&self->obj);
        tp->tp_free(self);
        Py_DECREF(tp);
    }

    static PyObject* SearchSuggestion_get_DetailText(py::wrapper::Windows::ApplicationModel::Search::Core::SearchSuggestion* self, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.ApplicationModel.Search.Core.SearchSuggestion", L"DetailText"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return nullptr;
        }

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

    static PyObject* SearchSuggestion_get_Image(py::wrapper::Windows::ApplicationModel::Search::Core::SearchSuggestion* self, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.ApplicationModel.Search.Core.SearchSuggestion", L"Image"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return nullptr;
        }

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

    static PyObject* SearchSuggestion_get_ImageAlternateText(py::wrapper::Windows::ApplicationModel::Search::Core::SearchSuggestion* self, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.ApplicationModel.Search.Core.SearchSuggestion", L"ImageAlternateText"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return nullptr;
        }

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

    static PyObject* SearchSuggestion_get_Kind(py::wrapper::Windows::ApplicationModel::Search::Core::SearchSuggestion* self, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.ApplicationModel.Search.Core.SearchSuggestion", L"Kind"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return nullptr;
        }

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

    static PyObject* SearchSuggestion_get_Tag(py::wrapper::Windows::ApplicationModel::Search::Core::SearchSuggestion* self, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.ApplicationModel.Search.Core.SearchSuggestion", L"Tag"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return nullptr;
        }

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

    static PyObject* SearchSuggestion_get_Text(py::wrapper::Windows::ApplicationModel::Search::Core::SearchSuggestion* self, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.ApplicationModel.Search.Core.SearchSuggestion", L"Text"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return nullptr;
        }

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

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

    static PyObject* _from_SearchSuggestion(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::ApplicationModel::Search::Core::SearchSuggestion>());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyMethodDef _methods_SearchSuggestion[] = {
        { "_assign_array_", _assign_array_SearchSuggestion, METH_O | METH_STATIC, nullptr },
        { "_from", reinterpret_cast<PyCFunction>(_from_SearchSuggestion), METH_O | METH_STATIC, nullptr },
        { }
    };

    static PyGetSetDef _getset_SearchSuggestion[] = {
        { "detail_text", reinterpret_cast<getter>(SearchSuggestion_get_DetailText), nullptr, nullptr, nullptr },
        { "image", reinterpret_cast<getter>(SearchSuggestion_get_Image), nullptr, nullptr, nullptr },
        { "image_alternate_text", reinterpret_cast<getter>(SearchSuggestion_get_ImageAlternateText), nullptr, nullptr, nullptr },
        { "kind", reinterpret_cast<getter>(SearchSuggestion_get_Kind), nullptr, nullptr, nullptr },
        { "tag", reinterpret_cast<getter>(SearchSuggestion_get_Tag), nullptr, nullptr, nullptr },
        { "text", reinterpret_cast<getter>(SearchSuggestion_get_Text), nullptr, nullptr, nullptr },
        { }
    };

    static PyType_Slot _type_slots_SearchSuggestion[] = 
    {
        { Py_tp_new, reinterpret_cast<void*>(_new_SearchSuggestion) },
        { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_SearchSuggestion) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_SearchSuggestion) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_SearchSuggestion) },
        { },
    };

    static PyType_Spec type_spec_SearchSuggestion =
    {
        "_winsdk_Windows_ApplicationModel_Search_Core.SearchSuggestion",
        sizeof(py::wrapper::Windows::ApplicationModel::Search::Core::SearchSuggestion),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_SearchSuggestion
    };

    // ----- SearchSuggestionManager class --------------------
    static constexpr const char* const type_name_SearchSuggestionManager = "SearchSuggestionManager";

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

        auto arg_count = PyTuple_Size(args);
        if (arg_count == 0)
        {
            try
            {
                winrt::Windows::ApplicationModel::Search::Core::SearchSuggestionManager instance{  };
                return py::wrap(instance, type);
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static void _dealloc_SearchSuggestionManager(py::wrapper::Windows::ApplicationModel::Search::Core::SearchSuggestionManager* self) noexcept
    {
        auto tp = Py_TYPE(self);

        if (PyType_IS_GC(tp))
        {
            PyObject_GC_UnTrack(self);
        }

        std::destroy_at(&self->obj);
        tp->tp_free(self);
        Py_DECREF(tp);
    }

    static PyObject* SearchSuggestionManager_AddToHistory(py::wrapper::Windows::ApplicationModel::Search::Core::SearchSuggestionManager* self, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_Size(args);

        if (arg_count == 1)
        {
            if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.ApplicationModel.Search.Core.SearchSuggestionManager", L"AddToHistory", 1))
            {
                py::set_arg_count_version_error(1);
                return nullptr;
            }

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

                self->obj.AddToHistory(param0);
                Py_RETURN_NONE;
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else if (arg_count == 2)
        {
            if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.ApplicationModel.Search.Core.SearchSuggestionManager", L"AddToHistory", 2))
            {
                py::set_arg_count_version_error(2);
                return nullptr;
            }

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

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

    static PyObject* SearchSuggestionManager_ClearHistory(py::wrapper::Windows::ApplicationModel::Search::Core::SearchSuggestionManager* self, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_Size(args);

        if (arg_count == 0)
        {
            if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.ApplicationModel.Search.Core.SearchSuggestionManager", L"ClearHistory", 0))
            {
                py::set_arg_count_version_error(0);
                return nullptr;
            }

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

    static PyObject* SearchSuggestionManager_SetLocalContentSuggestionSettings(py::wrapper::Windows::ApplicationModel::Search::Core::SearchSuggestionManager* self, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_Size(args);

        if (arg_count == 1)
        {
            if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.ApplicationModel.Search.Core.SearchSuggestionManager", L"SetLocalContentSuggestionSettings", 1))
            {
                py::set_arg_count_version_error(1);
                return nullptr;
            }

            try
            {
                auto param0 = py::convert_to<winrt::Windows::ApplicationModel::Search::LocalContentSuggestionSettings>(args, 0);

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

    static PyObject* SearchSuggestionManager_SetQuery(py::wrapper::Windows::ApplicationModel::Search::Core::SearchSuggestionManager* self, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_Size(args);

        if (arg_count == 1)
        {
            if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.ApplicationModel.Search.Core.SearchSuggestionManager", L"SetQuery", 1))
            {
                py::set_arg_count_version_error(1);
                return nullptr;
            }

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

                self->obj.SetQuery(param0);
                Py_RETURN_NONE;
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else if (arg_count == 2)
        {
            if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.ApplicationModel.Search.Core.SearchSuggestionManager", L"SetQuery", 2))
            {
                py::set_arg_count_version_error(2);
                return nullptr;
            }

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

                self->obj.SetQuery(param0, param1);
                Py_RETURN_NONE;
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else if (arg_count == 3)
        {
            if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.ApplicationModel.Search.Core.SearchSuggestionManager", L"SetQuery", 3))
            {
                py::set_arg_count_version_error(3);
                return nullptr;
            }

            try
            {
                auto param0 = py::convert_to<winrt::hstring>(args, 0);
                auto param1 = py::convert_to<winrt::hstring>(args, 1);
                auto param2 = py::convert_to<winrt::Windows::ApplicationModel::Search::SearchQueryLinguisticDetails>(args, 2);

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

    static PyObject* SearchSuggestionManager_get_SearchHistoryEnabled(py::wrapper::Windows::ApplicationModel::Search::Core::SearchSuggestionManager* self, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.ApplicationModel.Search.Core.SearchSuggestionManager", L"SearchHistoryEnabled"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return nullptr;
        }

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

    static int SearchSuggestionManager_put_SearchHistoryEnabled(py::wrapper::Windows::ApplicationModel::Search::Core::SearchSuggestionManager* self, PyObject* arg, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.ApplicationModel.Search.Core.SearchSuggestionManager", L"SearchHistoryEnabled"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return -1;
        }

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

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

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

    static PyObject* SearchSuggestionManager_get_SearchHistoryContext(py::wrapper::Windows::ApplicationModel::Search::Core::SearchSuggestionManager* self, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.ApplicationModel.Search.Core.SearchSuggestionManager", L"SearchHistoryContext"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return nullptr;
        }

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

    static int SearchSuggestionManager_put_SearchHistoryContext(py::wrapper::Windows::ApplicationModel::Search::Core::SearchSuggestionManager* self, PyObject* arg, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.ApplicationModel.Search.Core.SearchSuggestionManager", L"SearchHistoryContext"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return -1;
        }

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

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

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

    static PyObject* SearchSuggestionManager_get_Suggestions(py::wrapper::Windows::ApplicationModel::Search::Core::SearchSuggestionManager* self, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.ApplicationModel.Search.Core.SearchSuggestionManager", L"Suggestions"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return nullptr;
        }

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

    static PyObject* SearchSuggestionManager_add_RequestingFocusOnKeyboardInput(py::wrapper::Windows::ApplicationModel::Search::Core::SearchSuggestionManager* self, PyObject* arg) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsEventPresent(L"Windows.ApplicationModel.Search.Core.SearchSuggestionManager", L"RequestingFocusOnKeyboardInput"))
        {
            PyErr_SetString(PyExc_AttributeError, "event is not available in this version of Windows");
            return nullptr;
        }

        try
        {
            auto param0 = py::convert_to<winrt::Windows::Foundation::TypedEventHandler<winrt::Windows::ApplicationModel::Search::Core::SearchSuggestionManager, winrt::Windows::ApplicationModel::Search::Core::RequestingFocusOnKeyboardInputEventArgs>>(arg);

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

    static PyObject* SearchSuggestionManager_remove_RequestingFocusOnKeyboardInput(py::wrapper::Windows::ApplicationModel::Search::Core::SearchSuggestionManager* self, PyObject* arg) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsEventPresent(L"Windows.ApplicationModel.Search.Core.SearchSuggestionManager", L"RequestingFocusOnKeyboardInput"))
        {
            PyErr_SetString(PyExc_AttributeError, "event is not available in this version of Windows");
            return nullptr;
        }

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

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

    static PyObject* SearchSuggestionManager_add_SuggestionsRequested(py::wrapper::Windows::ApplicationModel::Search::Core::SearchSuggestionManager* self, PyObject* arg) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsEventPresent(L"Windows.ApplicationModel.Search.Core.SearchSuggestionManager", L"SuggestionsRequested"))
        {
            PyErr_SetString(PyExc_AttributeError, "event is not available in this version of Windows");
            return nullptr;
        }

        try
        {
            auto param0 = py::convert_to<winrt::Windows::Foundation::TypedEventHandler<winrt::Windows::ApplicationModel::Search::Core::SearchSuggestionManager, winrt::Windows::ApplicationModel::Search::Core::SearchSuggestionsRequestedEventArgs>>(arg);

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

    static PyObject* SearchSuggestionManager_remove_SuggestionsRequested(py::wrapper::Windows::ApplicationModel::Search::Core::SearchSuggestionManager* self, PyObject* arg) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsEventPresent(L"Windows.ApplicationModel.Search.Core.SearchSuggestionManager", L"SuggestionsRequested"))
        {
            PyErr_SetString(PyExc_AttributeError, "event is not available in this version of Windows");
            return nullptr;
        }

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

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

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

    static PyObject* _from_SearchSuggestionManager(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::ApplicationModel::Search::Core::SearchSuggestionManager>());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyMethodDef _methods_SearchSuggestionManager[] = {
        { "add_to_history", reinterpret_cast<PyCFunction>(SearchSuggestionManager_AddToHistory), METH_VARARGS, nullptr },
        { "clear_history", reinterpret_cast<PyCFunction>(SearchSuggestionManager_ClearHistory), METH_VARARGS, nullptr },
        { "set_local_content_suggestion_settings", reinterpret_cast<PyCFunction>(SearchSuggestionManager_SetLocalContentSuggestionSettings), METH_VARARGS, nullptr },
        { "set_query", reinterpret_cast<PyCFunction>(SearchSuggestionManager_SetQuery), METH_VARARGS, nullptr },
        { "add_requesting_focus_on_keyboard_input", reinterpret_cast<PyCFunction>(SearchSuggestionManager_add_RequestingFocusOnKeyboardInput), METH_O, nullptr },
        { "remove_requesting_focus_on_keyboard_input", reinterpret_cast<PyCFunction>(SearchSuggestionManager_remove_RequestingFocusOnKeyboardInput), METH_O, nullptr },
        { "add_suggestions_requested", reinterpret_cast<PyCFunction>(SearchSuggestionManager_add_SuggestionsRequested), METH_O, nullptr },
        { "remove_suggestions_requested", reinterpret_cast<PyCFunction>(SearchSuggestionManager_remove_SuggestionsRequested), METH_O, nullptr },
        { "_assign_array_", _assign_array_SearchSuggestionManager, METH_O | METH_STATIC, nullptr },
        { "_from", reinterpret_cast<PyCFunction>(_from_SearchSuggestionManager), METH_O | METH_STATIC, nullptr },
        { }
    };

    static PyGetSetDef _getset_SearchSuggestionManager[] = {
        { "search_history_enabled", reinterpret_cast<getter>(SearchSuggestionManager_get_SearchHistoryEnabled), reinterpret_cast<setter>(SearchSuggestionManager_put_SearchHistoryEnabled), nullptr, nullptr },
        { "search_history_context", reinterpret_cast<getter>(SearchSuggestionManager_get_SearchHistoryContext), reinterpret_cast<setter>(SearchSuggestionManager_put_SearchHistoryContext), nullptr, nullptr },
        { "suggestions", reinterpret_cast<getter>(SearchSuggestionManager_get_Suggestions), nullptr, nullptr, nullptr },
        { }
    };

    static PyType_Slot _type_slots_SearchSuggestionManager[] = 
    {
        { Py_tp_new, reinterpret_cast<void*>(_new_SearchSuggestionManager) },
        { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_SearchSuggestionManager) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_SearchSuggestionManager) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_SearchSuggestionManager) },
        { },
    };

    static PyType_Spec type_spec_SearchSuggestionManager =
    {
        "_winsdk_Windows_ApplicationModel_Search_Core.SearchSuggestionManager",
        sizeof(py::wrapper::Windows::ApplicationModel::Search::Core::SearchSuggestionManager),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_SearchSuggestionManager
    };

    // ----- SearchSuggestionsRequestedEventArgs class --------------------
    static constexpr const char* const type_name_SearchSuggestionsRequestedEventArgs = "SearchSuggestionsRequestedEventArgs";

    static PyObject* _new_SearchSuggestionsRequestedEventArgs(PyTypeObject* type, PyObject* args, PyObject* kwds) noexcept
    {
        py::set_invalid_activation_error(type_name_SearchSuggestionsRequestedEventArgs);
        return nullptr;
    }

    static void _dealloc_SearchSuggestionsRequestedEventArgs(py::wrapper::Windows::ApplicationModel::Search::Core::SearchSuggestionsRequestedEventArgs* self) noexcept
    {
        auto tp = Py_TYPE(self);

        if (PyType_IS_GC(tp))
        {
            PyObject_GC_UnTrack(self);
        }

        std::destroy_at(&self->obj);
        tp->tp_free(self);
        Py_DECREF(tp);
    }

    static PyObject* SearchSuggestionsRequestedEventArgs_get_Language(py::wrapper::Windows::ApplicationModel::Search::Core::SearchSuggestionsRequestedEventArgs* self, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.ApplicationModel.Search.Core.SearchSuggestionsRequestedEventArgs", L"Language"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return nullptr;
        }

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

    static PyObject* SearchSuggestionsRequestedEventArgs_get_LinguisticDetails(py::wrapper::Windows::ApplicationModel::Search::Core::SearchSuggestionsRequestedEventArgs* self, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.ApplicationModel.Search.Core.SearchSuggestionsRequestedEventArgs", L"LinguisticDetails"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return nullptr;
        }

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

    static PyObject* SearchSuggestionsRequestedEventArgs_get_QueryText(py::wrapper::Windows::ApplicationModel::Search::Core::SearchSuggestionsRequestedEventArgs* self, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.ApplicationModel.Search.Core.SearchSuggestionsRequestedEventArgs", L"QueryText"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return nullptr;
        }

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

    static PyObject* SearchSuggestionsRequestedEventArgs_get_Request(py::wrapper::Windows::ApplicationModel::Search::Core::SearchSuggestionsRequestedEventArgs* self, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.ApplicationModel.Search.Core.SearchSuggestionsRequestedEventArgs", L"Request"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return nullptr;
        }

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

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

    static PyObject* _from_SearchSuggestionsRequestedEventArgs(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::ApplicationModel::Search::Core::SearchSuggestionsRequestedEventArgs>());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyMethodDef _methods_SearchSuggestionsRequestedEventArgs[] = {
        { "_assign_array_", _assign_array_SearchSuggestionsRequestedEventArgs, METH_O | METH_STATIC, nullptr },
        { "_from", reinterpret_cast<PyCFunction>(_from_SearchSuggestionsRequestedEventArgs), METH_O | METH_STATIC, nullptr },
        { }
    };

    static PyGetSetDef _getset_SearchSuggestionsRequestedEventArgs[] = {
        { "language", reinterpret_cast<getter>(SearchSuggestionsRequestedEventArgs_get_Language), nullptr, nullptr, nullptr },
        { "linguistic_details", reinterpret_cast<getter>(SearchSuggestionsRequestedEventArgs_get_LinguisticDetails), nullptr, nullptr, nullptr },
        { "query_text", reinterpret_cast<getter>(SearchSuggestionsRequestedEventArgs_get_QueryText), nullptr, nullptr, nullptr },
        { "request", reinterpret_cast<getter>(SearchSuggestionsRequestedEventArgs_get_Request), nullptr, nullptr, nullptr },
        { }
    };

    static PyType_Slot _type_slots_SearchSuggestionsRequestedEventArgs[] = 
    {
        { Py_tp_new, reinterpret_cast<void*>(_new_SearchSuggestionsRequestedEventArgs) },
        { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_SearchSuggestionsRequestedEventArgs) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_SearchSuggestionsRequestedEventArgs) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_SearchSuggestionsRequestedEventArgs) },
        { },
    };

    static PyType_Spec type_spec_SearchSuggestionsRequestedEventArgs =
    {
        "_winsdk_Windows_ApplicationModel_Search_Core.SearchSuggestionsRequestedEventArgs",
        sizeof(py::wrapper::Windows::ApplicationModel::Search::Core::SearchSuggestionsRequestedEventArgs),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_SearchSuggestionsRequestedEventArgs
    };

    // ----- Windows.ApplicationModel.Search.Core Initialization --------------------
    PyDoc_STRVAR(module_doc, "Windows::ApplicationModel::Search::Core");

    static PyMethodDef module_methods[] = {
        {"_register_SearchSuggestionKind", register_SearchSuggestionKind, METH_O, "registers type"},
        {}};


    static int module_traverse(PyObject* module, visitproc visit, void* arg) noexcept
    {
        auto state = reinterpret_cast<module_state*>(PyModule_GetState(module));

        if (!state)
        {
            return 0;
        }

        Py_VISIT(state->type_SearchSuggestionKind);
        Py_VISIT(state->type_RequestingFocusOnKeyboardInputEventArgs);
        Py_VISIT(state->type_SearchSuggestion);
        Py_VISIT(state->type_SearchSuggestionManager);
        Py_VISIT(state->type_SearchSuggestionsRequestedEventArgs);

        return 0;
    }

    static int module_clear(PyObject* module) noexcept
    {
        auto state = reinterpret_cast<module_state*>(PyModule_GetState(module));

        if (!state)
        {
            return 0;
        }

        Py_CLEAR(state->type_SearchSuggestionKind);
        Py_CLEAR(state->type_RequestingFocusOnKeyboardInputEventArgs);
        Py_CLEAR(state->type_SearchSuggestion);
        Py_CLEAR(state->type_SearchSuggestionManager);
        Py_CLEAR(state->type_SearchSuggestionsRequestedEventArgs);

        return 0;
    }


    static PyModuleDef module_def
        = {PyModuleDef_HEAD_INIT,
           "_winsdk_Windows_ApplicationModel_Search_Core",
           module_doc,
           sizeof(module_state),
           module_methods,
           nullptr,
           module_traverse,
           module_clear,
           nullptr};

} // py::cpp::Windows::ApplicationModel::Search::Core

PyMODINIT_FUNC PyInit__winsdk_Windows_ApplicationModel_Search_Core(void) noexcept
{
    using namespace py::cpp::Windows::ApplicationModel::Search::Core;

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

    if (!module)
    {
        return nullptr;
    }

    auto object_type = py::get_python_type<py::Object>();
    if (!object_type)
    {
        return nullptr;
    }

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

    if (!bases)
    {
        return nullptr;
    }

    py::pyobj_handle collections_abc_module{PyImport_ImportModule("collections.abc")};

    if (!collections_abc_module)
    {
        return nullptr;
    }

    py::pyobj_handle sequence_type{PyObject_GetAttrString(collections_abc_module.get(), "Sequence")};

    if (!sequence_type)
    {
        return nullptr;
    }

    py::pyobj_handle sequence_bases{PyTuple_Pack(2, object_type, sequence_type.get())};

    if (!sequence_bases)
    {
        return nullptr;
    }

    py::pyobj_handle mutable_sequence_type{PyObject_GetAttrString(collections_abc_module.get(), "MutableSequence")};

    if (!mutable_sequence_type)
    {
        return nullptr;
    }

    py::pyobj_handle mutable_sequence_bases{PyTuple_Pack(2, object_type, mutable_sequence_type.get())};

    if (!mutable_sequence_bases)
    {
        return nullptr;
    }

    py::pyobj_handle mapping_type{PyObject_GetAttrString(collections_abc_module.get(), "Mapping")};

    if (!mapping_type)
    {
        return nullptr;
    }

    py::pyobj_handle mapping_bases{PyTuple_Pack(2, object_type, mapping_type.get())};

    if (!mapping_bases)
    {
        return nullptr;
    }

    py::pyobj_handle mutable_mapping_type{PyObject_GetAttrString(collections_abc_module.get(), "MutableMapping")};

    if (!mutable_mapping_type)
    {
        return nullptr;
    }

    py::pyobj_handle mutable_mapping_bases{PyTuple_Pack(2, object_type, mutable_mapping_type.get())};

    if (!mutable_mapping_bases)
    {
        return nullptr;
    }

    auto state = reinterpret_cast<module_state*>(PyModule_GetState(module.get()));
    assert(state);

    state->type_RequestingFocusOnKeyboardInputEventArgs = py::register_python_type(module.get(), type_name_RequestingFocusOnKeyboardInputEventArgs, &type_spec_RequestingFocusOnKeyboardInputEventArgs, bases.get(), nullptr);
    if (!state->type_RequestingFocusOnKeyboardInputEventArgs)
    {
        return nullptr;
    }

    state->type_SearchSuggestion = py::register_python_type(module.get(), type_name_SearchSuggestion, &type_spec_SearchSuggestion, bases.get(), nullptr);
    if (!state->type_SearchSuggestion)
    {
        return nullptr;
    }

    state->type_SearchSuggestionManager = py::register_python_type(module.get(), type_name_SearchSuggestionManager, &type_spec_SearchSuggestionManager, bases.get(), nullptr);
    if (!state->type_SearchSuggestionManager)
    {
        return nullptr;
    }

    state->type_SearchSuggestionsRequestedEventArgs = py::register_python_type(module.get(), type_name_SearchSuggestionsRequestedEventArgs, &type_spec_SearchSuggestionsRequestedEventArgs, bases.get(), nullptr);
    if (!state->type_SearchSuggestionsRequestedEventArgs)
    {
        return nullptr;
    }


    return module.detach();
}

PyObject* py::py_type<winrt::Windows::ApplicationModel::Search::Core::SearchSuggestionKind>::get_python_type() noexcept {
    using namespace py::cpp::Windows::ApplicationModel::Search::Core;

    PyObject* module = PyState_FindModule(&module_def);

    if (!module) {
        PyErr_SetString(PyExc_RuntimeError, "could not find module for Windows::ApplicationModel::Search::Core");
        return nullptr;
    }

    auto state = reinterpret_cast<module_state*>(PyModule_GetState(module));
    assert(state);

    auto python_type = state->type_SearchSuggestionKind;

    if (!python_type) {
        PyErr_SetString(PyExc_RuntimeError, "type winrt::Windows::ApplicationModel::Search::Core::SearchSuggestionKind is not registered");
        return nullptr;
    }

    return python_type;
}

PyTypeObject* py::winrt_type<winrt::Windows::ApplicationModel::Search::Core::RequestingFocusOnKeyboardInputEventArgs>::get_python_type() noexcept {
    using namespace py::cpp::Windows::ApplicationModel::Search::Core;

    PyObject* module = PyState_FindModule(&module_def);

    if (!module) {
        PyErr_SetString(PyExc_RuntimeError, "could not find module for Windows::ApplicationModel::Search::Core");
        return nullptr;
    }

    auto state = reinterpret_cast<module_state*>(PyModule_GetState(module));
    assert(state);

    auto python_type = state->type_RequestingFocusOnKeyboardInputEventArgs;

    if (!python_type) {
        PyErr_SetString(PyExc_RuntimeError, "type winrt::Windows::ApplicationModel::Search::Core::RequestingFocusOnKeyboardInputEventArgs is not registered");
        return nullptr;
    }

    return python_type;
}

PyTypeObject* py::winrt_type<winrt::Windows::ApplicationModel::Search::Core::SearchSuggestion>::get_python_type() noexcept {
    using namespace py::cpp::Windows::ApplicationModel::Search::Core;

    PyObject* module = PyState_FindModule(&module_def);

    if (!module) {
        PyErr_SetString(PyExc_RuntimeError, "could not find module for Windows::ApplicationModel::Search::Core");
        return nullptr;
    }

    auto state = reinterpret_cast<module_state*>(PyModule_GetState(module));
    assert(state);

    auto python_type = state->type_SearchSuggestion;

    if (!python_type) {
        PyErr_SetString(PyExc_RuntimeError, "type winrt::Windows::ApplicationModel::Search::Core::SearchSuggestion is not registered");
        return nullptr;
    }

    return python_type;
}

PyTypeObject* py::winrt_type<winrt::Windows::ApplicationModel::Search::Core::SearchSuggestionManager>::get_python_type() noexcept {
    using namespace py::cpp::Windows::ApplicationModel::Search::Core;

    PyObject* module = PyState_FindModule(&module_def);

    if (!module) {
        PyErr_SetString(PyExc_RuntimeError, "could not find module for Windows::ApplicationModel::Search::Core");
        return nullptr;
    }

    auto state = reinterpret_cast<module_state*>(PyModule_GetState(module));
    assert(state);

    auto python_type = state->type_SearchSuggestionManager;

    if (!python_type) {
        PyErr_SetString(PyExc_RuntimeError, "type winrt::Windows::ApplicationModel::Search::Core::SearchSuggestionManager is not registered");
        return nullptr;
    }

    return python_type;
}

PyTypeObject* py::winrt_type<winrt::Windows::ApplicationModel::Search::Core::SearchSuggestionsRequestedEventArgs>::get_python_type() noexcept {
    using namespace py::cpp::Windows::ApplicationModel::Search::Core;

    PyObject* module = PyState_FindModule(&module_def);

    if (!module) {
        PyErr_SetString(PyExc_RuntimeError, "could not find module for Windows::ApplicationModel::Search::Core");
        return nullptr;
    }

    auto state = reinterpret_cast<module_state*>(PyModule_GetState(module));
    assert(state);

    auto python_type = state->type_SearchSuggestionsRequestedEventArgs;

    if (!python_type) {
        PyErr_SetString(PyExc_RuntimeError, "type winrt::Windows::ApplicationModel::Search::Core::SearchSuggestionsRequestedEventArgs is not registered");
        return nullptr;
    }

    return python_type;
}
