// 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.Input.Inking.Preview.h"

PyTypeObject* py::winrt_type<winrt::Windows::UI::Input::Inking::Preview::PalmRejectionDelayZonePreview>::python_type;

namespace py::cpp::Windows::UI::Input::Inking::Preview
{
    // ----- PalmRejectionDelayZonePreview class --------------------
    constexpr const char* const _type_name_PalmRejectionDelayZonePreview = "PalmRejectionDelayZonePreview";

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

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

    static PyObject* PalmRejectionDelayZonePreview_Close(py::wrapper::Windows::UI::Input::Inking::Preview::PalmRejectionDelayZonePreview* self, PyObject* args) noexcept
    {
        Py_ssize_t arg_count = PyTuple_Size(args);

        if (arg_count == 0)
        {
            try
            {
                self->obj.Close();
                Py_RETURN_NONE;
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

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

        if (arg_count == 2)
        {
            try
            {
                auto param0 = py::convert_to<winrt::Windows::UI::Composition::Visual>(args, 0);
                auto param1 = py::convert_to<winrt::Windows::Foundation::Rect>(args, 1);

                return py::convert(winrt::Windows::UI::Input::Inking::Preview::PalmRejectionDelayZonePreview::CreateForVisual(param0, param1));
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else if (arg_count == 4)
        {
            try
            {
                auto param0 = py::convert_to<winrt::Windows::UI::Composition::Visual>(args, 0);
                auto param1 = py::convert_to<winrt::Windows::Foundation::Rect>(args, 1);
                auto param2 = py::convert_to<winrt::Windows::UI::Composition::Visual>(args, 2);
                auto param3 = py::convert_to<winrt::Windows::Foundation::Rect>(args, 3);

                return py::convert(winrt::Windows::UI::Input::Inking::Preview::PalmRejectionDelayZonePreview::CreateForVisual(param0, param1, param2, param3));
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* _from_PalmRejectionDelayZonePreview(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::Input::Inking::Preview::PalmRejectionDelayZonePreview>());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* _enter_PalmRejectionDelayZonePreview(py::wrapper::Windows::UI::Input::Inking::Preview::PalmRejectionDelayZonePreview* self) noexcept
    {
        Py_INCREF(self);
        return reinterpret_cast<PyObject*>(self);
    }

    static PyObject* _exit_PalmRejectionDelayZonePreview(py::wrapper::Windows::UI::Input::Inking::Preview::PalmRejectionDelayZonePreview* self) noexcept
    {
        try
        {
            self->obj.Close();
            Py_RETURN_FALSE;
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyMethodDef _methods_PalmRejectionDelayZonePreview[] = {
        { "close", reinterpret_cast<PyCFunction>(PalmRejectionDelayZonePreview_Close), METH_VARARGS, nullptr },
        { "create_for_visual", reinterpret_cast<PyCFunction>(PalmRejectionDelayZonePreview_CreateForVisual), METH_VARARGS | METH_STATIC, nullptr },
        { "_from", reinterpret_cast<PyCFunction>(_from_PalmRejectionDelayZonePreview), METH_O | METH_STATIC, nullptr },
        { "__enter__", reinterpret_cast<PyCFunction>(_enter_PalmRejectionDelayZonePreview), METH_NOARGS, nullptr },
        { "__exit__",  reinterpret_cast<PyCFunction>(_exit_PalmRejectionDelayZonePreview), METH_VARARGS, nullptr },
        { }
    };

    static PyGetSetDef _getset_PalmRejectionDelayZonePreview[] = {
        { }
    };

    static PyType_Slot _type_slots_PalmRejectionDelayZonePreview[] = 
    {
        { Py_tp_new, _new_PalmRejectionDelayZonePreview },
        { Py_tp_dealloc, _dealloc_PalmRejectionDelayZonePreview },
        { Py_tp_methods, _methods_PalmRejectionDelayZonePreview },
        { Py_tp_getset, _getset_PalmRejectionDelayZonePreview },
        { },
    };

    static PyType_Spec _type_spec_PalmRejectionDelayZonePreview =
    {
        "_winsdk_Windows_UI_Input_Inking_Preview.PalmRejectionDelayZonePreview",
        sizeof(py::wrapper::Windows::UI::Input::Inking::Preview::PalmRejectionDelayZonePreview),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_PalmRejectionDelayZonePreview
    };

    // ----- Windows.UI.Input.Inking.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::Input::Inking::Preview::PalmRejectionDelayZonePreview>::python_type = py::register_python_type(module, _type_name_PalmRejectionDelayZonePreview, &_type_spec_PalmRejectionDelayZonePreview, 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.Input.Inking.Preview");

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

PyMODINIT_FUNC
PyInit__winsdk_Windows_UI_Input_Inking_Preview (void) noexcept
{
    return PyModuleDef_Init(&py::cpp::Windows::UI::Input::Inking::Preview::module_def);
}
