// 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_PHONECONNECTION
#define LQTG_TYPE_PHONECONNECTION

#include "telegramtypeobject.h"

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

#include <QDataStream>

#include <QtGlobal>
#include <QString>
#include <QByteArray>

class LIBQTELEGRAMSHARED_EXPORT PhoneConnection : public TelegramTypeObject
{
public:
    enum PhoneConnectionClassType {
        typePhoneConnection = 0x9d4c17c0
    };

    PhoneConnection(PhoneConnectionClassType classType = typePhoneConnection, InboundPkt *in = 0);
    PhoneConnection(InboundPkt *in);
    PhoneConnection(const Null&);
    PhoneConnection(const PhoneConnection &another);
    virtual ~PhoneConnection();

    void setId(qint64 id);
    qint64 id() const;

    void setIp(const QString &ip);
    QString ip() const;

    void setIpv6(const QString &ipv6);
    QString ipv6() const;

    void setPeerTag(const QByteArray &peerTag);
    QByteArray peerTag() const;

    void setPort(qint32 port);
    qint32 port() const;

    void setClassType(PhoneConnectionClassType classType);
    PhoneConnectionClassType classType() const;

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

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

    bool operator ==(const PhoneConnection &b) const;
    PhoneConnection &operator =(const PhoneConnection &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:
    qint64 m_id;
    QString m_ip;
    QString m_ipv6;
    QByteArray m_peerTag;
    qint32 m_port;
    PhoneConnectionClassType m_classType;
};

Q_DECLARE_METATYPE(PhoneConnection)

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

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

#endif // LQTG_TYPE_PHONECONNECTION
