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

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


namespace py::cpp::Windows::Devices::Portable
{
    // ----- ServiceDevice class --------------------

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

    static PyObject* ServiceDevice_GetDeviceSelector(PyObject* /*unused*/, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_Size(args);

        if (arg_count == 1)
        {
            if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Devices.Portable.ServiceDevice", L"GetDeviceSelector", 1))
            {
                py::set_arg_count_version_error(1);
                return nullptr;
            }

            try
            {
                auto param0 = py::convert_to<winrt::Windows::Devices::Portable::ServiceDeviceType>(args, 0);

                return py::convert(winrt::Windows::Devices::Portable::ServiceDevice::GetDeviceSelector(param0));
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* ServiceDevice_GetDeviceSelectorFromServiceId(PyObject* /*unused*/, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_Size(args);

        if (arg_count == 1)
        {
            if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Devices.Portable.ServiceDevice", L"GetDeviceSelectorFromServiceId", 1))
            {
                py::set_arg_count_version_error(1);
                return nullptr;
            }

            try
            {
                auto param0 = py::convert_to<winrt::guid>(args, 0);

                return py::convert(winrt::Windows::Devices::Portable::ServiceDevice::GetDeviceSelectorFromServiceId(param0));
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyMethodDef _methods_ServiceDevice[] = {
        { }
    };

    static PyGetSetDef _getset_ServiceDevice[] = {
        { }
    };

    static PyType_Slot _type_slots_ServiceDevice[] = 
    {
        { Py_tp_new, reinterpret_cast<void*>(_new_ServiceDevice) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_ServiceDevice) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_ServiceDevice) },
        { },
    };

    static PyType_Spec type_spec_ServiceDevice =
    {
        "winrt._winrt_windows_devices_portable.ServiceDevice",
        0,
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_ServiceDevice
    };

    static PyGetSetDef getset_ServiceDevice_Static[] = {
        { }
    };

    static PyMethodDef methods_ServiceDevice_Static[] = {
        { "get_device_selector", reinterpret_cast<PyCFunction>(ServiceDevice_GetDeviceSelector), METH_VARARGS, nullptr },
        { "get_device_selector_from_service_id", reinterpret_cast<PyCFunction>(ServiceDevice_GetDeviceSelectorFromServiceId), METH_VARARGS, nullptr },
        { }
    };

    static PyType_Slot type_slots_ServiceDevice_Static[] = 
    {
        { Py_tp_base, reinterpret_cast<void*>(&PyType_Type) },
        { Py_tp_getset, reinterpret_cast<void*>(getset_ServiceDevice_Static) },
        { Py_tp_methods, reinterpret_cast<void*>(methods_ServiceDevice_Static) },
        { }
    };

    static PyType_Spec type_spec_ServiceDevice_Static =
    {
        "winrt._winrt_windows_devices_portable.ServiceDevice_Static",
        static_cast<int>(PyType_Type.tp_basicsize),
        static_cast<int>(PyType_Type.tp_itemsize),
        Py_TPFLAGS_DEFAULT,
        type_slots_ServiceDevice_Static
    };

    // ----- StorageDevice class --------------------

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

    static PyObject* StorageDevice_FromId(PyObject* /*unused*/, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_Size(args);

        if (arg_count == 1)
        {
            if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Devices.Portable.StorageDevice", L"FromId", 1))
            {
                py::set_arg_count_version_error(1);
                return nullptr;
            }

            try
            {
                auto param0 = py::convert_to<winrt::hstring>(args, 0);

                return py::convert(winrt::Windows::Devices::Portable::StorageDevice::FromId(param0));
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* StorageDevice_GetDeviceSelector(PyObject* /*unused*/, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_Size(args);

        if (arg_count == 0)
        {
            if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Devices.Portable.StorageDevice", L"GetDeviceSelector", 0))
            {
                py::set_arg_count_version_error(0);
                return nullptr;
            }

            try
            {
                return py::convert(winrt::Windows::Devices::Portable::StorageDevice::GetDeviceSelector());
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyMethodDef _methods_StorageDevice[] = {
        { }
    };

    static PyGetSetDef _getset_StorageDevice[] = {
        { }
    };

    static PyType_Slot _type_slots_StorageDevice[] = 
    {
        { Py_tp_new, reinterpret_cast<void*>(_new_StorageDevice) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_StorageDevice) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_StorageDevice) },
        { },
    };

    static PyType_Spec type_spec_StorageDevice =
    {
        "winrt._winrt_windows_devices_portable.StorageDevice",
        0,
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_StorageDevice
    };

    static PyGetSetDef getset_StorageDevice_Static[] = {
        { }
    };

    static PyMethodDef methods_StorageDevice_Static[] = {
        { "from_id", reinterpret_cast<PyCFunction>(StorageDevice_FromId), METH_VARARGS, nullptr },
        { "get_device_selector", reinterpret_cast<PyCFunction>(StorageDevice_GetDeviceSelector), METH_VARARGS, nullptr },
        { }
    };

    static PyType_Slot type_slots_StorageDevice_Static[] = 
    {
        { Py_tp_base, reinterpret_cast<void*>(&PyType_Type) },
        { Py_tp_getset, reinterpret_cast<void*>(getset_StorageDevice_Static) },
        { Py_tp_methods, reinterpret_cast<void*>(methods_StorageDevice_Static) },
        { }
    };

    static PyType_Spec type_spec_StorageDevice_Static =
    {
        "winrt._winrt_windows_devices_portable.StorageDevice_Static",
        static_cast<int>(PyType_Type.tp_basicsize),
        static_cast<int>(PyType_Type.tp_itemsize),
        Py_TPFLAGS_DEFAULT,
        type_slots_StorageDevice_Static
    };

    // ----- Windows.Devices.Portable Initialization --------------------
    PyDoc_STRVAR(module_doc, "Windows::Devices::Portable");


    static PyModuleDef module_def
        = {PyModuleDef_HEAD_INIT,
           "_winrt_windows_devices_portable",
           module_doc,
           0,
           nullptr,
           nullptr,
           nullptr,
           nullptr,
           nullptr};

} // py::cpp::Windows::Devices::Portable

PyMODINIT_FUNC PyInit__winrt_windows_devices_portable(void) noexcept
{
    using namespace py::cpp::Windows::Devices::Portable;

    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_ServiceDevice_Static{PyType_FromSpec(&type_spec_ServiceDevice_Static)};
    if (!type_ServiceDevice_Static)
    {
        return nullptr;
    }

    if (py::register_python_type(module.get(), &type_spec_ServiceDevice, object_bases.get(), reinterpret_cast<PyTypeObject*>(type_ServiceDevice_Static.get())) == -1)
    {
        return nullptr;
    }

    py::pyobj_handle type_StorageDevice_Static{PyType_FromSpec(&type_spec_StorageDevice_Static)};
    if (!type_StorageDevice_Static)
    {
        return nullptr;
    }

    if (py::register_python_type(module.get(), &type_spec_StorageDevice, object_bases.get(), reinterpret_cast<PyTypeObject*>(type_StorageDevice_Static.get())) == -1)
    {
        return nullptr;
    }


    return module.detach();
}
