#ifndef HPROJECT_H
#define HPROJECT_H

#include <QDateTime>
#include <QJsonDocument>
#include <QJsonObject>
#include <QString>
#include <QUuid>

enum class BladeStatus : int {
    UNREGISTERED = 1,  // 未注册
    REGISTERED = 2,    // 已注册
    BLADED = 3,        // 已爆破
};

class HProject : public QObject {
    Q_OBJECT
    // 定义属性
    Q_PROPERTY(qint64 id READ getId WRITE setId)
    Q_PROPERTY(QString uuid READ getUuid WRITE setUuid)
    Q_PROPERTY(QString name READ getName WRITE setName)
    Q_PROPERTY(QString companyCode READ getCompanyCode WRITE setCompanyCode)
    Q_PROPERTY(QString htid READ getHtid WRITE setHtid)
    Q_PROPERTY(QString xmbh READ getXmbh WRITE setXmbh)
    Q_PROPERTY(QString operatorName READ getOperatorName WRITE setOperatorName)
    Q_PROPERTY(QString operatorIdentity READ getOperatorIdentity WRITE setOperatorIdentity)
    Q_PROPERTY(QString blasterName READ getBlasterName WRITE setBlasterName)
    Q_PROPERTY(QString blasterIdentity READ getBlasterIdentity WRITE setBlasterIdentity)
    Q_PROPERTY(QString addressUuid READ getAddressUuid WRITE setAddressUuid)
    Q_PROPERTY(QString addressPath READ getAddressPath WRITE setAddressPath)
    Q_PROPERTY(QString loraAddress READ getLoraAddress WRITE setLoraAddress)
    Q_PROPERTY(QString loraSn READ getLoraSn WRITE setLoraSn)
    Q_PROPERTY(QString pcSn READ getPcSn WRITE setPcSn)
    Q_PROPERTY(QString detSum READ getDetSum WRITE setDetSum)
    Q_PROPERTY(QString blastCount READ getBlastCount WRITE setBlastCount)
    Q_PROPERTY(QString fileName READ getFileName WRITE setFileName)
    Q_PROPERTY(QString fileUrl READ getFileUrl WRITE setFileUrl)
    Q_PROPERTY(QString blastStatus READ getBlastStatus WRITE setBlastStatus)
    Q_PROPERTY(QDateTime createdAt READ getCreatedAt WRITE setCreatedAt)
    Q_PROPERTY(QDateTime updatedAt READ getUpdatedAt WRITE setUpdatedAt)
    Q_PROPERTY(QDateTime deletedAt READ getDeletedAt WRITE setDeletedAt)
    Q_PROPERTY(qint64 createBy READ getCreateBy WRITE setCreateBy)
    Q_PROPERTY(qint64 updateBy READ getUpdateBy WRITE setUpdateBy)

   public:
    explicit HProject(QObject *parent = nullptr);

    // Getter and Setter methods
    qint64 getId() const;
    void setId(qint64 newId);

    QString getUuid() const;
    void setUuid(const QString &newUuid);

    QString getName() const;
    void setName(const QString &newName);

    QString getCompanyCode() const;
    void setCompanyCode(const QString &newCompanyCode);

    QString getHtid() const;
    void setHtid(const QString &newHtid);

    QString getXmbh() const;
    void setXmbh(const QString &newXmbh);

    QString getOperatorName() const;
    void setOperatorName(const QString &newOperatorName);

    QString getOperatorIdentity() const;
    void setOperatorIdentity(const QString &newOperatorIdentity);

    QString getBlasterName() const;
    void setBlasterName(const QString &newBlasterName);

    QString getBlasterIdentity() const;
    void setBlasterIdentity(const QString &newBlasterIdentity);

    QString getAddressUuid() const;
    void setAddressUuid(const QString &newAddressUuid);

    QString getAddressPath() const;
    void setAddressPath(const QString &newAddressPath);

    QString getPcSn() const;
    void setPcSn(const QString &newPcSn);

    QString getDetSum() const;
    void setDetSum(const QString &newDetSum);

    QString getFileName() const;
    void setFileName(const QString &newFileName);

    QString getFileUrl() const;
    void setFileUrl(const QString &newFileUrl);

    QString getBlastStatus() const;
    void setBlastStatus(const QString &newBlastStatus);

    QDateTime getCreatedAt() const;
    void setCreatedAt(const QDateTime &newCreatedAt);

    QDateTime getUpdatedAt() const;
    void setUpdatedAt(const QDateTime &newUpdatedAt);

    QDateTime getDeletedAt() const;
    void setDeletedAt(const QDateTime &newDeletedAt);

    qint64 getCreateBy() const;
    void setCreateBy(qint64 newCreateBy);

    qint64 getUpdateBy() const;
    void setUpdateBy(qint64 newUpdateBy);

    QByteArray ProjectToJson(const HProject &project);

    QString getLoraAddress() const;
    void setLoraAddress(const QString &newLoraAddress);

    QString getBlastCount() const;
    void setBlastCount(const QString &newBlastCount);

    QString getLoraSn() const;
    void setLoraSn(const QString &newLoraSn);

   private:
    qint64 id;
    QString uuid;
    QString name;
    QString companyCode;
    QString htid;
    QString xmbh;
    QString operatorName;
    QString operatorIdentity;
    QString blasterName;
    QString blasterIdentity;
    QString addressUuid;
    QString addressPath;
    QString loraAddress;
    QString loraSn;
    QString pcSn;
    QString detSum;
    QString blastCount;
    QString fileName;
    QString fileUrl;
    QString blastStatus;
    QDateTime createdAt;
    QDateTime updatedAt;
    QDateTime deletedAt;
    qint64 createBy;
    qint64 updateBy;
};

#endif  // HPROJECT_H
