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

#include <TelepathyQt/Connection>
#include "types.h"

#include <QtGlobal>

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

#include <QDBusPendingReply>

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

namespace Tp
{
class PendingVariant;
class PendingOperation;
}

namespace Example
{
namespace Client
{

/**
 * \class ConnectionInterfaceHatsInterface
 * \headerfile /cli-connection.h </cli-connection.h>
 *
 * Proxy class providing a 1:1 mapping of the D-Bus interface "com.example.Telepathy.Connection.Interface.Hats".
 */
class  ConnectionInterfaceHatsInterface : public Tp::AbstractInterface
{
    Q_OBJECT

public:
    /**
     * Returns the name of the interface "com.example.Telepathy.Connection.Interface.Hats", which this class
     * represents.
     *
     * \return The D-Bus interface name.
     */
    static inline QLatin1String staticInterfaceName()
    {
        return QLatin1String("com.example.Telepathy.Connection.Interface.Hats");
    }

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

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

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

    /**
     * Creates a ConnectionInterfaceHatsInterface 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 ConnectionInterfaceHatsInterface(const Tp::Client::ConnectionInterface& mainInterface);

    /**
     * Creates a ConnectionInterfaceHatsInterface 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.
     */
    ConnectionInterfaceHatsInterface(const Tp::Client::ConnectionInterface& mainInterface, QObject* parent);

    /**
     * Request all of the DBus properties on the interface.
     *
     * \return A pending variant map which will emit finished when the properties have
     *          been retrieved.
     */
    Tp::PendingVariantMap *requestAllProperties() const
    {
        return internalRequestAllProperties();
    }

public Q_SLOTS:
    /**
     * Begins a call to the D-Bus method \c GetHats on the remote object.
     * 
     * Request a list of the hats worn by the given contacts.
     *
     * Note that \a timeout is ignored as of now. It will be used once
     * http://bugreports.qt.nokia.com/browse/QTBUG-11775 is fixed.
     *
     *
     * \param contact
     *     
     *     The handles of the contacts whose hats are requested
     * \param timeout The timeout in milliseconds.
     *
     * \return
     *     
     *     A list of contacts and their hats.
     */
    inline QDBusPendingReply<Example::ContactHatList> GetHats(const Example::UIntList& contact, int timeout = -1)
    {
        if (!invalidationReason().isEmpty()) {
            return QDBusPendingReply<Example::ContactHatList>(QDBusMessage::createError(
                invalidationReason(),
                invalidationMessage()
            ));
        }

        QDBusMessage callMessage = QDBusMessage::createMethodCall(this->service(), this->path(),
                this->staticInterfaceName(), QLatin1String("GetHats"));
        callMessage << QVariant::fromValue(contact);
        return this->connection().asyncCall(callMessage, timeout);
    }

    /**
     * Begins a call to the D-Bus method \c SetHat on the remote object.
     * 
     * Indicate that the hat currently being worn by the local user has 
     * changed.
     *
     * Note that \a timeout is ignored as of now. It will be used once
     * http://bugreports.qt.nokia.com/browse/QTBUG-11775 is fixed.
     *
     *
     * \param color
     *     
     *     The color of the contact&apos;s hat.
     *
     * \param style
     *     
     *     The style of the contact&apos;s hat.
     *
     * \param properties
     *     
     *     There&apos;s always an a{sv}...
     * \param timeout The timeout in milliseconds.
     */
    inline QDBusPendingReply<> SetHat(const QString& color, uint style, const QVariantMap& properties, int timeout = -1)
    {
        if (!invalidationReason().isEmpty()) {
            return QDBusPendingReply<>(QDBusMessage::createError(
                invalidationReason(),
                invalidationMessage()
            ));
        }

        QDBusMessage callMessage = QDBusMessage::createMethodCall(this->service(), this->path(),
                this->staticInterfaceName(), QLatin1String("SetHat"));
        callMessage << QVariant::fromValue(color) << QVariant::fromValue(style) << QVariant::fromValue(properties);
        return this->connection().asyncCall(callMessage, timeout);
    }

    /**
     * Begins a call to the D-Bus method \c RequestHatPrice on the remote object.
     * 
     * Request the prices of a contact&apos;s current hat.
     *
     * Note that \a timeout is ignored as of now. It will be used once
     * http://bugreports.qt.nokia.com/browse/QTBUG-11775 is fixed.
     *
     *
     * \param contact
     *     
     *     The handle of the contact whose hat we&apos;re interested in 
     *     purchasing.
     * \param timeout The timeout in milliseconds.
     *
     * \return
     *     
     *     The price of the hat.
     */
    inline QDBusPendingReply<Tp::CurrencyAmount> RequestHatPrice(uint contact, int timeout = -1)
    {
        if (!invalidationReason().isEmpty()) {
            return QDBusPendingReply<Tp::CurrencyAmount>(QDBusMessage::createError(
                invalidationReason(),
                invalidationMessage()
            ));
        }

        QDBusMessage callMessage = QDBusMessage::createMethodCall(this->service(), this->path(),
                this->staticInterfaceName(), QLatin1String("RequestHatPrice"));
        callMessage << QVariant::fromValue(contact);
        return this->connection().asyncCall(callMessage, timeout);
    }

Q_SIGNALS:
    /**
     * Represents the signal \c HatsChanged on the remote object.
     * 
     * Emitted when the contact&apos;s hat has changed.
     *
     * \param contact
     *     
     *     The handle representing the contact&apos;s ID on the server
     *
     * \param color
     *     
     *     The color of the contact&apos;s hat.
     *
     * \param style
     *     
     *     The style of the contact&apos;s hat.
     *
     * \param properties
     *     
     *     There&apos;s always an a{sv}. Perhaps there&apos;s some special 
     *     religious reason.
     */
    void HatsChanged(uint contact, const QString& color, uint style, const QVariantMap& properties);

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