// WARNING: Please don't edit this file. It was generated by Python/WinRT v1.0.0-beta.2

#include "pybase.h"
#include "py.Windows.Security.DataProtection.h"

PyTypeObject* py::winrt_type<winrt::Windows::Security::DataProtection::UserDataAvailabilityStateChangedEventArgs>::python_type;
PyTypeObject* py::winrt_type<winrt::Windows::Security::DataProtection::UserDataBufferUnprotectResult>::python_type;
PyTypeObject* py::winrt_type<winrt::Windows::Security::DataProtection::UserDataProtectionManager>::python_type;
PyTypeObject* py::winrt_type<winrt::Windows::Security::DataProtection::UserDataStorageItemProtectionInfo>::python_type;

namespace py::cpp::Windows::Security::DataProtection
{
    // ----- UserDataAvailabilityStateChangedEventArgs class --------------------
    constexpr const char* const _type_name_UserDataAvailabilityStateChangedEventArgs = "UserDataAvailabilityStateChangedEventArgs";

    static PyObject* _new_UserDataAvailabilityStateChangedEventArgs(PyTypeObject* type, PyObject* args, PyObject* kwds) noexcept
    {
        py::set_invalid_activation_error(_type_name_UserDataAvailabilityStateChangedEventArgs);
        return nullptr;
    }

    static void _dealloc_UserDataAvailabilityStateChangedEventArgs(py::wrapper::Windows::Security::DataProtection::UserDataAvailabilityStateChangedEventArgs* self)
    {
        auto hash_value = std::hash<winrt::Windows::Foundation::IInspectable>{}(self->obj);
        py::wrapped_instance(hash_value, nullptr);
        self->obj = nullptr;
    }

