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

#include "pybase.h"
#include "py.Windows.Networking.h"

PyTypeObject* py::winrt_type<winrt::Windows::Networking::EndpointPair>::python_type;
PyTypeObject* py::winrt_type<winrt::Windows::Networking::HostName>::python_type;

namespace py::cpp::Windows::Networking
{
    // ----- EndpointPair class --------------------
    constexpr const char* const _type_name_EndpointPair = "EndpointPair";

    static PyObject* _new_EndpointPair(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 == 4)
        {
            try
            {
                auto param0 = py::convert_to<winrt::Windows::Networking::HostName>(args, 0);
                auto param1 = py::convert_to<winrt::hstring>(args, 1);
                auto param2 = py::convert_to<winrt::Windows::Networking::HostName>(args, 2);
                auto param3 = py::convert_to<winrt::hstring>(args, 3);

                winrt::Windows::Networking::EndpointPair instance{ param0, param1, param2, param3 };
                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_EndpointPair(py::wrapper::Windows::Networking::EndpointPair* self)
    {
        auto hash_value = std::hash<winrt::Windows::Foundation::IInspectable>{}(self->obj);
        py::wrapped_instance(hash_value, nullptr);
        self->obj = nullptr;
    }

    static PyObject* EndpointPair_get_RemoteServiceName(py::wrapper::Windows::Networking::EndpointPair* self, void* /*unused*/) noexcept
    {
        try
        {
            return py::convert(self->obj.RemoteServiceName());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static int EndpointPair_put_RemoteServiceName(py::wrapper::Windows::Networking::EndpointPair* 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<winrt::hstring>(arg);

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

    static PyObject* EndpointPair_get_RemoteHostName(py::wrapper::Windows::Networking::EndpointPair* self, void* /*unused*/) noexcept
    {
        try
        {
            return py::convert(self->obj.RemoteHostName());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static int EndpointPair_put_RemoteHostName(py::wrapper::Windows::Networking::EndpointPair* 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<winrt::Windows::Networking::HostName>(arg);

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

    static PyObject* EndpointPair_get_LocalServiceName(py::wrapper::Windows::Networking::EndpointPair* self, void* /*unused*/) noexcept
    {
        try
        {
            return py::convert(self->obj.LocalServiceName());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static int EndpointPair_put_LocalServiceName(py::wrapper::Windows::Networking::EndpointPair* 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<winrt::hstring>(arg);

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

    static PyObject* EndpointPair_get_LocalHostName(py::wrapper::Windows::Networking::EndpointPair* self, void* /*unused*/) noexcept
    {
        try
        {
            return py::convert(self->obj.LocalHostName());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static int EndpointPair_put_LocalHostName(py::wrapper::Windows::Networking::EndpointPair* 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<winrt::Windows::Networking::HostName>(arg);

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

    static PyObject* _from_EndpointPair(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::Networking::EndpointPair>());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyMethodDef _methods_EndpointPair[] = {
        { "_from", reinterpret_cast<PyCFunction>(_from_EndpointPair), METH_O | METH_STATIC, nullptr },
        { }
    };

    static PyGetSetDef _getset_EndpointPair[] = {
        { "remote_service_name", reinterpret_cast<getter>(EndpointPair_get_RemoteServiceName), reinterpret_cast<setter>(EndpointPair_put_RemoteServiceName), nullptr, nullptr },
        { "remote_host_name", reinterpret_cast<getter>(EndpointPair_get_RemoteHostName), reinterpret_cast<setter>(EndpointPair_put_RemoteHostName), nullptr, nullptr },
        { "local_service_name", reinterpret_cast<getter>(EndpointPair_get_LocalServiceName), reinterpret_cast<setter>(EndpointPair_put_LocalServiceName), nullptr, nullptr },
        { "local_host_name", reinterpret_cast<getter>(EndpointPair_get_LocalHostName), reinterpret_cast<setter>(EndpointPair_put_LocalHostName), nullptr, nullptr },
        { }
    };

    static PyType_Slot _type_slots_EndpointPair[] = 
    {
        { Py_tp_new, _new_EndpointPair },
        { Py_tp_dealloc, _dealloc_EndpointPair },
        { Py_tp_methods, _methods_EndpointPair },
        { Py_tp_getset, _getset_EndpointPair },
        { },
    };

    static PyType_Spec _type_spec_EndpointPair =
    {
        "_winsdk_Windows_Networking.EndpointPair",
        sizeof(py::wrapper::Windows::Networking::EndpointPair),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_EndpointPair
    };

    // ----- HostName class --------------------
    constexpr const char* const _type_name_HostName = "HostName";

    static PyObject* _new_HostName(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::hstring>(args, 0);

                winrt::Windows::Networking::HostName 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_HostName(py::wrapper::Windows::Networking::HostName* self)
    {
        auto hash_value = std::hash<winrt::Windows::Foundation::IInspectable>{}(self->obj);
        py::wrapped_instance(hash_value, nullptr);
        self->obj = nullptr;
    }

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

        if (arg_count == 2)
        {
            try
            {
                auto param0 = py::convert_to<winrt::hstring>(args, 0);
                auto param1 = py::convert_to<winrt::hstring>(args, 1);

                return py::convert(winrt::Windows::Networking::HostName::Compare(param0, param1));
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* HostName_IsEqual(py::wrapper::Windows::Networking::HostName* self, PyObject* args) noexcept
    {
        Py_ssize_t arg_count = PyTuple_Size(args);

        if (arg_count == 1)
        {
            try
            {
                auto param0 = py::convert_to<winrt::Windows::Networking::HostName>(args, 0);

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

    static PyObject* HostName_ToString(py::wrapper::Windows::Networking::HostName* self, PyObject* args) noexcept
    {
        Py_ssize_t arg_count = PyTuple_Size(args);

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

    static PyObject* HostName_get_CanonicalName(py::wrapper::Windows::Networking::HostName* self, void* /*unused*/) noexcept
    {
        try
        {
            return py::convert(self->obj.CanonicalName());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* HostName_get_DisplayName(py::wrapper::Windows::Networking::HostName* self, void* /*unused*/) noexcept
    {
        try
        {
            return py::convert(self->obj.DisplayName());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* HostName_get_IPInformation(py::wrapper::Windows::Networking::HostName* self, void* /*unused*/) noexcept
    {
        try
        {
            return py::convert(self->obj.IPInformation());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* HostName_get_RawName(py::wrapper::Windows::Networking::HostName* self, void* /*unused*/) noexcept
    {
        try
        {
            return py::convert(self->obj.RawName());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* HostName_get_Type(py::wrapper::Windows::Networking::HostName* self, void* /*unused*/) noexcept
    {
        try
        {
            return py::convert(self->obj.Type());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* _from_HostName(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::Networking::HostName>());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* _str_HostName(py::wrapper::Windows::Networking::HostName* self) noexcept
    {
        try
        {
            return py::convert(self->obj.ToString());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyMethodDef _methods_HostName[] = {
        { "compare", reinterpret_cast<PyCFunction>(HostName_Compare), METH_VARARGS | METH_STATIC, nullptr },
        { "is_equal", reinterpret_cast<PyCFunction>(HostName_IsEqual), METH_VARARGS, nullptr },
        { "to_string", reinterpret_cast<PyCFunction>(HostName_ToString), METH_VARARGS, nullptr },
        { "_from", reinterpret_cast<PyCFunction>(_from_HostName), METH_O | METH_STATIC, nullptr },
        { }
    };

    static PyGetSetDef _getset_HostName[] = {
        { "canonical_name", reinterpret_cast<getter>(HostName_get_CanonicalName), nullptr, nullptr, nullptr },
        { "display_name", reinterpret_cast<getter>(HostName_get_DisplayName), nullptr, nullptr, nullptr },
        { "i_p_information", reinterpret_cast<getter>(HostName_get_IPInformation), nullptr, nullptr, nullptr },
        { "raw_name", reinterpret_cast<getter>(HostName_get_RawName), nullptr, nullptr, nullptr },
        { "type", reinterpret_cast<getter>(HostName_get_Type), nullptr, nullptr, nullptr },
        { }
    };

    static PyType_Slot _type_slots_HostName[] = 
    {
        { Py_tp_new, _new_HostName },
        { Py_tp_dealloc, _dealloc_HostName },
        { Py_tp_methods, _methods_HostName },
        { Py_tp_getset, _getset_HostName },
        { Py_tp_str, _str_HostName },
        { },
    };

    static PyType_Spec _type_spec_HostName =
    {
        "_winsdk_Windows_Networking.HostName",
        sizeof(py::wrapper::Windows::Networking::HostName),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_HostName
    };

    // ----- Windows.Networking 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::Networking::EndpointPair>::python_type = py::register_python_type(module, _type_name_EndpointPair, &_type_spec_EndpointPair, bases.get());
            py::winrt_type<winrt::Windows::Networking::HostName>::python_type = py::register_python_type(module, _type_name_HostName, &_type_spec_HostName, 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.Networking");

    static PyModuleDef module_def
        = {PyModuleDef_HEAD_INIT,
           "_winsdk_Windows_Networking",
           module_doc,
           0,
           nullptr,
           module_slots,
           nullptr,
           nullptr,
           nullptr};
} // py::cpp::Windows::Networking

PyMODINIT_FUNC
PyInit__winsdk_Windows_Networking (void) noexcept
{
    return PyModuleDef_Init(&py::cpp::Windows::Networking::module_def);
}
