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

#include "py.Windows.Devices.Background.h"

namespace py::cpp::Windows::Devices::Background
{
    // ----- DeviceServicingDetails class --------------------

    static PyObject* _new_DeviceServicingDetails(PyTypeObject* /*unused*/, PyObject* /*unused*/, PyObject* /*unused*/) noexcept
    {
        static_assert(py::py_type<winrt::Windows::Devices::Background::DeviceServicingDetails>::type_name);
        py::set_invalid_activation_error(py::py_type<winrt::Windows::Devices::Background::DeviceServicingDetails>::type_name);
        return nullptr;
    }

    static void _dealloc_DeviceServicingDetails(py::wrapper::Windows::Devices::Background::DeviceServicingDetails* self) noexcept
    {
        auto tp = Py_TYPE(self);
        std::destroy_at(&self->obj);
        tp->tp_free(self);
        Py_DECREF(tp);
    }

    static PyObject* DeviceServicingDetails_get_Arguments(py::wrapper::Windows::Devices::Background::DeviceServicingDetails* 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.Devices.Background.DeviceServicingDetails", L"Arguments");
            }

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

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

    static PyObject* DeviceServicingDetails_get_DeviceId(py::wrapper::Windows::Devices::Background::DeviceServicingDetails* 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.Devices.Background.DeviceServicingDetails", L"DeviceId");
            }

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

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

    static PyObject* DeviceServicingDetails_get_ExpectedDuration(py::wrapper::Windows::Devices::Background::DeviceServicingDetails* 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.Devices.Background.DeviceServicingDetails", L"ExpectedDuration");
            }

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

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

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

    static PyObject* _from_DeviceServicingDetails(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::Devices::Background::DeviceServicingDetails>());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyMethodDef _methods_DeviceServicingDetails[] = {
        { "_assign_array_", _assign_array_DeviceServicingDetails, METH_O | METH_STATIC, nullptr },
        { "_from", reinterpret_cast<PyCFunction>(_from_DeviceServicingDetails), METH_O | METH_STATIC, nullptr },
        { }};

    static PyGetSetDef _getset_DeviceServicingDetails[] = {
        { "arguments", reinterpret_cast<getter>(DeviceServicingDetails_get_Arguments), nullptr, nullptr, nullptr },
        { "device_id", reinterpret_cast<getter>(DeviceServicingDetails_get_DeviceId), nullptr, nullptr, nullptr },
        { "expected_duration", reinterpret_cast<getter>(DeviceServicingDetails_get_ExpectedDuration), nullptr, nullptr, nullptr },
        { }};

    static PyType_Slot _type_slots_DeviceServicingDetails[] = {
        { Py_tp_new, reinterpret_cast<void*>(_new_DeviceServicingDetails) },
        { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_DeviceServicingDetails) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_DeviceServicingDetails) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_DeviceServicingDetails) },
        { }};

    static PyType_Spec type_spec_DeviceServicingDetails = {
        "winrt._winrt_windows_devices_background.DeviceServicingDetails",
        sizeof(py::wrapper::Windows::Devices::Background::DeviceServicingDetails),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_DeviceServicingDetails};

    // ----- DeviceUseDetails class --------------------

    static PyObject* _new_DeviceUseDetails(PyTypeObject* /*unused*/, PyObject* /*unused*/, PyObject* /*unused*/) noexcept
    {
        static_assert(py::py_type<winrt::Windows::Devices::Background::DeviceUseDetails>::type_name);
        py::set_invalid_activation_error(py::py_type<winrt::Windows::Devices::Background::DeviceUseDetails>::type_name);
        return nullptr;
    }

    static void _dealloc_DeviceUseDetails(py::wrapper::Windows::Devices::Background::DeviceUseDetails* self) noexcept
    {
        auto tp = Py_TYPE(self);
        std::destroy_at(&self->obj);
        tp->tp_free(self);
        Py_DECREF(tp);
    }

    static PyObject* DeviceUseDetails_get_Arguments(py::wrapper::Windows::Devices::Background::DeviceUseDetails* 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.Devices.Background.DeviceUseDetails", L"Arguments");
            }

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

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

    static PyObject* DeviceUseDetails_get_DeviceId(py::wrapper::Windows::Devices::Background::DeviceUseDetails* 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.Devices.Background.DeviceUseDetails", L"DeviceId");
            }

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

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

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

    static PyObject* _from_DeviceUseDetails(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::Devices::Background::DeviceUseDetails>());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyMethodDef _methods_DeviceUseDetails[] = {
        { "_assign_array_", _assign_array_DeviceUseDetails, METH_O | METH_STATIC, nullptr },
        { "_from", reinterpret_cast<PyCFunction>(_from_DeviceUseDetails), METH_O | METH_STATIC, nullptr },
        { }};

    static PyGetSetDef _getset_DeviceUseDetails[] = {
        { "arguments", reinterpret_cast<getter>(DeviceUseDetails_get_Arguments), nullptr, nullptr, nullptr },
        { "device_id", reinterpret_cast<getter>(DeviceUseDetails_get_DeviceId), nullptr, nullptr, nullptr },
        { }};

    static PyType_Slot _type_slots_DeviceUseDetails[] = {
        { Py_tp_new, reinterpret_cast<void*>(_new_DeviceUseDetails) },
        { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_DeviceUseDetails) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_DeviceUseDetails) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_DeviceUseDetails) },
        { }};

    static PyType_Spec type_spec_DeviceUseDetails = {
        "winrt._winrt_windows_devices_background.DeviceUseDetails",
        sizeof(py::wrapper::Windows::Devices::Background::DeviceUseDetails),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_DeviceUseDetails};

    // ----- Windows.Devices.Background Initialization --------------------

    PyDoc_STRVAR(module_doc, "Windows.Devices.Background");

    static PyModuleDef module_def = {
        PyModuleDef_HEAD_INIT,
        "_winrt_windows_devices_background",
        module_doc,
        0,
        nullptr,
        nullptr,
        nullptr,
        nullptr,
        nullptr};
} // py::cpp::Windows::Devices::Background

PyMODINIT_FUNC PyInit__winrt_windows_devices_background(void) noexcept
{
    using namespace py::cpp::Windows::Devices::Background;

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

    py::pytype_handle DeviceUseDetails_type{py::register_python_type(module.get(), &type_spec_DeviceUseDetails, object_bases.get(), inspectable_meta_type)};
    if (!DeviceUseDetails_type)
    {
        return nullptr;
    }


    return module.detach();
}
