/*
 * 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 PropertiesInterfaceInterface
 * \headerfile TelepathyQt4/properties.h <TelepathyQt4/Properties>
 * \ingroup clientprops
 *
 * Proxy class providing a 1:1 mapping of the D-Bus interface "org.freedesktop.Telepathy.Properties."
 */
class TELEPATHY_QT4_EXPORT PropertiesInterfaceInterface : public Tp::AbstractInterface
{
    Q_OBJECT

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

    /**
     * Creates a PropertiesInterfaceInterface 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.
     */
    PropertiesInterfaceInterface(
        const QString& busName,
        const QString& objectPath,
        QObject* parent = 0
    );

    /**
     * Creates a PropertiesInterfaceInterface 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.
     */
    PropertiesInterfaceInterface(
        const QDBusConnection& connection,
        const QString& busName,
        const QString& objectPath,
        QObject* parent = 0
    );

    /**
     * Creates a PropertiesInterfaceInterface 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.
     */
    PropertiesInterfaceInterface(Tp::DBusProxy *proxy);

    /**
     * Creates a PropertiesInterfaceInterface associated with the same object as the given proxy.
     * Additionally, the created proxy will have the same parent as the given
     * proxy.
     *
     * \param mainInterface The proxy to use.
     */
    explicit PropertiesInterfaceInterface(const Tp::AbstractInterface& mainInterface);

    /**
     * Creates a PropertiesInterfaceInterface associated with the same object as the given proxy.
     * However, a different parent object can be specified.
     *
     * \param mainInterface The proxy to use.
     * \param parent Passed to the parent class constructor.
     */
    PropertiesInterfaceInterface(const Tp::AbstractInterface& mainInterface, QObject* parent);

public Q_SLOTS:
    /**
     * Begins a call to the D-Bus method "GetProperties" on the remote object.
     * 
     * Returns an array of (identifier, value) pairs containing the current 
     * values of the given properties.
     *
     * \param properties
     *     
     *     An array of property identifiers
     *
     * \return
     *     
     *     <p>An array of structs containing:</p>
     *     <ul>
     *       <li>integer identifiers</li>
     *       <li>variant boxed values</li>
     *     </ul>
     */
    inline QDBusPendingReply<Tp::PropertyValueList> GetProperties(const Tp::UIntList& properties)
    {
        if (!invalidationReason().isEmpty()) {
            return QDBusPendingReply<Tp::PropertyValueList>(QDBusMessage::createError(
                invalidationReason(),
                invalidationMessage()
            ));
        }


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

    /**
     * Begins a call to the D-Bus method "ListProperties" on the remote object.
     * 
     * Returns a dictionary of the properties available on this channel.
     *
     * \return
     *     
     *     An array of structs containing: an integer identifier a string 
     *     property name a string representing the D-Bus signature of this 
     *     property a bitwise OR of the flags applicable to this property
     */
    inline QDBusPendingReply<Tp::PropertySpecList> ListProperties()
    {
        if (!invalidationReason().isEmpty()) {
            return QDBusPendingReply<Tp::PropertySpecList>(QDBusMessage::createError(
                invalidationReason(),
                invalidationMessage()
            ));
        }


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

    /**
     * Begins a call to the D-Bus method "SetProperties" on the remote object.
     * 
     * <p>Takes an array of (identifier, value) pairs containing desired
     *   values to set the given properties. In the case of any errors, no
     *   properties will be changed. When the changes have been acknowledged
     *   by the server, the PropertiesChanged signal will be emitted.</p>
     * 
     * <p>All properties given must have the PROPERTY_FLAG_WRITE flag, or
     * PermissionDenied will be returned. If any variants are of the wrong
     * type, NotAvailable will be returned.  If any given property identifiers
     * are invalid, InvalidArgument will be returned.</p>
     *
     * \param properties
     *     
     *     An array mapping integer property identifiers to boxed values
     */
    inline QDBusPendingReply<> SetProperties(const Tp::PropertyValueList& properties)
    {
        if (!invalidationReason().isEmpty()) {
            return QDBusPendingReply<>(QDBusMessage::createError(
                invalidationReason(),
                invalidationMessage()
            ));
        }


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

Q_SIGNALS:
    /**
     * Represents the signal "PropertiesChanged" on the remote object.
     * 
     * Emitted when the value of readable properties has changed.
     *
     * \param properties
     *     
     *     <p>An array of structs containing:</p>
     *     <ul>
     *       <li>integer identifiers</li>
     *       <li>variant boxed values</li>
     *     </ul>
     *     <p>The array should contain only properties whose values have
     *       actually changed.</p>
     */
    void PropertiesChanged(const Tp::PropertyValueList& properties);

    /**
     * Represents the signal "PropertyFlagsChanged" on the remote object.
     * 
     * Emitted when the flags of some room properties have changed.
     *
     * \param properties
     *     
     *     <p>An array of structs containing:</p>
     *     <ul>
     *       <li>integer identifiers</li>
     *       <li>a bitwise OR of the current flags</li>
     *     </ul>
     *     <p>The array should contain only properties whose flags have actually
     *       changed.</p>
     */
    void PropertyFlagsChanged(const Tp::PropertyFlagsChangeList& properties);

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