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

#include "py.Windows.Security.Authentication.Identity.h"

namespace py::cpp::Windows::Security::Authentication::Identity
{
    // ----- EnterpriseKeyCredentialRegistrationInfo class --------------------

    static PyObject* _new_EnterpriseKeyCredentialRegistrationInfo(PyTypeObject* /*unused*/, PyObject* /*unused*/, PyObject* /*unused*/) noexcept
    {
        static_assert(py::py_type<winrt::Windows::Security::Authentication::Identity::EnterpriseKeyCredentialRegistrationInfo>::type_name);
        py::set_invalid_activation_error(py::py_type<winrt::Windows::Security::Authentication::Identity::EnterpriseKeyCredentialRegistrationInfo>::type_name);
        return nullptr;
    }

    static void _dealloc_EnterpriseKeyCredentialRegistrationInfo(py::wrapper::Windows::Security::Authentication::Identity::EnterpriseKeyCredentialRegistrationInfo* self) noexcept
    {
        auto tp = Py_TYPE(self);
        std::destroy_at(&self->obj);
        tp->tp_free(self);
        Py_DECREF(tp);
    }

    static PyObject* EnterpriseKeyCredentialRegistrationInfo_get_KeyId(py::wrapper::Windows::Security::Authentication::Identity::EnterpriseKeyCredentialRegistrationInfo* self, void* /*unused*/) noexcept
    {
        try
        {
            static std::optional<bool> is_property_present{};

            if (!is_property_present.has_value())
            {
                is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Security.Authentication.Identity.EnterpriseKeyCredentialRegistrationInfo", L"KeyId");
            }

            if (!is_property_present.value())
            {
                PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
                return nullptr;
            }

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

    static PyObject* EnterpriseKeyCredentialRegistrationInfo_get_KeyName(py::wrapper::Windows::Security::Authentication::Identity::EnterpriseKeyCredentialRegistrationInfo* self, void* /*unused*/) noexcept
    {
        try
        {
            static std::optional<bool> is_property_present{};

            if (!is_property_present.has_value())
            {
                is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Security.Authentication.Identity.EnterpriseKeyCredentialRegistrationInfo", L"KeyName");
            }

            if (!is_property_present.value())
            {
                PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
                return nullptr;
            }

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

    static PyObject* EnterpriseKeyCredentialRegistrationInfo_get_Subject(py::wrapper::Windows::Security::Authentication::Identity::EnterpriseKeyCredentialRegistrationInfo* self, void* /*unused*/) noexcept
    {
        try
        {
            static std::optional<bool> is_property_present{};

            if (!is_property_present.has_value())
            {
                is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Security.Authentication.Identity.EnterpriseKeyCredentialRegistrationInfo", L"Subject");
            }

            if (!is_property_present.value())
            {
                PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
                return nullptr;
            }

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

    static PyObject* EnterpriseKeyCredentialRegistrationInfo_get_TenantId(py::wrapper::Windows::Security::Authentication::Identity::EnterpriseKeyCredentialRegistrationInfo* self, void* /*unused*/) noexcept
    {
        try
        {
            static std::optional<bool> is_property_present{};

            if (!is_property_present.has_value())
            {
                is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Security.Authentication.Identity.EnterpriseKeyCredentialRegistrationInfo", L"TenantId");
            }

            if (!is_property_present.value())
            {
                PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
                return nullptr;
            }

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

    static PyObject* EnterpriseKeyCredentialRegistrationInfo_get_TenantName(py::wrapper::Windows::Security::Authentication::Identity::EnterpriseKeyCredentialRegistrationInfo* self, void* /*unused*/) noexcept
    {
        try
        {
            static std::optional<bool> is_property_present{};

            if (!is_property_present.has_value())
            {
                is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Security.Authentication.Identity.EnterpriseKeyCredentialRegistrationInfo", L"TenantName");
            }

            if (!is_property_present.value())
            {
                PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
                return nullptr;
            }

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

    static PyObject* _assign_array_EnterpriseKeyCredentialRegistrationInfo(PyObject* /*unused*/, PyObject* arg) noexcept
    {
        auto array = std::make_unique<py::ComArray<winrt::Windows::Security::Authentication::Identity::EnterpriseKeyCredentialRegistrationInfo>>();
        if (!py::cpp::_winrt::Array_Assign(arg, std::move(array)))
        {
            return nullptr;
        }
        Py_RETURN_NONE;
    }

    static PyObject* _from_EnterpriseKeyCredentialRegistrationInfo(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::Security::Authentication::Identity::EnterpriseKeyCredentialRegistrationInfo>());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyMethodDef _methods_EnterpriseKeyCredentialRegistrationInfo[] = {
        { "_assign_array_", _assign_array_EnterpriseKeyCredentialRegistrationInfo, METH_O | METH_STATIC, nullptr },
        { "_from", reinterpret_cast<PyCFunction>(_from_EnterpriseKeyCredentialRegistrationInfo), METH_O | METH_STATIC, nullptr },
        { }
    };

    static PyGetSetDef _getset_EnterpriseKeyCredentialRegistrationInfo[] = {
        { "key_id", reinterpret_cast<getter>(EnterpriseKeyCredentialRegistrationInfo_get_KeyId), nullptr, nullptr, nullptr },
        { "key_name", reinterpret_cast<getter>(EnterpriseKeyCredentialRegistrationInfo_get_KeyName), nullptr, nullptr, nullptr },
        { "subject", reinterpret_cast<getter>(EnterpriseKeyCredentialRegistrationInfo_get_Subject), nullptr, nullptr, nullptr },
        { "tenant_id", reinterpret_cast<getter>(EnterpriseKeyCredentialRegistrationInfo_get_TenantId), nullptr, nullptr, nullptr },
        { "tenant_name", reinterpret_cast<getter>(EnterpriseKeyCredentialRegistrationInfo_get_TenantName), nullptr, nullptr, nullptr },
        { }
    };

    static PyType_Slot _type_slots_EnterpriseKeyCredentialRegistrationInfo[] = {
        { Py_tp_new, reinterpret_cast<void*>(_new_EnterpriseKeyCredentialRegistrationInfo) },
        { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_EnterpriseKeyCredentialRegistrationInfo) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_EnterpriseKeyCredentialRegistrationInfo) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_EnterpriseKeyCredentialRegistrationInfo) },
        { }
    };

    static PyType_Spec type_spec_EnterpriseKeyCredentialRegistrationInfo = {
        "winrt._winrt_windows_security_authentication_identity.EnterpriseKeyCredentialRegistrationInfo",
        sizeof(py::wrapper::Windows::Security::Authentication::Identity::EnterpriseKeyCredentialRegistrationInfo),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_EnterpriseKeyCredentialRegistrationInfo};

    // ----- EnterpriseKeyCredentialRegistrationManager class --------------------

    static PyObject* _new_EnterpriseKeyCredentialRegistrationManager(PyTypeObject* /*unused*/, PyObject* /*unused*/, PyObject* /*unused*/) noexcept
    {
        static_assert(py::py_type<winrt::Windows::Security::Authentication::Identity::EnterpriseKeyCredentialRegistrationManager>::type_name);
        py::set_invalid_activation_error(py::py_type<winrt::Windows::Security::Authentication::Identity::EnterpriseKeyCredentialRegistrationManager>::type_name);
        return nullptr;
    }

    static void _dealloc_EnterpriseKeyCredentialRegistrationManager(py::wrapper::Windows::Security::Authentication::Identity::EnterpriseKeyCredentialRegistrationManager* self) noexcept
    {
        auto tp = Py_TYPE(self);
        std::destroy_at(&self->obj);
        tp->tp_free(self);
        Py_DECREF(tp);
    }

    static PyObject* EnterpriseKeyCredentialRegistrationManager_GetRegistrationsAsync(py::wrapper::Windows::Security::Authentication::Identity::EnterpriseKeyCredentialRegistrationManager* self, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_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"Windows.Security.Authentication.Identity.EnterpriseKeyCredentialRegistrationManager", L"GetRegistrationsAsync", 0);
                }

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

                return py::convert(self->obj.GetRegistrationsAsync());
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* EnterpriseKeyCredentialRegistrationManager_get_Current(PyObject* /*unused*/, void* /*unused*/) noexcept
    {
        try
        {
            static std::optional<bool> is_property_present{};

            if (!is_property_present.has_value())
            {
                is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Security.Authentication.Identity.EnterpriseKeyCredentialRegistrationManager", L"Current");
            }

            if (!is_property_present.value())
            {
                PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
                return nullptr;
            }

            return py::convert(winrt::Windows::Security::Authentication::Identity::EnterpriseKeyCredentialRegistrationManager::Current());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* _assign_array_EnterpriseKeyCredentialRegistrationManager(PyObject* /*unused*/, PyObject* arg) noexcept
    {
        auto array = std::make_unique<py::ComArray<winrt::Windows::Security::Authentication::Identity::EnterpriseKeyCredentialRegistrationManager>>();
        if (!py::cpp::_winrt::Array_Assign(arg, std::move(array)))
        {
            return nullptr;
        }
        Py_RETURN_NONE;
    }

    static PyObject* _from_EnterpriseKeyCredentialRegistrationManager(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::Security::Authentication::Identity::EnterpriseKeyCredentialRegistrationManager>());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyMethodDef _methods_EnterpriseKeyCredentialRegistrationManager[] = {
        { "get_registrations_async", reinterpret_cast<PyCFunction>(EnterpriseKeyCredentialRegistrationManager_GetRegistrationsAsync), METH_VARARGS, nullptr },
        { "_assign_array_", _assign_array_EnterpriseKeyCredentialRegistrationManager, METH_O | METH_STATIC, nullptr },
        { "_from", reinterpret_cast<PyCFunction>(_from_EnterpriseKeyCredentialRegistrationManager), METH_O | METH_STATIC, nullptr },
        { }
    };

    static PyGetSetDef _getset_EnterpriseKeyCredentialRegistrationManager[] = {
        { }
    };

    static PyType_Slot _type_slots_EnterpriseKeyCredentialRegistrationManager[] = {
        { Py_tp_new, reinterpret_cast<void*>(_new_EnterpriseKeyCredentialRegistrationManager) },
        { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_EnterpriseKeyCredentialRegistrationManager) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_EnterpriseKeyCredentialRegistrationManager) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_EnterpriseKeyCredentialRegistrationManager) },
        { }
    };

    static PyType_Spec type_spec_EnterpriseKeyCredentialRegistrationManager = {
        "winrt._winrt_windows_security_authentication_identity.EnterpriseKeyCredentialRegistrationManager",
        sizeof(py::wrapper::Windows::Security::Authentication::Identity::EnterpriseKeyCredentialRegistrationManager),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_EnterpriseKeyCredentialRegistrationManager};

    static PyGetSetDef getset_EnterpriseKeyCredentialRegistrationManager_Static[] = {
        { "current", reinterpret_cast<getter>(EnterpriseKeyCredentialRegistrationManager_get_Current), nullptr, nullptr, nullptr },
        { }
    };

    static PyMethodDef methods_EnterpriseKeyCredentialRegistrationManager_Static[] = {
        { }
    };

    static PyType_Slot type_slots_EnterpriseKeyCredentialRegistrationManager_Static[] = 
    {
        { Py_tp_base, reinterpret_cast<void*>(&PyType_Type) },
        { Py_tp_getset, reinterpret_cast<void*>(getset_EnterpriseKeyCredentialRegistrationManager_Static) },
        { Py_tp_methods, reinterpret_cast<void*>(methods_EnterpriseKeyCredentialRegistrationManager_Static) },
        { }
    };

    static PyType_Spec type_spec_EnterpriseKeyCredentialRegistrationManager_Static =
    {
        "winrt._winrt_windows_security_authentication_identity.EnterpriseKeyCredentialRegistrationManager_Static",
        static_cast<int>(PyType_Type.tp_basicsize),
        static_cast<int>(PyType_Type.tp_itemsize),
        Py_TPFLAGS_DEFAULT,
        type_slots_EnterpriseKeyCredentialRegistrationManager_Static
    };

    // ----- Windows.Security.Authentication.Identity Initialization --------------------

    PyDoc_STRVAR(module_doc, "Windows.Security.Authentication.Identity");

    static PyModuleDef module_def = {
        PyModuleDef_HEAD_INIT,
        "_winrt_windows_security_authentication_identity",
        module_doc,
        0,
        nullptr,
        nullptr,
        nullptr,
        nullptr,
        nullptr};
} // py::cpp::Windows::Security::Authentication::Identity

PyMODINIT_FUNC PyInit__winrt_windows_security_authentication_identity(void) noexcept
{
    using namespace py::cpp::Windows::Security::Authentication::Identity;

    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::pytype_handle EnterpriseKeyCredentialRegistrationInfo_type{py::register_python_type(module.get(), &type_spec_EnterpriseKeyCredentialRegistrationInfo, object_bases.get(), nullptr)};
    if (!EnterpriseKeyCredentialRegistrationInfo_type)
    {
        return nullptr;
    }

    py::pyobj_handle type_EnterpriseKeyCredentialRegistrationManager_Static{PyType_FromSpec(&type_spec_EnterpriseKeyCredentialRegistrationManager_Static)};
    if (!type_EnterpriseKeyCredentialRegistrationManager_Static)
    {
        return nullptr;
    }

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


    return module.detach();
}
