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

#include "py.Windows.Perception.Automation.Core.h"

namespace py::cpp::Windows::Perception::Automation::Core
{
    // ----- CorePerceptionAutomation class --------------------

    static PyObject* _new_CorePerceptionAutomation(PyTypeObject* /*unused*/, PyObject* /*unused*/, PyObject* /*unused*/) noexcept
    {
        static_assert(py::py_type<winrt::Windows::Perception::Automation::Core::CorePerceptionAutomation>::type_name);
        py::set_invalid_activation_error(py::py_type<winrt::Windows::Perception::Automation::Core::CorePerceptionAutomation>::type_name);
        return nullptr;
    }

    static PyObject* CorePerceptionAutomation_SetActivationFactoryProvider(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.Perception.Automation.Core.CorePerceptionAutomation", L"SetActivationFactoryProvider", 1);
                }

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

                auto param0 = py::convert_to<winrt::Windows::Foundation::IGetActivationFactory>(args, 0);

                {
                    auto _gil = release_gil();
                    winrt::Windows::Perception::Automation::Core::CorePerceptionAutomation::SetActivationFactoryProvider(param0);
                }

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

    static PyMethodDef _methods_CorePerceptionAutomation[] = {
        { }};

    static PyGetSetDef _getset_CorePerceptionAutomation[] = {
        { }};

    static PyType_Slot _type_slots_CorePerceptionAutomation[] = {
        { Py_tp_new, reinterpret_cast<void*>(_new_CorePerceptionAutomation) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_CorePerceptionAutomation) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_CorePerceptionAutomation) },
        { }};

    static PyType_Spec type_spec_CorePerceptionAutomation = {
        "winrt._winrt_windows_perception_automation_core.CorePerceptionAutomation",
        0,
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_CorePerceptionAutomation};

    static PyGetSetDef getset_CorePerceptionAutomation_Static[] = {
        { }};

    static PyMethodDef methods_CorePerceptionAutomation_Static[] = {
        { "set_activation_factory_provider", reinterpret_cast<PyCFunction>(CorePerceptionAutomation_SetActivationFactoryProvider), METH_VARARGS, nullptr },
        { }};

    static PyType_Slot type_slots_CorePerceptionAutomation_Static[] = 
    {
        { Py_tp_base, reinterpret_cast<void*>(&PyType_Type) },
        { Py_tp_getset, reinterpret_cast<void*>(getset_CorePerceptionAutomation_Static) },
        { Py_tp_methods, reinterpret_cast<void*>(methods_CorePerceptionAutomation_Static) },
        { }
    };

    static PyType_Spec type_spec_CorePerceptionAutomation_Static = {
        "winrt._winrt_windows_perception_automation_core.CorePerceptionAutomation_Static",
        static_cast<int>(PyType_Type.tp_basicsize),
        static_cast<int>(PyType_Type.tp_itemsize),
        Py_TPFLAGS_DEFAULT,
        type_slots_CorePerceptionAutomation_Static};

    // ----- Windows.Perception.Automation.Core Initialization --------------------

    PyDoc_STRVAR(module_doc, "Windows.Perception.Automation.Core");

    static PyModuleDef module_def = {
        PyModuleDef_HEAD_INIT,
        "_winrt_windows_perception_automation_core",
        module_doc,
        0,
        nullptr,
        nullptr,
        nullptr,
        nullptr,
        nullptr};
} // py::cpp::Windows::Perception::Automation::Core

PyMODINIT_FUNC PyInit__winrt_windows_perception_automation_core(void) noexcept
{
    using namespace py::cpp::Windows::Perception::Automation::Core;

    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::pyobj_handle CorePerceptionAutomation_Static_bases{PyTuple_Pack(1, reinterpret_cast<PyObject*>(inspectable_meta_type))};
    if (!CorePerceptionAutomation_Static_bases)
    {
        return nullptr;
    }

    py::pyobj_handle type_CorePerceptionAutomation_Static{PyType_FromSpecWithBases(&type_spec_CorePerceptionAutomation_Static, CorePerceptionAutomation_Static_bases.get())};
    if (!type_CorePerceptionAutomation_Static)
    {
        return nullptr;
    }

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


    return module.detach();
}
