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

#include "pybase.h"
#include "py.Windows.UI.Core.Preview.h"

PyTypeObject* py::winrt_type<winrt::Windows::UI::Core::Preview::CoreAppWindowPreview>::python_type;
PyTypeObject* py::winrt_type<winrt::Windows::UI::Core::Preview::SystemNavigationCloseRequestedPreviewEventArgs>::python_type;
PyTypeObject* py::winrt_type<winrt::Windows::UI::Core::Preview::SystemNavigationManagerPreview>::python_type;

namespace py::cpp::Windows::UI::Core::Preview
{
    // ----- CoreAppWindowPreview class --------------------
    constexpr const char* const _type_name_CoreAppWindowPreview = "CoreAppWindowPreview";

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

    static void _dealloc_CoreAppWindowPreview(py::wrapper::Windows::UI::Core::Preview::CoreAppWindowPreview* self)
    {
        auto hash_value = std::hash<winrt::Windows::Foundation::IInspectable>{}(self->obj);
        py::wrapped_instance(hash_value, nullptr);
        self->obj = nullptr;
    }

    static PyObject* CoreAppWindowPreview_GetIdFromWindow(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::UI::WindowManagement::AppWindow>(args, 0);

                return py::convert(winrt::Windows::UI::Core::Preview::CoreAppWindowPreview::GetIdFromWindow(param0));
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* _from_CoreAppWindowPreview(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::UI::Core::Preview::CoreAppWindowPreview>());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyMethodDef _methods_CoreAppWindowPreview[] = {
        { "get_id_from_window", reinterpret_cast<PyCFunction>(CoreAppWindowPreview_GetIdFromWindow), METH_VARARGS | METH_STATIC, nullptr },
        { "_from", reinterpret_cast<PyCFunction>(_from_CoreAppWindowPreview), METH_O | METH_STATIC, nullptr },
        { }
    };

    static PyGetSetDef _getset_CoreAppWindowPreview[] = {
        { }
    };

    static PyType_Slot _type_slots_CoreAppWindowPreview[] = 
    {
        { Py_tp_new, _new_CoreAppWindowPreview },
        { Py_tp_dealloc, _dealloc_CoreAppWindowPreview },
        { Py_tp_methods, _methods_CoreAppWindowPreview },
        { Py_tp_getset, _getset_CoreAppWindowPreview },
        { },
    };

    static PyType_Spec _type_spec_CoreAppWindowPreview =
    {
        "_winsdk_Windows_UI_Core_Preview.CoreAppWindowPreview",
        sizeof(py::wrapper::Windows::UI::Core::Preview::CoreAppWindowPreview),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_CoreAppWindowPreview
    };

    // ----- SystemNavigationCloseRequestedPreviewEventArgs class --------------------
    constexpr const char* const _type_name_SystemNavigationCloseRequestedPreviewEventArgs = "SystemNavigationCloseRequestedPreviewEventArgs";

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

    static void _dealloc_SystemNavigationCloseRequestedPreviewEventArgs(py::wrapper::Windows::UI::Core::Preview::SystemNavigationCloseRequestedPreviewEventArgs* self)
    {
        auto hash_value = std::hash<winrt::Windows::Foundation::IInspectable>{}(self->obj);
        py::wrapped_instance(hash_value, nullptr);
        self->obj = nullptr;
    }

    static PyObject* SystemNavigationCloseRequestedPreviewEventArgs_GetDeferral(py::wrapper::Windows::UI::Core::Preview::SystemNavigationCloseRequestedPreviewEventArgs* 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* SystemNavigationCloseRequestedPreviewEventArgs_get_Handled(py::wrapper::Windows::UI::Core::Preview::SystemNavigationCloseRequestedPreviewEventArgs* self, void* /*unused*/) noexcept
    {
        try
        {
            return py::convert(self->obj.Handled());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static int SystemNavigationCloseRequestedPreviewEventArgs_put_Handled(py::wrapper::Windows::UI::Core::Preview::SystemNavigationCloseRequestedPreviewEventArgs* self, PyObject* arg, void* /*unused*/) noexcept
    {
        if (arg == nullptr)
        {
            PyErr_SetString(PyExc_TypeError, "property delete not supported");
            return -1;
        }

        try
        {
            auto param0 = py::convert_to<bool>(arg);

            self->obj.Handled(param0);
            return 0;
        }
        catch (...)
        {
            py::to_PyErr();
            return -1;
        }
    }

    static PyObject* _from_SystemNavigationCloseRequestedPreviewEventArgs(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::UI::Core::Preview::SystemNavigationCloseRequestedPreviewEventArgs>());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyMethodDef _methods_SystemNavigationCloseRequestedPreviewEventArgs[] = {
        { "get_deferral", reinterpret_cast<PyCFunction>(SystemNavigationCloseRequestedPreviewEventArgs_GetDeferral), METH_VARARGS, nullptr },
        { "_from", reinterpret_cast<PyCFunction>(_from_SystemNavigationCloseRequestedPreviewEventArgs), METH_O | METH_STATIC, nullptr },
        { }
    };

    static PyGetSetDef _getset_SystemNavigationCloseRequestedPreviewEventArgs[] = {
        { "handled", reinterpret_cast<getter>(SystemNavigationCloseRequestedPreviewEventArgs_get_Handled), reinterpret_cast<setter>(SystemNavigationCloseRequestedPreviewEventArgs_put_Handled), nullptr, nullptr },
        { }
    };

    static PyType_Slot _type_slots_SystemNavigationCloseRequestedPreviewEventArgs[] = 
    {
        { Py_tp_new, _new_SystemNavigationCloseRequestedPreviewEventArgs },
        { Py_tp_dealloc, _dealloc_SystemNavigationCloseRequestedPreviewEventArgs },
        { Py_tp_methods, _methods_SystemNavigationCloseRequestedPreviewEventArgs },
        { Py_tp_getset, _getset_SystemNavigationCloseRequestedPreviewEventArgs },
        { },
    };

    static PyType_Spec _type_spec_SystemNavigationCloseRequestedPreviewEventArgs =
    {
        "_winsdk_Windows_UI_Core_Preview.SystemNavigationCloseRequestedPreviewEventArgs",
        sizeof(py::wrapper::Windows::UI::Core::Preview::SystemNavigationCloseRequestedPreviewEventArgs),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_SystemNavigationCloseRequestedPreviewEventArgs
    };

    // ----- SystemNavigationManagerPreview class --------------------
    constexpr const char* const _type_name_SystemNavigationManagerPreview = "SystemNavigationManagerPreview";

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

    static void _dealloc_SystemNavigationManagerPreview(py::wrapper::Windows::UI::Core::Preview::SystemNavigationManagerPreview* self)
    {
        auto hash_value = std::hash<winrt::Windows::Foundation::IInspectable>{}(self->obj);
        py::wrapped_instance(hash_value, nullptr);
        self->obj = nullptr;
    }

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

        if (arg_count == 0)
        {
            try
            {
                return py::convert(winrt::Windows::UI::Core::Preview::SystemNavigationManagerPreview::GetForCurrentView());
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* SystemNavigationManagerPreview_add_CloseRequested(py::wrapper::Windows::UI::Core::Preview::SystemNavigationManagerPreview* self, PyObject* arg) noexcept
    {
        try
        {
            auto param0 = py::convert_to<winrt::Windows::Foundation::EventHandler<winrt::Windows::UI::Core::Preview::SystemNavigationCloseRequestedPreviewEventArgs>>(arg);

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

    static PyObject* SystemNavigationManagerPreview_remove_CloseRequested(py::wrapper::Windows::UI::Core::Preview::SystemNavigationManagerPreview* self, PyObject* arg) noexcept
    {
        try
        {
            auto param0 = py::convert_to<winrt::event_token>(arg);

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

    static PyObject* _from_SystemNavigationManagerPreview(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::UI::Core::Preview::SystemNavigationManagerPreview>());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyMethodDef _methods_SystemNavigationManagerPreview[] = {
        { "get_for_current_view", reinterpret_cast<PyCFunction>(SystemNavigationManagerPreview_GetForCurrentView), METH_VARARGS | METH_STATIC, nullptr },
        { "add_close_requested", reinterpret_cast<PyCFunction>(SystemNavigationManagerPreview_add_CloseRequested), METH_O, nullptr },
        { "remove_close_requested", reinterpret_cast<PyCFunction>(SystemNavigationManagerPreview_remove_CloseRequested), METH_O, nullptr },
        { "_from", reinterpret_cast<PyCFunction>(_from_SystemNavigationManagerPreview), METH_O | METH_STATIC, nullptr },
        { }
    };

    static PyGetSetDef _getset_SystemNavigationManagerPreview[] = {
        { }
    };

    static PyType_Slot _type_slots_SystemNavigationManagerPreview[] = 
    {
        { Py_tp_new, _new_SystemNavigationManagerPreview },
        { Py_tp_dealloc, _dealloc_SystemNavigationManagerPreview },
        { Py_tp_methods, _methods_SystemNavigationManagerPreview },
        { Py_tp_getset, _getset_SystemNavigationManagerPreview },
        { },
    };

    static PyType_Spec _type_spec_SystemNavigationManagerPreview =
    {
        "_winsdk_Windows_UI_Core_Preview.SystemNavigationManagerPreview",
        sizeof(py::wrapper::Windows::UI::Core::Preview::SystemNavigationManagerPreview),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_SystemNavigationManagerPreview
    };

    // ----- Windows.UI.Core.Preview 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::UI::Core::Preview::CoreAppWindowPreview>::python_type = py::register_python_type(module, _type_name_CoreAppWindowPreview, &_type_spec_CoreAppWindowPreview, bases.get());
            py::winrt_type<winrt::Windows::UI::Core::Preview::SystemNavigationCloseRequestedPreviewEventArgs>::python_type = py::register_python_type(module, _type_name_SystemNavigationCloseRequestedPreviewEventArgs, &_type_spec_SystemNavigationCloseRequestedPreviewEventArgs, bases.get());
            py::winrt_type<winrt::Windows::UI::Core::Preview::SystemNavigationManagerPreview>::python_type = py::register_python_type(module, _type_name_SystemNavigationManagerPreview, &_type_spec_SystemNavigationManagerPreview, 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.UI.Core.Preview");

    static PyModuleDef module_def
        = {PyModuleDef_HEAD_INIT,
           "_winsdk_Windows_UI_Core_Preview",
           module_doc,
           0,
           nullptr,
           module_slots,
           nullptr,
           nullptr,
           nullptr};
} // py::cpp::Windows::UI::Core::Preview

PyMODINIT_FUNC
PyInit__winsdk_Windows_UI_Core_Preview (void) noexcept
{
    return PyModuleDef_Init(&py::cpp::Windows::UI::Core::Preview::module_def);
}
