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

#include "pybase.h"
#include "py.Windows.Data.Xml.Xsl.h"

PyTypeObject* py::winrt_type<winrt::Windows::Data::Xml::Xsl::XsltProcessor>::python_type;

namespace py::cpp::Windows::Data::Xml::Xsl
{
    // ----- XsltProcessor class --------------------
    constexpr const char* const _type_name_XsltProcessor = "XsltProcessor";

    static PyObject* _new_XsltProcessor(PyTypeObject* type, PyObject* args, PyObject* kwds) noexcept
    {
        if (kwds != nullptr)
        {
            py::set_invalid_kwd_args_error();
            return nullptr;
        }

        Py_ssize_t arg_count = PyTuple_Size(args);
        if (arg_count == 1)
        {
            try
            {
                auto param0 = py::convert_to<winrt::Windows::Data::Xml::Dom::XmlDocument>(args, 0);

                winrt::Windows::Data::Xml::Xsl::XsltProcessor instance{ param0 };
                return py::wrap(instance, type);
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static void _dealloc_XsltProcessor(py::wrapper::Windows::Data::Xml::Xsl::XsltProcessor* self)
    {
        auto hash_value = std::hash<winrt::Windows::Foundation::IInspectable>{}(self->obj);
        py::wrapped_instance(hash_value, nullptr);
        self->obj = nullptr;
    }

    static PyObject* XsltProcessor_TransformToDocument(py::wrapper::Windows::Data::Xml::Xsl::XsltProcessor* self, PyObject* args) noexcept
    {
        Py_ssize_t arg_count = PyTuple_Size(args);

        if (arg_count == 1)
        {
            try
            {
                auto param0 = py::convert_to<winrt::Windows::Data::Xml::Dom::IXmlNode>(args, 0);

                return py::convert(self->obj.TransformToDocument(param0));
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* XsltProcessor_TransformToString(py::wrapper::Windows::Data::Xml::Xsl::XsltProcessor* self, PyObject* args) noexcept
    {
        Py_ssize_t arg_count = PyTuple_Size(args);

        if (arg_count == 1)
        {
            try
            {
                auto param0 = py::convert_to<winrt::Windows::Data::Xml::Dom::IXmlNode>(args, 0);

                return py::convert(self->obj.TransformToString(param0));
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* _from_XsltProcessor(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::Data::Xml::Xsl::XsltProcessor>());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyMethodDef _methods_XsltProcessor[] = {
        { "transform_to_document", reinterpret_cast<PyCFunction>(XsltProcessor_TransformToDocument), METH_VARARGS, nullptr },
        { "transform_to_string", reinterpret_cast<PyCFunction>(XsltProcessor_TransformToString), METH_VARARGS, nullptr },
        { "_from", reinterpret_cast<PyCFunction>(_from_XsltProcessor), METH_O | METH_STATIC, nullptr },
        { }
    };

    static PyGetSetDef _getset_XsltProcessor[] = {
        { }
    };

    static PyType_Slot _type_slots_XsltProcessor[] = 
    {
        { Py_tp_new, _new_XsltProcessor },
        { Py_tp_dealloc, _dealloc_XsltProcessor },
        { Py_tp_methods, _methods_XsltProcessor },
        { Py_tp_getset, _getset_XsltProcessor },
        { },
    };

    static PyType_Spec _type_spec_XsltProcessor =
    {
        "_winsdk_Windows_Data_Xml_Xsl.XsltProcessor",
        sizeof(py::wrapper::Windows::Data::Xml::Xsl::XsltProcessor),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_XsltProcessor
    };

    // ----- Windows.Data.Xml.Xsl 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::Data::Xml::Xsl::XsltProcessor>::python_type = py::register_python_type(module, _type_name_XsltProcessor, &_type_spec_XsltProcessor, 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.Data.Xml.Xsl");

    static PyModuleDef module_def
        = {PyModuleDef_HEAD_INIT,
           "_winsdk_Windows_Data_Xml_Xsl",
           module_doc,
           0,
           nullptr,
           module_slots,
           nullptr,
           nullptr,
           nullptr};
} // py::cpp::Windows::Data::Xml::Xsl

PyMODINIT_FUNC
PyInit__winsdk_Windows_Data_Xml_Xsl (void) noexcept
{
    return PyModuleDef_Init(&py::cpp::Windows::Data::Xml::Xsl::module_def);
}
