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

#include "py.Windows.Management.Core.h"

namespace py::cpp::Windows::Management::Core
{
    // ----- ApplicationDataManager class --------------------

    static PyObject* _new_ApplicationDataManager(PyTypeObject* /*unused*/, PyObject* /*unused*/, PyObject* /*unused*/) noexcept
    {
        static_assert(py::py_type<winrt::Windows::Management::Core::ApplicationDataManager>::type_name);
        py::set_invalid_activation_error(py::py_type<winrt::Windows::Management::Core::ApplicationDataManager>::type_name);
        return nullptr;
    }

    static void _dealloc_ApplicationDataManager(py::wrapper::Windows::Management::Core::ApplicationDataManager* self) noexcept
    {
        auto tp = Py_TYPE(self);
        std::destroy_at(&self->obj);
        tp->tp_free(self);
        Py_DECREF(tp);
    }

    static PyObject* ApplicationDataManager_CreateForPackageFamily(PyObject* /*unused*/, 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.Management.Core.ApplicationDataManager", L"CreateForPackageFamily", 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(winrt::Windows::Management::Core::ApplicationDataManager::CreateForPackageFamily(param0));
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

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

    static PyObject* _from_ApplicationDataManager(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::Management::Core::ApplicationDataManager>());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyMethodDef _methods_ApplicationDataManager[] = {
        { "_assign_array_", _assign_array_ApplicationDataManager, METH_O | METH_STATIC, nullptr },
        { "_from", reinterpret_cast<PyCFunction>(_from_ApplicationDataManager), METH_O | METH_STATIC, nullptr },
        { }
    };

    static PyGetSetDef _getset_ApplicationDataManager[] = {
        { }
    };

    static PyType_Slot _type_slots_ApplicationDataManager[] = {
        { Py_tp_new, reinterpret_cast<void*>(_new_ApplicationDataManager) },
        { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_ApplicationDataManager) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_ApplicationDataManager) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_ApplicationDataManager) },
        { }
    };

    static PyType_Spec type_spec_ApplicationDataManager = {
        "winrt._winrt_windows_management_core.ApplicationDataManager",
        sizeof(py::wrapper::Windows::Management::Core::ApplicationDataManager),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_ApplicationDataManager};

    static PyGetSetDef getset_ApplicationDataManager_Static[] = {
        { }
    };

    static PyMethodDef methods_ApplicationDataManager_Static[] = {
        { "create_for_package_family", reinterpret_cast<PyCFunction>(ApplicationDataManager_CreateForPackageFamily), METH_VARARGS, nullptr },
        { }
    };

    static PyType_Slot type_slots_ApplicationDataManager_Static[] = 
    {
        { Py_tp_base, reinterpret_cast<void*>(&PyType_Type) },
        { Py_tp_getset, reinterpret_cast<void*>(getset_ApplicationDataManager_Static) },
        { Py_tp_methods, reinterpret_cast<void*>(methods_ApplicationDataManager_Static) },
        { }
    };

    static PyType_Spec type_spec_ApplicationDataManager_Static =
    {
        "winrt._winrt_windows_management_core.ApplicationDataManager_Static",
        static_cast<int>(PyType_Type.tp_basicsize),
        static_cast<int>(PyType_Type.tp_itemsize),
        Py_TPFLAGS_DEFAULT,
        type_slots_ApplicationDataManager_Static
    };

    // ----- Windows.Management.Core Initialization --------------------

    PyDoc_STRVAR(module_doc, "Windows.Management.Core");

    static PyModuleDef module_def = {
        PyModuleDef_HEAD_INIT,
        "_winrt_windows_management_core",
        module_doc,
        0,
        nullptr,
        nullptr,
        nullptr,
        nullptr,
        nullptr};
} // py::cpp::Windows::Management::Core

PyMODINIT_FUNC PyInit__winrt_windows_management_core(void) noexcept
{
    using namespace py::cpp::Windows::Management::Core;

    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_ApplicationDataManager_Static{PyType_FromSpec(&type_spec_ApplicationDataManager_Static)};
    if (!type_ApplicationDataManager_Static)
    {
        return nullptr;
    }

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


    return module.detach();
}
