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

#include "py.Windows.Foundation.Metadata.h"

namespace py::cpp::Windows::Foundation::Metadata
{
    // ----- ApiInformation class --------------------

    static PyObject* _new_ApiInformation(PyTypeObject* /*unused*/, PyObject* /*unused*/, PyObject* /*unused*/) noexcept
    {
        static_assert(py::py_type<winrt::Windows::Foundation::Metadata::ApiInformation>::type_name);
        py::set_invalid_activation_error(py::py_type<winrt::Windows::Foundation::Metadata::ApiInformation>::type_name);
        return nullptr;
    }

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

        if (arg_count == 2)
        {
            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.Foundation.Metadata.ApiInformation", L"IsApiContractPresent", 2);
                }

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

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

                return py::convert([&]()
                {
                    auto _gil = release_gil();
                    return winrt::Windows::Foundation::Metadata::ApiInformation::IsApiContractPresent(param0, param1);
                }());
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

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

        if (arg_count == 3)
        {
            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.Foundation.Metadata.ApiInformation", L"IsApiContractPresent", 3);
                }

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

                auto param0 = py::convert_to<winrt::hstring>(args, 0);
                auto param1 = py::convert_to<uint16_t>(args, 1);
                auto param2 = py::convert_to<uint16_t>(args, 2);

                return py::convert([&]()
                {
                    auto _gil = release_gil();
                    return winrt::Windows::Foundation::Metadata::ApiInformation::IsApiContractPresent(param0, param1, param2);
                }());
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

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

        if (arg_count == 2)
        {
            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.Foundation.Metadata.ApiInformation", L"IsEnumNamedValuePresent", 2);
                }

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

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

                return py::convert([&]()
                {
                    auto _gil = release_gil();
                    return winrt::Windows::Foundation::Metadata::ApiInformation::IsEnumNamedValuePresent(param0, param1);
                }());
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

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

        if (arg_count == 2)
        {
            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.Foundation.Metadata.ApiInformation", L"IsEventPresent", 2);
                }

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

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

                return py::convert([&]()
                {
                    auto _gil = release_gil();
                    return winrt::Windows::Foundation::Metadata::ApiInformation::IsEventPresent(param0, param1);
                }());
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

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

        if (arg_count == 2)
        {
            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.Foundation.Metadata.ApiInformation", L"IsMethodPresent", 2);
                }

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

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

                return py::convert([&]()
                {
                    auto _gil = release_gil();
                    return winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(param0, param1);
                }());
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

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

        if (arg_count == 3)
        {
            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.Foundation.Metadata.ApiInformation", L"IsMethodPresent", 3);
                }

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

                auto param0 = py::convert_to<winrt::hstring>(args, 0);
                auto param1 = py::convert_to<winrt::hstring>(args, 1);
                auto param2 = py::convert_to<uint32_t>(args, 2);

                return py::convert([&]()
                {
                    auto _gil = release_gil();
                    return winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(param0, param1, param2);
                }());
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

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

        if (arg_count == 2)
        {
            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.Foundation.Metadata.ApiInformation", L"IsPropertyPresent", 2);
                }

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

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

                return py::convert([&]()
                {
                    auto _gil = release_gil();
                    return winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(param0, param1);
                }());
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

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

        if (arg_count == 2)
        {
            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.Foundation.Metadata.ApiInformation", L"IsReadOnlyPropertyPresent", 2);
                }

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

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

