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

#include "py.Microsoft.UI.Xaml.XamlTypeInfo.h"

namespace py::cpp::Microsoft::UI::Xaml::XamlTypeInfo
{
    // ----- XamlControlsXamlMetaDataProvider class --------------------

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

        auto arg_count = PyTuple_GET_SIZE(args);
        if (arg_count == 0)
        {
            try
            {
                winrt::Microsoft::UI::Xaml::XamlTypeInfo::XamlControlsXamlMetaDataProvider 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_XamlControlsXamlMetaDataProvider(py::wrapper::Microsoft::UI::Xaml::XamlTypeInfo::XamlControlsXamlMetaDataProvider* self) noexcept
    {
        auto tp = Py_TYPE(self);
        std::destroy_at(&self->obj);
        tp->tp_free(self);
        Py_DECREF(tp);
    }

    static PyObject* XamlControlsXamlMetaDataProvider_GetXamlType(py::wrapper::Microsoft::UI::Xaml::XamlTypeInfo::XamlControlsXamlMetaDataProvider* 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"Microsoft.UI.Xaml.XamlTypeInfo.XamlControlsXamlMetaDataProvider", L"GetXamlType", 1);
                }

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

                auto param0 = py::convert_to<winrt::Windows::UI::Xaml::Interop::TypeName>(args, 0);

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

    static PyObject* XamlControlsXamlMetaDataProvider_GetXamlTypeByFullName(py::wrapper::Microsoft::UI::Xaml::XamlTypeInfo::XamlControlsXamlMetaDataProvider* 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"Microsoft.UI.Xaml.XamlTypeInfo.XamlControlsXamlMetaDataProvider", L"GetXamlType", 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.GetXamlType(param0);
                }());
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* XamlControlsXamlMetaDataProvider_GetXmlnsDefinitions(py::wrapper::Microsoft::UI::Xaml::XamlTypeInfo::XamlControlsXamlMetaDataProvider* 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"Microsoft.UI.Xaml.XamlTypeInfo.XamlControlsXamlMetaDataProvider", L"GetXmlnsDefinitions", 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.GetXmlnsDefinitions();
                }());
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* XamlControlsXamlMetaDataProvider_Initialize(PyObject* /*unused*/, 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"Microsoft.UI.Xaml.XamlTypeInfo.XamlControlsXamlMetaDataProvider", L"Initialize", 0);
                }

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

                {
                    auto _gil = release_gil();
                    winrt::Microsoft::UI::Xaml::XamlTypeInfo::XamlControlsXamlMetaDataProvider::Initialize();
                }

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

    static PyObject* _assign_array_XamlControlsXamlMetaDataProvider(PyObject* /*unused*/, PyObject* arg) noexcept
    {
        auto array = std::make_unique<py::ComArray<winrt::Microsoft::UI::Xaml::XamlTypeInfo::XamlControlsXamlMetaDataProvider>>();
        if (!py::cpp::_winrt::Array_Assign(arg, std::move(array)))
        {
            return nullptr;
        }
        Py_RETURN_NONE;
    }

    static PyObject* _from_XamlControlsXamlMetaDataProvider(PyObject* /*unused*/, PyObject* arg) noexcept
    {
        try
        {
            auto return_value = py::convert_to<winrt::Windows::Foundation::IInspectable>(arg);
            return py::convert(return_value.as<winrt::Microsoft::UI::Xaml::XamlTypeInfo::XamlControlsXamlMetaDataProvider>());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyMethodDef _methods_XamlControlsXamlMetaDataProvider[] = {
        { "get_xaml_type", reinterpret_cast<PyCFunction>(XamlControlsXamlMetaDataProvider_GetXamlType), METH_VARARGS, nullptr },
        { "get_xaml_type_by_full_name", reinterpret_cast<PyCFunction>(XamlControlsXamlMetaDataProvider_GetXamlTypeByFullName), METH_VARARGS, nullptr },
        { "get_xmlns_definitions", reinterpret_cast<PyCFunction>(XamlControlsXamlMetaDataProvider_GetXmlnsDefinitions), METH_VARARGS, nullptr },
        { "_assign_array_", _assign_array_XamlControlsXamlMetaDataProvider, METH_O | METH_STATIC, nullptr },
        { "_from", reinterpret_cast<PyCFunction>(_from_XamlControlsXamlMetaDataProvider), METH_O | METH_STATIC, nullptr },
        { }};

    static PyGetSetDef _getset_XamlControlsXamlMetaDataProvider[] = {
        { }};

    static PyType_Slot _type_slots_XamlControlsXamlMetaDataProvider[] = {
        { Py_tp_new, reinterpret_cast<void*>(_new_XamlControlsXamlMetaDataProvider) },
        { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_XamlControlsXamlMetaDataProvider) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_XamlControlsXamlMetaDataProvider) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_XamlControlsXamlMetaDataProvider) },
        { }};

    static PyType_Spec type_spec_XamlControlsXamlMetaDataProvider = {
        "winui2._winui2_microsoft_ui_xaml_xamltypeinfo.XamlControlsXamlMetaDataProvider",
        sizeof(py::wrapper::Microsoft::UI::Xaml::XamlTypeInfo::XamlControlsXamlMetaDataProvider),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_XamlControlsXamlMetaDataProvider};

    static PyGetSetDef getset_XamlControlsXamlMetaDataProvider_Static[] = {
        { }};

    static PyMethodDef methods_XamlControlsXamlMetaDataProvider_Static[] = {
        { "initialize", reinterpret_cast<PyCFunction>(XamlControlsXamlMetaDataProvider_Initialize), METH_VARARGS, nullptr },
        { }};

    static PyType_Slot type_slots_XamlControlsXamlMetaDataProvider_Static[] = 
    {
        { Py_tp_base, reinterpret_cast<void*>(&PyType_Type) },
        { Py_tp_getset, reinterpret_cast<void*>(getset_XamlControlsXamlMetaDataProvider_Static) },
        { Py_tp_methods, reinterpret_cast<void*>(methods_XamlControlsXamlMetaDataProvider_Static) },
        { }
    };

    static PyType_Spec type_spec_XamlControlsXamlMetaDataProvider_Static = {
        "winui2._winui2_microsoft_ui_xaml_xamltypeinfo.XamlControlsXamlMetaDataProvider_Static",
        static_cast<int>(PyType_Type.tp_basicsize),
        static_cast<int>(PyType_Type.tp_itemsize),
        Py_TPFLAGS_DEFAULT,
        type_slots_XamlControlsXamlMetaDataProvider_Static};

    // ----- Microsoft.UI.Xaml.XamlTypeInfo Initialization --------------------

    PyDoc_STRVAR(module_doc, "Microsoft.UI.Xaml.XamlTypeInfo");

    static PyModuleDef module_def = {
        PyModuleDef_HEAD_INIT,
        "_winui2_microsoft_ui_xaml_xamltypeinfo",
        module_doc,
        0,
        nullptr,
        nullptr,
        nullptr,
        nullptr,
        nullptr};
} // py::cpp::Microsoft::UI::Xaml::XamlTypeInfo

PyMODINIT_FUNC PyInit__winui2_microsoft_ui_xaml_xamltypeinfo(void) noexcept
{
    using namespace py::cpp::Microsoft::UI::Xaml::XamlTypeInfo;

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

    py::pyobj_handle type_XamlControlsXamlMetaDataProvider_Static{PyType_FromSpecWithBases(&type_spec_XamlControlsXamlMetaDataProvider_Static, XamlControlsXamlMetaDataProvider_Static_bases.get())};
    if (!type_XamlControlsXamlMetaDataProvider_Static)
    {
        return nullptr;
    }

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


    return module.detach();
}
