/* Copyright (C) 2010 The giomm Development Team
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library.  If not, see <http://www.gnu.org/licenses/>.
 */

_CONFIGINCLUDE(giommconfig.h)

#include <glibmm/refptr.h>
#include <glibmm/value.h>
#include <gio/gio.h>
#include <vector>

_DEFS(giomm,gio)
_PINCLUDE(glibmm/private/object_p.h)

namespace Gio
{

namespace DBus
{

_WRAP_ENUM(PropertyInfoFlags, GDBusPropertyInfoFlags, NO_GTYPE, decl_prefix GIOMM_API)

/** Stores information about an annotation.
 *
 * @newin{2,28}
 * @ingroup DBus
 */
class GIOMM_API AnnotationInfo final
{
  _CLASS_OPAQUE_REFCOUNTED(AnnotationInfo, GDBusAnnotationInfo, NONE, g_dbus_annotation_info_ref, g_dbus_annotation_info_unref, GIOMM_API)
  _IGNORE(g_dbus_annotation_info_ref, g_dbus_annotation_info_unref)

public:
#m4 _CONVERSION(`const std::vector<Glib::RefPtr<AnnotationInfo>>&', `GDBusAnnotationInfo**',`Glib::ArrayHandler<Glib::RefPtr<AnnotationInfo>>::vector_to_array($3).data()')
  _WRAP_METHOD(static Glib::ustring info_lookup(const std::vector<Glib::RefPtr<AnnotationInfo>>&  annotations, const Glib::ustring& name), g_dbus_annotation_info_lookup)
};

/** ArgInfo - Stores information about an argument for a method or a
 * signal.
 *
 * @newin{2,28}
 * @ingroup DBus
 */
class GIOMM_API ArgInfo final
{
  _CLASS_OPAQUE_REFCOUNTED(ArgInfo, GDBusArgInfo, NONE, g_dbus_arg_info_ref, g_dbus_arg_info_unref, GIOMM_API)
  _IGNORE(g_dbus_arg_info_ref, g_dbus_arg_info_unref)

public:
};

/** Stores information about a method on an D-Bus interface.
 *
 * @newin{2,28}
 * @ingroup DBus
 */
class GIOMM_API MethodInfo final
{
  _CLASS_OPAQUE_REFCOUNTED(MethodInfo, GDBusMethodInfo, NONE, g_dbus_method_info_ref, g_dbus_method_info_unref, GIOMM_API)
  _IGNORE(g_dbus_method_info_ref, g_dbus_method_info_unref)

public:
};

/** Stores information about a signal on a D-Bus interface.
 *
 * @newin{2,28}
 * @ingroup DBus
 */
class GIOMM_API SignalInfo final
{
  _CLASS_OPAQUE_REFCOUNTED(SignalInfo, GDBusSignalInfo, NONE, g_dbus_signal_info_ref, g_dbus_signal_info_unref, GIOMM_API)
  _IGNORE(g_dbus_signal_info_ref, g_dbus_signal_info_unref)

public:
};

/** Stores information about a property on a D-Bus interface.
 *
 * @newin{2,28}
 * @ingroup DBus
 */
class GIOMM_API PropertyInfo final
{
  _CLASS_OPAQUE_REFCOUNTED(PropertyInfo, GDBusPropertyInfo, NONE, g_dbus_property_info_ref, g_dbus_property_info_unref, GIOMM_API)
  _IGNORE(g_dbus_property_info_ref, g_dbus_property_info_unref)

public:
};

/** Stores information about a D-Bus interface.
 *
 * @newin{2,28}
 * @ingroup DBus
 */
class GIOMM_API InterfaceInfo final
{
  _CLASS_OPAQUE_REFCOUNTED(InterfaceInfo, GDBusInterfaceInfo, NONE, g_dbus_interface_info_ref, g_dbus_interface_info_unref, GIOMM_API)
  _IS_REFCOUNTED_BOXEDTYPE(g_dbus_interface_info_get_type)
  _IGNORE(g_dbus_interface_info_ref, g_dbus_interface_info_unref)

public:
  _WRAP_METHOD(Glib::RefPtr<MethodInfo> lookup_method(const Glib::ustring& name), g_dbus_interface_info_lookup_method, refreturn)
  _WRAP_METHOD(Glib::RefPtr<const MethodInfo> lookup_method(const Glib::ustring& name) const, g_dbus_interface_info_lookup_method, constversion, refreturn)

  _WRAP_METHOD(Glib::RefPtr<SignalInfo> lookup_signal(const Glib::ustring& name), g_dbus_interface_info_lookup_signal, refreturn)
  _WRAP_METHOD(Glib::RefPtr<const SignalInfo> lookup_signal(const Glib::ustring& name) const, g_dbus_interface_info_lookup_signal, constversion, refreturn)

  _WRAP_METHOD(Glib::RefPtr<PropertyInfo> lookup_property(const Glib::ustring& name), g_dbus_interface_info_lookup_property, refreturn)
  _WRAP_METHOD(Glib::RefPtr<const PropertyInfo> lookup_property(const Glib::ustring& name) const, g_dbus_interface_info_lookup_property, constversion, refreturn)

  _WRAP_METHOD(void cache_build(), g_dbus_interface_info_cache_build, newin "2,44")
  _WRAP_METHOD(void cache_release(), g_dbus_interface_info_cache_release, newin "2,44")

  //TODO: _WRAP_METHOD(void generate_xml(guint indent, GString* string_builder), g_dbus_interface_info_generate_xml)
};

/** NodeInfo - Stores information about nodes in a remote object
 * hierarchy.
 *
 * @newin{2,28}
 * @ingroup DBus
 */
class GIOMM_API NodeInfo final
{
  _CLASS_OPAQUE_REFCOUNTED(NodeInfo, GDBusNodeInfo, NONE, g_dbus_node_info_ref, g_dbus_node_info_unref, GIOMM_API)
  _IGNORE(g_dbus_node_info_ref, g_dbus_node_info_unref)

public:
  _WRAP_METHOD(static Glib::RefPtr<NodeInfo> create_for_xml(const Glib::ustring& xml_data), g_dbus_node_info_new_for_xml, errthrow "Glib::MarkupError")

  _WRAP_METHOD(Glib::RefPtr<InterfaceInfo> lookup_interface(const Glib::ustring& name), g_dbus_node_info_lookup_interface, refreturn)
  _WRAP_METHOD(Glib::RefPtr<const InterfaceInfo> lookup_interface(const Glib::ustring& name) const, g_dbus_node_info_lookup_interface, constversion, refreturn)

  /** Looks up information about the first interface.
   */
  Glib::RefPtr<InterfaceInfo> lookup_interface();

  /** Looks up information about the first interface.
   */
  Glib::RefPtr<const InterfaceInfo> lookup_interface() const;

  //TODO: _WRAP_METHOD(void generate_xml(guint indent, GString* string_builder), g_dbus_node_info_generate_xml)
};

} //namespace DBus

} // namespace Gio
