#ifndef SINGLEPRODUCTOBJECT_H
#define SINGLEPRODUCTOBJECT_H

#include <QObject>
#include <QJsonObject>
#include <QVariant>
#include <QMetaProperty>

class SingleProductObject : public QObject
{
    Q_OBJECT
    Q_PROPERTY (QString code READ getCode WRITE setCode)
    Q_PROPERTY (bool isCoupon READ getIsCoupon WRITE setIsCoupon)

public:
    explicit SingleProductObject(QObject *parent = 0):QObject(parent){}
    SingleProductObject(const SingleProductObject& singleProduct,QObject* parent=0);
    SingleProductObject& operator =(const SingleProductObject& singleProduct);
    void FetchDataFromJson(const QJsonObject &json);
    QString code;
    bool isCoupon; //此单品是否是券;

protected:
    inline QString getCode(){ return code; }
    inline void setCode(const QString& v){ code = v; }

    inline bool getIsCoupon(){ return isCoupon; }
    inline void setIsCoupon(const bool& v){ isCoupon = v; }


};

#endif // SINGLEPRODUCTOBJECT_H
