// This file generated by libqtelegram-code-generator.
// You can download it from: https://github.com/Aseman-Land/libqtelegram-code-generator
// DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN

#ifndef LQTG_TYPE_PEER
#define LQTG_TYPE_PEER

#include "telegramtypeobject.h"

#include <QMetaType>
#include <QVariant>
#include "../coretypes.h"

#include <QDataStream>

#include <QtGlobal>

class LIBQTELEGRAMSHARED_EXPORT Peer : public TelegramTypeObject
{
public:
    enum PeerClassType {
        typePeerUser = 0x9db1bc6d,
        typePeerChat = 0xbad0e5bb,
        typePeerChannel = 0xbddde532
    };

    Peer(PeerClassType classType = typePeerUser, InboundPkt *in = 0);
    Peer(InboundPkt *in);
    Peer(const Null&);
    Peer(const Peer &another);
    virtual ~Peer();

    void setChannelId(qint32 channelId);
    qint32 channelId() const;

    void setChatId(qint32 chatId);
    qint32 chatId() const;

    void setUserId(qint32 userId);
    qint32 userId() const;

    void setClassType(PeerClassType classType);
    PeerClassType classType() const;

    bool fetch(InboundPkt *in);
    bool push(OutboundPkt *out) const;

    QMap<QString, QVariant> toMap() const;
    static Peer fromMap(const QMap<QString, QVariant> &map);
    static Peer fromJson(const QString &json);

    bool operator ==(const Peer &b) const;
    Peer &operator =(const Peer &b);

    bool operator==(bool stt) const { return isNull() != stt; }
    bool operator!=(bool stt) const { return !operator ==(stt); }

    QByteArray getHash(QCryptographicHash::Algorithm alg = QCryptographicHash::Md5) const;

private:
    qint32 m_channelId;
    qint32 m_chatId;
    qint32 m_userId;
    PeerClassType m_classType;
};

Q_DECLARE_METATYPE(Peer)

QDataStream LIBQTELEGRAMSHARED_EXPORT &operator<<(QDataStream &stream, const Peer &item);
QDataStream LIBQTELEGRAMSHARED_EXPORT &operator>>(QDataStream &stream, Peer &item);

QDebug LIBQTELEGRAMSHARED_EXPORT operator<<(QDebug debug,  const Peer &item);

#endif // LQTG_TYPE_PEER