                return py::convert([&]()
                {
                    auto _gil = release_gil();
                    return winrt::Windows::Foundation::Metadata::ApiInformation::IsReadOnlyPropertyPresent(param0, param1);
                }());
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* ApiInformation_IsTypePresent(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.Foundation.Metadata.ApiInformation", L"IsTypePresent", 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::Foundation::Metadata::ApiInformation::IsTypePresent(param0);
                }());
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

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

        if (arg_count == 2)
        {
            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.Foundation.Metadata.ApiInformation", L"IsWriteablePropertyPresent", 2);
                }

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

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

                return py::convert([&]()
                {
                    auto _gil = release_gil();
                    return winrt::Windows::Foundation::Metadata::ApiInformation::IsWriteablePropertyPresent(param0, param1);
                }());
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyMethodDef _methods_ApiInformation[] = {
        { }};

    static PyGetSetDef _getset_ApiInformation[] = {
        { }};

    static PyType_Slot _type_slots_ApiInformation[] = {
        { Py_tp_new, reinterpret_cast<void*>(_new_ApiInformation) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_ApiInformation) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_ApiInformation) },
        { }};

    static PyType_Spec type_spec_ApiInformation = {
        "winrt._winrt_windows_foundation_metadata.ApiInformation",
        0,
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_ApiInformation};

    static PyGetSetDef getset_ApiInformation_Static[] = {
        { }};

    static PyMethodDef methods_ApiInformation_Static[] = {
        { "is_api_contract_present_by_major", reinterpret_cast<PyCFunction>(ApiInformation_IsApiContractPresentByMajor), METH_VARARGS, nullptr },
        { "is_api_contract_present_by_major_and_minor", reinterpret_cast<PyCFunction>(ApiInformation_IsApiContractPresentByMajorAndMinor), METH_VARARGS, nullptr },
        { "is_enum_named_value_present", reinterpret_cast<PyCFunction>(ApiInformation_IsEnumNamedValuePresent), METH_VARARGS, nullptr },
        { "is_event_present", reinterpret_cast<PyCFunction>(ApiInformation_IsEventPresent), METH_VARARGS, nullptr },
        { "is_method_present", reinterpret_cast<PyCFunction>(ApiInformation_IsMethodPresent), METH_VARARGS, nullptr },
        { "is_method_present_with_arity", reinterpret_cast<PyCFunction>(ApiInformation_IsMethodPresentWithArity), METH_VARARGS, nullptr },
        { "is_property_present", reinterpret_cast<PyCFunction>(ApiInformation_IsPropertyPresent), METH_VARARGS, nullptr },
        { "is_read_only_property_present", reinterpret_cast<PyCFunction>(ApiInformation_IsReadOnlyPropertyPresent), METH_VARARGS, nullptr },
        { "is_type_present", reinterpret_cast<PyCFunction>(ApiInformation_IsTypePresent), METH_VARARGS, nullptr },
        { "is_writeable_property_present", reinterpret_cast<PyCFunction>(ApiInformation_IsWriteablePropertyPresent), METH_VARARGS, nullptr },
        { }};

    static PyType_Slot type_slots_ApiInformation_Static[] = 
    {
        { Py_tp_base, reinterpret_cast<void*>(&PyType_Type) },
        { Py_tp_getset, reinterpret_cast<void*>(getset_ApiInformation_Static) },
        { Py_tp_methods, reinterpret_cast<void*>(methods_ApiInformation_Static) },
        { }
    };

    static PyType_Spec type_spec_ApiInformation_Static = {
        "winrt._winrt_windows_foundation_metadata.ApiInformation_Static",
        static_cast<int>(PyType_Type.tp_basicsize),
        static_cast<int>(PyType_Type.tp_itemsize),
        Py_TPFLAGS_DEFAULT,
        type_slots_ApiInformation_Static};

    // ----- Windows.Foundation.Metadata Initialization --------------------

    PyDoc_STRVAR(module_doc, "Windows.Foundation.Metadata");

    static PyModuleDef module_def = {
        PyModuleDef_HEAD_INIT,
        "_winrt_windows_foundation_metadata",
        module_doc,
        0,
        nullptr,
        nullptr,
        nullptr,
        nullptr,
        nullptr};
} // py::cpp::Windows::Foundation::Metadata

PyMODINIT_FUNC PyInit__winrt_windows_foundation_metadata(void) noexcept
{
    using namespace py::cpp::Windows::Foundation::Metadata;

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

    py::pyobj_handle type_ApiInformation_Static{PyType_FromSpecWithBases(&type_spec_ApiInformation_Static, ApiInformation_Static_bases.get())};
    if (!type_ApiInformation_Static)
    {
        return nullptr;
    }

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


    return module.detach();
}