    static PyObject* UserDataAvailabilityStateChangedEventArgs_GetDeferral(py::wrapper::Windows::Security::DataProtection::UserDataAvailabilityStateChangedEventArgs* self, PyObject* args) noexcept
    {
        Py_ssize_t arg_count = PyTuple_Size(args);

        if (arg_count == 0)
        {
            try
            {
                return py::convert(self->obj.GetDeferral());
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* _from_UserDataAvailabilityStateChangedEventArgs(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::DataProtection::UserDataAvailabilityStateChangedEventArgs>());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyMethodDef _methods_UserDataAvailabilityStateChangedEventArgs[] = {
        { "get_deferral", reinterpret_cast<PyCFunction>(UserDataAvailabilityStateChangedEventArgs_GetDeferral), METH_VARARGS, nullptr },
        { "_from", reinterpret_cast<PyCFunction>(_from_UserDataAvailabilityStateChangedEventArgs), METH_O | METH_STATIC, nullptr },
        { }
    };

    static PyGetSetDef _getset_UserDataAvailabilityStateChangedEventArgs[] = {
        { }
    };

    static PyType_Slot _type_slots_UserDataAvailabilityStateChangedEventArgs[] = 
    {
        { Py_tp_new, _new_UserDataAvailabilityStateChangedEventArgs },
        { Py_tp_dealloc, _dealloc_UserDataAvailabilityStateChangedEventArgs },
        { Py_tp_methods, _methods_UserDataAvailabilityStateChangedEventArgs },
        { Py_tp_getset, _getset_UserDataAvailabilityStateChangedEventArgs },
        { },
    };

    static PyType_Spec _type_spec_UserDataAvailabilityStateChangedEventArgs =
    {
        "_winsdk_Windows_Security_DataProtection.UserDataAvailabilityStateChangedEventArgs",
        sizeof(py::wrapper::Windows::Security::DataProtection::UserDataAvailabilityStateChangedEventArgs),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_UserDataAvailabilityStateChangedEventArgs
    };

    // ----- UserDataBufferUnprotectResult class --------------------
    constexpr const char* const _type_name_UserDataBufferUnprotectResult = "UserDataBufferUnprotectResult";

    static PyObject* _new_UserDataBufferUnprotectResult(PyTypeObject* type, PyObject* args, PyObject* kwds) noexcept
    {
        py::set_invalid_activation_error(_type_name_UserDataBufferUnprotectResult);
        return nullptr;
    }

    static void _dealloc_UserDataBufferUnprotectResult(py::wrapper::Windows::Security::DataProtection::UserDataBufferUnprotectResult* self)
    {
        auto hash_value = std::hash<winrt::Windows::Foundation::IInspectable>{}(self->obj);
        py::wrapped_instance(hash_value, nullptr);
        self->obj = nullptr;
    }

    static PyObject* UserDataBufferUnprotectResult_get_Status(py::wrapper::Windows::Security::DataProtection::UserDataBufferUnprotectResult* self, void* /*unused*/) noexcept
    {
        try
        {
            return py::convert(self->obj.Status());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* UserDataBufferUnprotectResult_get_UnprotectedBuffer(py::wrapper::Windows::Security::DataProtection::UserDataBufferUnprotectResult* self, void* /*unused*/) noexcept
    {
        try
        {
            return py::convert(self->obj.UnprotectedBuffer());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* _from_UserDataBufferUnprotectResult(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::DataProtection::UserDataBufferUnprotectResult>());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyMethodDef _methods_UserDataBufferUnprotectResult[] = {
        { "_from", reinterpret_cast<PyCFunction>(_from_UserDataBufferUnprotectResult), METH_O | METH_STATIC, nullptr },
        { }
    };

    static PyGetSetDef _getset_UserDataBufferUnprotectResult[] = {
        { "status", reinterpret_cast<getter>(UserDataBufferUnprotectResult_get_Status), nullptr, nullptr, nullptr },
        { "unprotected_buffer", reinterpret_cast<getter>(UserDataBufferUnprotectResult_get_UnprotectedBuffer), nullptr, nullptr, nullptr },
        { }
    };

    static PyType_Slot _type_slots_UserDataBufferUnprotectResult[] = 
    {
        { Py_tp_new, _new_UserDataBufferUnprotectResult },
        { Py_tp_dealloc, _dealloc_UserDataBufferUnprotectResult },
        { Py_tp_methods, _methods_UserDataBufferUnprotectResult },
        { Py_tp_getset, _getset_UserDataBufferUnprotectResult },
        { },
    };

    static PyType_Spec _type_spec_UserDataBufferUnprotectResult =
    {
        "_winsdk_Windows_Security_DataProtection.UserDataBufferUnprotectResult",
        sizeof(py::wrapper::Windows::Security::DataProtection::UserDataBufferUnprotectResult),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_UserDataBufferUnprotectResult
    };

    // ----- UserDataProtectionManager class --------------------
    constexpr const char* const _type_name_UserDataProtectionManager = "UserDataProtectionManager";

    static PyObject* _new_UserDataProtectionManager(PyTypeObject* type, PyObject* args, PyObject* kwds) noexcept
    {
        py::set_invalid_activation_error(_type_name_UserDataProtectionManager);
        return nullptr;
    }

    static void _dealloc_UserDataProtectionManager(py::wrapper::Windows::Security::DataProtection::UserDataProtectionManager* self)
    {
        auto hash_value = std::hash<winrt::Windows::Foundation::IInspectable>{}(self->obj);
        py::wrapped_instance(hash_value, nullptr);
        self->obj = nullptr;
    }

    static PyObject* UserDataProtectionManager_GetStorageItemProtectionInfoAsync(py::wrapper::Windows::Security::DataProtection::UserDataProtectionManager* self, PyObject* args) noexcept
    {
        Py_ssize_t arg_count = PyTuple_Size(args);

        if (arg_count == 1)
        {
            try
            {
                auto param0 = py::convert_to<winrt::Windows::Storage::IStorageItem>(args, 0);

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

    static PyObject* UserDataProtectionManager_IsContinuedDataAvailabilityExpected(py::wrapper::Windows::Security::DataProtection::UserDataProtectionManager* self, PyObject* args) noexcept
    {
        Py_ssize_t arg_count = PyTuple_Size(args);

        if (arg_count == 1)
        {
            try
            {
                auto param0 = py::convert_to<winrt::Windows::Security::DataProtection::UserDataAvailability>(args, 0);

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

    static PyObject* UserDataProtectionManager_ProtectBufferAsync(py::wrapper::Windows::Security::DataProtection::UserDataProtectionManager* self, PyObject* args) noexcept
    {
        Py_ssize_t arg_count = PyTuple_Size(args);

        if (arg_count == 2)
        {
            try
            {
                auto param0 = py::convert_to<winrt::Windows::Storage::Streams::IBuffer>(args, 0);
                auto param1 = py::convert_to<winrt::Windows::Security::DataProtection::UserDataAvailability>(args, 1);

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

    static PyObject* UserDataProtectionManager_ProtectStorageItemAsync(py::wrapper::Windows::Security::DataProtection::UserDataProtectionManager* self, PyObject* args) noexcept
    {
        Py_ssize_t arg_count = PyTuple_Size(args);

        if (arg_count == 2)
        {
            try
            {
                auto param0 = py::convert_to<winrt::Windows::Storage::IStorageItem>(args, 0);
                auto param1 = py::convert_to<winrt::Windows::Security::DataProtection::UserDataAvailability>(args, 1);

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

    static PyObject* UserDataProtectionManager_TryGetDefault(PyObject* /*unused*/, PyObject* args) noexcept
    {
        Py_ssize_t arg_count = PyTuple_Size(args);

        if (arg_count == 0)
        {
            try
            {
                return py::convert(winrt::Windows::Security::DataProtection::UserDataProtectionManager::TryGetDefault());
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* UserDataProtectionManager_TryGetForUser(PyObject* /*unused*/, PyObject* args) noexcept
    {
        Py_ssize_t arg_count = PyTuple_Size(args);

        if (arg_count == 1)
        {
            try
            {
                auto param0 = py::convert_to<winrt::Windows::System::User>(args, 0);

                return py::convert(winrt::Windows::Security::DataProtection::UserDataProtectionManager::TryGetForUser(param0));
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* UserDataProtectionManager_UnprotectBufferAsync(py::wrapper::Windows::Security::DataProtection::UserDataProtectionManager* self, PyObject* args) noexcept
    {
        Py_ssize_t arg_count = PyTuple_Size(args);

        if (arg_count == 1)
        {
            try
            {
                auto param0 = py::convert_to<winrt::Windows::Storage::Streams::IBuffer>(args, 0);

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

    static PyObject* UserDataProtectionManager_add_DataAvailabilityStateChanged(py::wrapper::Windows::Security::DataProtection::UserDataProtectionManager* self, PyObject* arg) noexcept
    {
        try
        {
            auto param0 = py::convert_to<winrt::Windows::Foundation::TypedEventHandler<winrt::Windows::Security::DataProtection::UserDataProtectionManager, winrt::Windows::Security::DataProtection::UserDataAvailabilityStateChangedEventArgs>>(arg);

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

    static PyObject* UserDataProtectionManager_remove_DataAvailabilityStateChanged(py::wrapper::Windows::Security::DataProtection::UserDataProtectionManager* self, PyObject* arg) noexcept
    {
        try
        {
            auto param0 = py::convert_to<winrt::event_token>(arg);

            self->obj.DataAvailabilityStateChanged(param0);
            Py_RETURN_NONE;
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* _from_UserDataProtectionManager(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::DataProtection::UserDataProtectionManager>());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyMethodDef _methods_UserDataProtectionManager[] = {
        { "get_storage_item_protection_info_async", reinterpret_cast<PyCFunction>(UserDataProtectionManager_GetStorageItemProtectionInfoAsync), METH_VARARGS, nullptr },
        { "is_continued_data_availability_expected", reinterpret_cast<PyCFunction>(UserDataProtectionManager_IsContinuedDataAvailabilityExpected), METH_VARARGS, nullptr },
        { "protect_buffer_async", reinterpret_cast<PyCFunction>(UserDataProtectionManager_ProtectBufferAsync), METH_VARARGS, nullptr },
        { "protect_storage_item_async", reinterpret_cast<PyCFunction>(UserDataProtectionManager_ProtectStorageItemAsync), METH_VARARGS, nullptr },
        { "try_get_default", reinterpret_cast<PyCFunction>(UserDataProtectionManager_TryGetDefault), METH_VARARGS | METH_STATIC, nullptr },
        { "try_get_for_user", reinterpret_cast<PyCFunction>(UserDataProtectionManager_TryGetForUser), METH_VARARGS | METH_STATIC, nullptr },
        { "unprotect_buffer_async", reinterpret_cast<PyCFunction>(UserDataProtectionManager_UnprotectBufferAsync), METH_VARARGS, nullptr },
        { "add_data_availability_state_changed", reinterpret_cast<PyCFunction>(UserDataProtectionManager_add_DataAvailabilityStateChanged), METH_O, nullptr },
        { "remove_data_availability_state_changed", reinterpret_cast<PyCFunction>(UserDataProtectionManager_remove_DataAvailabilityStateChanged), METH_O, nullptr },
        { "_from", reinterpret_cast<PyCFunction>(_from_UserDataProtectionManager), METH_O | METH_STATIC, nullptr },
        { }
    };

    static PyGetSetDef _getset_UserDataProtectionManager[] = {
        { }
    };

    static PyType_Slot _type_slots_UserDataProtectionManager[] = 
    {
        { Py_tp_new, _new_UserDataProtectionManager },
        { Py_tp_dealloc, _dealloc_UserDataProtectionManager },
        { Py_tp_methods, _methods_UserDataProtectionManager },
        { Py_tp_getset, _getset_UserDataProtectionManager },
        { },
    };

    static PyType_Spec _type_spec_UserDataProtectionManager =
    {
        "_winsdk_Windows_Security_DataProtection.UserDataProtectionManager",
        sizeof(py::wrapper::Windows::Security::DataProtection::UserDataProtectionManager),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_UserDataProtectionManager
    };

    // ----- UserDataStorageItemProtectionInfo class --------------------
    constexpr const char* const _type_name_UserDataStorageItemProtectionInfo = "UserDataStorageItemProtectionInfo";

    static PyObject* _new_UserDataStorageItemProtectionInfo(PyTypeObject* type, PyObject* args, PyObject* kwds) noexcept
    {
        py::set_invalid_activation_error(_type_name_UserDataStorageItemProtectionInfo);
        return nullptr;
    }

    static void _dealloc_UserDataStorageItemProtectionInfo(py::wrapper::Windows::Security::DataProtection::UserDataStorageItemProtectionInfo* self)
    {
        auto hash_value = std::hash<winrt::Windows::Foundation::IInspectable>{}(self->obj);
        py::wrapped_instance(hash_value, nullptr);
        self->obj = nullptr;
    }

    static PyObject* UserDataStorageItemProtectionInfo_get_Availability(py::wrapper::Windows::Security::DataProtection::UserDataStorageItemProtectionInfo* self, void* /*unused*/) noexcept
    {
        try
        {
            return py::convert(self->obj.Availability());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* _from_UserDataStorageItemProtectionInfo(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::DataProtection::UserDataStorageItemProtectionInfo>());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyMethodDef _methods_UserDataStorageItemProtectionInfo[] = {
        { "_from", reinterpret_cast<PyCFunction>(_from_UserDataStorageItemProtectionInfo), METH_O | METH_STATIC, nullptr },
        { }
    };

    static PyGetSetDef _getset_UserDataStorageItemProtectionInfo[] = {
        { "availability", reinterpret_cast<getter>(UserDataStorageItemProtectionInfo_get_Availability), nullptr, nullptr, nullptr },
        { }
    };

    static PyType_Slot _type_slots_UserDataStorageItemProtectionInfo[] = 
    {
        { Py_tp_new, _new_UserDataStorageItemProtectionInfo },
        { Py_tp_dealloc, _dealloc_UserDataStorageItemProtectionInfo },
        { Py_tp_methods, _methods_UserDataStorageItemProtectionInfo },
        { Py_tp_getset, _getset_UserDataStorageItemProtectionInfo },
        { },
    };

    static PyType_Spec _type_spec_UserDataStorageItemProtectionInfo =
    {
        "_winsdk_Windows_Security_DataProtection.UserDataStorageItemProtectionInfo",
        sizeof(py::wrapper::Windows::Security::DataProtection::UserDataStorageItemProtectionInfo),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_UserDataStorageItemProtectionInfo
    };

    // ----- Windows.Security.DataProtection Initialization --------------------
    static int module_exec(PyObject* module) noexcept
    {
        try
        {
            py::pyobj_handle bases { PyTuple_Pack(1, py::winrt_type<py::Object>::python_type) };

            py::winrt_type<winrt::Windows::Security::DataProtection::UserDataAvailabilityStateChangedEventArgs>::python_type = py::register_python_type(module, _type_name_UserDataAvailabilityStateChangedEventArgs, &_type_spec_UserDataAvailabilityStateChangedEventArgs, bases.get());
            py::winrt_type<winrt::Windows::Security::DataProtection::UserDataBufferUnprotectResult>::python_type = py::register_python_type(module, _type_name_UserDataBufferUnprotectResult, &_type_spec_UserDataBufferUnprotectResult, bases.get());
            py::winrt_type<winrt::Windows::Security::DataProtection::UserDataProtectionManager>::python_type = py::register_python_type(module, _type_name_UserDataProtectionManager, &_type_spec_UserDataProtectionManager, bases.get());
            py::winrt_type<winrt::Windows::Security::DataProtection::UserDataStorageItemProtectionInfo>::python_type = py::register_python_type(module, _type_name_UserDataStorageItemProtectionInfo, &_type_spec_UserDataStorageItemProtectionInfo, bases.get());

            return 0;
        }
        catch (...)
        {
            py::to_PyErr();
            return -1;
        }
    }

    static PyModuleDef_Slot module_slots[] = {{Py_mod_exec, module_exec}, {}};

    PyDoc_STRVAR(module_doc, "Windows.Security.DataProtection");

    static PyModuleDef module_def
        = {PyModuleDef_HEAD_INIT,
           "_winsdk_Windows_Security_DataProtection",
           module_doc,
           0,
           nullptr,
           module_slots,
           nullptr,
           nullptr,
           nullptr};
} // py::cpp::Windows::Security::DataProtection

PyMODINIT_FUNC
PyInit__winsdk_Windows_Security_DataProtection (void) noexcept
{
    return PyModuleDef_Init(&py::cpp::Windows::Security::DataProtection::module_def);
}
