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

#include "py.Windows.Phone.System.Profile.h"

namespace py::cpp::Windows::Phone::System::Profile
{
    // ----- RetailMode class --------------------

    static PyObject* _new_RetailMode(PyTypeObject* /*unused*/, PyObject* /*unused*/, PyObject* /*unused*/) noexcept
    {
        static_assert(py::py_type<winrt::Windows::Phone::System::Profile::RetailMode>::type_name);
        py::set_invalid_activation_error(py::py_type<winrt::Windows::Phone::System::Profile::RetailMode>::type_name);
        return nullptr;
    }

    static PyObject* RetailMode_get_RetailModeEnabled(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.Phone.System.Profile.RetailMode", L"RetailModeEnabled");
            }

            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::Phone::System::Profile::RetailMode::RetailModeEnabled());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyMethodDef _methods_RetailMode[] = {
        { }
    };

    static PyGetSetDef _getset_RetailMode[] = {
        { }
    };

    static PyType_Slot _type_slots_RetailMode[] = {
        { Py_tp_new, reinterpret_cast<void*>(_new_RetailMode) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_RetailMode) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_RetailMode) },
        { }
    };

    static PyType_Spec type_spec_RetailMode = {
        "winrt._winrt_windows_phone_system_profile.RetailMode",
        0,
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_RetailMode};

    static PyGetSetDef getset_RetailMode_Static[] = {
        { "retail_mode_enabled", reinterpret_cast<getter>(RetailMode_get_RetailModeEnabled), nullptr, nullptr, nullptr },
        { }
    };

    static PyMethodDef methods_RetailMode_Static[] = {
        { }
    };

    static PyType_Slot type_slots_RetailMode_Static[] = 
    {
        { Py_tp_base, reinterpret_cast<void*>(&PyType_Type) },
        { Py_tp_getset, reinterpret_cast<void*>(getset_RetailMode_Static) },
        { Py_tp_methods, reinterpret_cast<void*>(methods_RetailMode_Static) },
        { }
    };

    static PyType_Spec type_spec_RetailMode_Static =
    {
        "winrt._winrt_windows_phone_system_profile.RetailMode_Static",
        static_cast<int>(PyType_Type.tp_basicsize),
        static_cast<int>(PyType_Type.tp_itemsize),
        Py_TPFLAGS_DEFAULT,
        type_slots_RetailMode_Static
    };

    // ----- Windows.Phone.System.Profile Initialization --------------------

    PyDoc_STRVAR(module_doc, "Windows.Phone.System.Profile");

    static PyModuleDef module_def = {
        PyModuleDef_HEAD_INIT,
        "_winrt_windows_phone_system_profile",
        module_doc,
        0,
        nullptr,
        nullptr,
        nullptr,
        nullptr,
        nullptr};
} // py::cpp::Windows::Phone::System::Profile

PyMODINIT_FUNC PyInit__winrt_windows_phone_system_profile(void) noexcept
{
    using namespace py::cpp::Windows::Phone::System::Profile;

    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_RetailMode_Static{PyType_FromSpec(&type_spec_RetailMode_Static)};
    if (!type_RetailMode_Static)
    {
        return nullptr;
    }

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


    return module.detach();
}
