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

#include "py.Microsoft.Windows.AI.h"

namespace py::cpp::Microsoft::Windows::AI
{
    // ----- AIFeatureReadyResult class --------------------

    static PyObject* _new_AIFeatureReadyResult(PyTypeObject* /*unused*/, PyObject* /*unused*/, PyObject* /*unused*/) noexcept
    {
        static_assert(py::py_type<winrt::Microsoft::Windows::AI::AIFeatureReadyResult>::type_name);
        py::set_invalid_activation_error(py::py_type<winrt::Microsoft::Windows::AI::AIFeatureReadyResult>::type_name);
        return nullptr;
    }

    static void _dealloc_AIFeatureReadyResult(py::wrapper::Microsoft::Windows::AI::AIFeatureReadyResult* self) noexcept
    {
        auto tp = Py_TYPE(self);
        std::destroy_at(&self->obj);
        tp->tp_free(self);
        Py_DECREF(tp);
    }

    static PyObject* AIFeatureReadyResult_get_Error(py::wrapper::Microsoft::Windows::AI::AIFeatureReadyResult* 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"Microsoft.Windows.AI.AIFeatureReadyResult", L"Error");
            }

            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.Error();
            }());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* AIFeatureReadyResult_get_ErrorDisplayText(py::wrapper::Microsoft::Windows::AI::AIFeatureReadyResult* 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"Microsoft.Windows.AI.AIFeatureReadyResult", L"ErrorDisplayText");
            }

            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.ErrorDisplayText();
            }());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* AIFeatureReadyResult_get_ExtendedError(py::wrapper::Microsoft::Windows::AI::AIFeatureReadyResult* 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"Microsoft.Windows.AI.AIFeatureReadyResult", L"ExtendedError");
            }

            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.ExtendedError();
            }());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* AIFeatureReadyResult_get_Status(py::wrapper::Microsoft::Windows::AI::AIFeatureReadyResult* 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"Microsoft.Windows.AI.AIFeatureReadyResult", L"Status");
            }

            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.Status();
            }());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

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

    static PyObject* _from_AIFeatureReadyResult(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::Windows::AI::AIFeatureReadyResult>());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyMethodDef _methods_AIFeatureReadyResult[] = {
        { "_assign_array_", _assign_array_AIFeatureReadyResult, METH_O | METH_STATIC, nullptr },
        { "_from", reinterpret_cast<PyCFunction>(_from_AIFeatureReadyResult), METH_O | METH_STATIC, nullptr },
        { }};

    static PyGetSetDef _getset_AIFeatureReadyResult[] = {
        { "error", reinterpret_cast<getter>(AIFeatureReadyResult_get_Error), nullptr, nullptr, nullptr },
        { "error_display_text", reinterpret_cast<getter>(AIFeatureReadyResult_get_ErrorDisplayText), nullptr, nullptr, nullptr },
        { "extended_error", reinterpret_cast<getter>(AIFeatureReadyResult_get_ExtendedError), nullptr, nullptr, nullptr },
        { "status", reinterpret_cast<getter>(AIFeatureReadyResult_get_Status), nullptr, nullptr, nullptr },
        { }};

    static PyType_Slot _type_slots_AIFeatureReadyResult[] = {
        { Py_tp_new, reinterpret_cast<void*>(_new_AIFeatureReadyResult) },
        { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_AIFeatureReadyResult) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_AIFeatureReadyResult) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_AIFeatureReadyResult) },
        { }};

    static PyType_Spec type_spec_AIFeatureReadyResult = {
        "winui3._winui3_microsoft_windows_ai.AIFeatureReadyResult",
        sizeof(py::wrapper::Microsoft::Windows::AI::AIFeatureReadyResult),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_AIFeatureReadyResult};

    // ----- Microsoft.Windows.AI Initialization --------------------

    PyDoc_STRVAR(module_doc, "Microsoft.Windows.AI");

    static PyModuleDef module_def = {
        PyModuleDef_HEAD_INIT,
        "_winui3_microsoft_windows_ai",
        module_doc,
        0,
        nullptr,
        nullptr,
        nullptr,
        nullptr,
        nullptr};
} // py::cpp::Microsoft::Windows::AI

PyMODINIT_FUNC PyInit__winui3_microsoft_windows_ai(void) noexcept
{
    using namespace py::cpp::Microsoft::Windows::AI;

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


    return module.detach();
}
