/*
 * This file contains D-Bus client proxy classes generated by qt4-client-gen.py.
 *
 * This file can be distributed under the same terms as the specification from
 * which it was generated.
 */

#ifndef IN_TELEPATHY_QT4_HEADER
#error IN_TELEPATHY_QT4_HEADER
#endif

#include <TelepathyQt4/Types>

#include <QtGlobal>

#include <QString>
#include <QObject>
#include <QVariant>

#include <QDBusPendingReply>

#include <TelepathyQt4/AbstractInterface>
#include <TelepathyQt4/DBusProxy>
#include <TelepathyQt4/Global>

// basically the same as GLib's G_GNUC_DEPRECATED
#ifndef TELEPATHY_GNUC_DEPRECATED
#   if defined(Q_CC_GNUC) && __GNUC__ >= 4
#       define TELEPATHY_GNUC_DEPRECATED __attribute__((__deprecated__))
#   else
#       define TELEPATHY_GNUC_DEPRECATED
#   endif
#endif
namespace Tp
{
namespace Client
{

/**
 * \class ConnectionManagerInterface
 * \headerfile TelepathyQt4/connection-manager.h <TelepathyQt4/ConnectionManager>
 * \ingroup clientcm
 *
 * Proxy class providing a 1:1 mapping of the D-Bus interface "org.freedesktop.Telepathy.ConnectionManager."
 */
class TELEPATHY_QT4_EXPORT ConnectionManagerInterface : public Tp::AbstractInterface
{
    Q_OBJECT

public:
    /**
     * Returns the name of the interface "org.freedesktop.Telepathy.ConnectionManager", which this class
     * represents.
     *
     * \return The D-Bus interface name.
     */
    static inline const char *staticInterfaceName()
    {
        return "org.freedesktop.Telepathy.ConnectionManager";
    }

    /**
     * Creates a ConnectionManagerInterface associated with the given object on the session bus.
     *
     * \param busName Name of the service the object is on.
     * \param objectPath Path to the object on the service.
     * \param parent Passed to the parent class constructor.
     */
    ConnectionManagerInterface(
        const QString& busName,
        const QString& objectPath,
        QObject* parent = 0
    );

    /**
     * Creates a ConnectionManagerInterface associated with the given object on the given bus.
     *
     * \param connection The bus via which the object can be reached.
     * \param busName Name of the service the object is on.
     * \param objectPath Path to the object on the service.
     * \param parent Passed to the parent class constructor.
     */
    ConnectionManagerInterface(
        const QDBusConnection& connection,
        const QString& busName,
        const QString& objectPath,
        QObject* parent = 0
    );

    /**
     * Creates a ConnectionManagerInterface associated with the same object as the given proxy.
     *
     * \param proxy The proxy to use. It will also be the QObject::parent()
     *               for this object.
     */
    ConnectionManagerInterface(Tp::DBusProxy *proxy);

    /**
     * Represents property "Interfaces" on the remote object.
     * 
     * <p>A list of the extra interfaces provided by this connection manager
     *   (i.e. extra functionality that can be provided even before a
     *   connection has been created).</p>
     * 
     * <p>No interfaces suitable for listing in this property are currently
     *   defined; it's provided as a hook for possible future
     *   functionality.</p>
     * 
     * <p>To be compatible with older connection managers, if retrieving
     *   this property fails, clients SHOULD assume that its value is
     *   an empty list.</p>
     */
    Q_PROPERTY(QStringList Interfaces READ Interfaces)

    /**
     * Getter for the remote object property "Interfaces".
     *
     * Don't use this: it blocks the main loop.
     *
     * \return The value of the property, or a default-constructed value
     *          if the property is not readable.
     */
    inline QStringList Interfaces() const TELEPATHY_GNUC_DEPRECATED
    {
        return qvariant_cast<QStringList>(internalPropGet("Interfaces"));
    }

public Q_SLOTS:
    /**
     * Begins a call to the D-Bus method "GetParameters" on the remote object.
     * 
     * Get a list of the parameters which must or may be provided to the 
     * RequestConnection method when connecting to the given protocol, or 
     * registering (the boolean &quot;register&quot; parameter is available, 
     * and set to true).
     *
     * \param protocol
     *     
     *     The required protocol name
     *
     * \return
     *     
     *     An array of structs representing possible parameters.
     */
    inline QDBusPendingReply<Tp::ParamSpecList> GetParameters(const QString& protocol)
    {
        if (!invalidationReason().isEmpty()) {
            return QDBusPendingReply<Tp::ParamSpecList>(QDBusMessage::createError(
                invalidationReason(),
                invalidationMessage()
            ));
        }


        QList<QVariant> argumentList;
        argumentList << QVariant::fromValue(protocol);
        return asyncCallWithArgumentList(QLatin1String("GetParameters"), argumentList);
    }

    /**
     * Begins a call to the D-Bus method "ListProtocols" on the remote object.
     * 
     * Get a list of protocol identifiers that are implemented by this 
     * connection manager.
     *
     * \return
     *     
     *     A array of string protocol identifiers supported by this manager
     */
    inline QDBusPendingReply<QStringList> ListProtocols()
    {
        if (!invalidationReason().isEmpty()) {
            return QDBusPendingReply<QStringList>(QDBusMessage::createError(
                invalidationReason(),
                invalidationMessage()
            ));
        }


        return asyncCall(QLatin1String("ListProtocols"));
    }

    /**
     * Begins a call to the D-Bus method "RequestConnection" on the remote object.
     * 
     * <p>Request a
     *   <tp:dbus-ref namespace="org.freedesktop.Telepathy">Connection</tp:dbus-ref>
     *   object representing a given account on a given
     *   protocol with the given parameters. The method returns the bus name
     *   and the object path where the new Connection object can be found,
     *   which should have the status of Connection_Status_Disconnected, to
     *   allow signal handlers to be attached before connecting is started
     *   with the
     *   <tp:dbus-ref namespace="org.freedesktop.Telepathy.Connection">Connect</tp:dbus-ref>
     *   method.</p>
     * 
     * <p>The parameters which must and may be provided in the parameters
     * dictionary can be discovered with the
     * <tp:member-ref>GetParameters</tp:member-ref> method. These
     * parameters, their types, and their default values may be cached
     * in files so that all available connection managers do not need to be
     * started to discover which protocols are available.</p>
     * 
     * <p>To request values for these parameters from the user, a client must
     * have prior knowledge of the meaning of the parameter names, so the
     * following well-known names and types should be used where appropriate:</p>
     * 
     * <dl>
     *   <dt>account (s)</dt>
     *   <dd>The identifier for the user's account on the server</dd>
     * 
     *   <dt>server (s)</dt>
     *   <dd>A fully qualified domain name or numeric IPv4 or IPv6 address.
     *     Using the fully-qualified domain name form is recommended whenever
     *     possible. If this parameter is specified and the account for that
     *     protocol also specifies a server, this parameter should override
     *     that in the user id.</dd>
     * 
     *   <dt>port (q)</dt>
     *   <dd>A TCP or UDP port number. If this parameter is specified and the
     *     account for that protocol also specifies a port, this parameter
     *     should override that in the account.</dd>
     * 
     *   <dt>password (s)</dt>
     *   <dd>A password associated with the account.</dd>
     * 
     *   <dt>require-encryption (b)</dt>
     *   <dd>Require encryption for this connection. A connection should fail
     *     to connect if require-encryption is set and an encrypted connection
     *     is not possible.</dd>
     * 
     *   <dt>register (b)</dt>
     *   <dd>This account should be created on the server if it does not
     *     already exist.</dd>
     * 
     *   <dt>ident (s)</dt>
     *   <dd>The local username to report to the server if necessary, such as
     *     in IRC.</dd>
     * 
     *   <dt>fullname (s)</dt>
     *   <dd>The user's full name if the service requires this when
     *     authenticating or registering.</dd>
     * 
     *   <dt>stun-server (s)</dt>
     *   <dd>The IP address or FQDN of a STUN server to use for NAT traversal,
     *     without any &quot;:port&quot; suffix.</dd>
     * 
     *   <dt>stun-port (q)</dt>
     *   <dd>The UDP port number on the stun-server to use for STUN. Only
     *     significant if the stun-server is also supplied.</dd>
     * 
     *   <dt>keepalive-interval (u)</dt>
     *   <dd>The time in seconds between pings sent to the server to ensure
     *     that the connection is still alive, or <tt>0</tt> to disable such
     *     pings.</dd>
     * </dl>
     * 
     * <p>Every successful RequestConnection call will cause the emission of a
     * <tp:member-ref>NewConnection</tp:member-ref> signal for the same newly
     * created connection. The
     * requester can use the returned object path and service name
     * independently of the emission of that signal. In that case this signal
     * emission is most useful for, e.g. other processes that are monitoring
     * the creation of new connections.</p>
     *
     * \param protocol
     *     
     *     The protocol identifier
     *
     * \param parameters
     *     
     *     A dictionary mapping parameter names to values of the appropriate 
     *     type, as indicated by GetParameters and the above well-known list.
     *
     * \return
     *     
     *     A D-Bus service name where the new Connection object can be found
     *
     * \return
     *     
     *     The D-Bus object path to the Connection on this service
     */
    inline QDBusPendingReply<QString, QDBusObjectPath> RequestConnection(const QString& protocol, const QVariantMap& parameters)
    {
        if (!invalidationReason().isEmpty()) {
            return QDBusPendingReply<QString, QDBusObjectPath>(QDBusMessage::createError(
                invalidationReason(),
                invalidationMessage()
            ));
        }


        QList<QVariant> argumentList;
        argumentList << QVariant::fromValue(protocol) << QVariant::fromValue(parameters);
        return asyncCallWithArgumentList(QLatin1String("RequestConnection"), argumentList);
    }

Q_SIGNALS:
    /**
     * Represents the signal "NewConnection" on the remote object.
     * 
     * Emitted when a new Connection object is created.
     *
     * \param busName
     *     
     *     The D-Bus service where the connection object can be found
     *
     * \param objectPath
     *     
     *     The object path of the Connection object on this service
     *
     * \param protocol
     *     
     *     The identifier for the protocol this connection uses
     */
    void NewConnection(const QString& busName, const QDBusObjectPath& objectPath, const QString& protocol);

protected:
    virtual void invalidate(Tp::DBusProxy *, const QString &, const QString &);
};
}
}
