#ifndef HBLASTRECORD_H
#define HBLASTRECORD_H

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

#include "../blastRegRecord/hblastregrecord.h"

class HBlastRecord : public QObject {
    Q_OBJECT
    // 定义属性
    Q_PROPERTY(qint64 id READ getId WRITE setId)
    Q_PROPERTY(QString uuid READ getUuid WRITE setUuid)
    Q_PROPERTY(QString projectName READ getProjectName WRITE setProjectName)
    Q_PROPERTY(QString projectHtid READ getProjectHtid WRITE setProjectHtid)
    Q_PROPERTY(QString projectXmbh READ getProjectXmbh WRITE setProjectXmbh)
    Q_PROPERTY(QString operatorName READ getOperatorName WRITE setOperatorName)
    Q_PROPERTY(QString phone READ getPhone WRITE setPhone)
    Q_PROPERTY(QString operatorIdentity READ getOperatorIdentity WRITE setOperatorIdentity)
    Q_PROPERTY(QString equipmentSn READ getEquipmentSn WRITE setEquipmentSn)
    Q_PROPERTY(QString companyCode READ getCompanyCode WRITE setCompanyCode)
    Q_PROPERTY(QString appVersion READ getAppVersion WRITE setAppVersion)
    Q_PROPERTY(QString longitude READ getLongitude WRITE setLongitude)
    Q_PROPERTY(QString latitude READ getLatitude WRITE setLatitude)
    Q_PROPERTY(int equipmentCount READ getEquipmentCount WRITE setEquipmentCount)
    Q_PROPERTY(int regDetCount READ getRegDetCount WRITE setRegDetCount)
    Q_PROPERTY(int errorDetCount READ getErrorDetCount WRITE setErrorDetCount)
    Q_PROPERTY(bool isOfflineBlast READ getIsOfflineBlast WRITE setIsOfflineBlast)
    Q_PROPERTY(QDateTime blastAt READ getBlastAt WRITE setBlastAt)
    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 HBlastRecord(QObject *parent = nullptr);
    // Getter and Setter methods
    qint64 getId() const;
    void setId(qint64 newId);

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

    QString getProjectName() const;
    void setProjectName(const QString &newProjectName);

    QString getProjectHtid() const;
    void setProjectHtid(const QString &newProjectHtid);

    QString getProjectXmbh() const;
    void setProjectXmbh(const QString &newProjectXmbh);

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

    QString getPhone() const;
    void setPhone(const QString &newPhone);

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

    QString getEquipmentSn() const;
    void setEquipmentSn(const QString &newEquipmentSn);

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

    QString getAppVersion() const;
    void setAppVersion(const QString &newAppVersion);

    QString getLongitude() const;
    void setLongitude(const QString &newLongitude);

    QString getLatitude() const;
    void setLatitude(const QString &newLatitude);

    int getEquipmentCount() const;
    void setEquipmentCount(int newEquipmentCount);

    int getRegDetCount() const;
    void setRegDetCount(int newRegDetCount);

    int getErrorDetCount() const;
    void setErrorDetCount(int newErrorDetCount);

    QDateTime getBlastAt() const;
    void setBlastAt(const QDateTime &newBlastAt);

    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);

    void setIsOfflineBlast(bool isOfflineBlast);
    bool getIsOfflineBlast() const;

    QList<HBlastEquipmentRecord *> getEquipmentRecords() const;
    void setEquipmentRecords(const QList<HBlastEquipmentRecord *> records);

    QJsonObject ToJson();

   private:
    qint64 id;
    QString uuid;
    QString projectName;
    QString projectHtid;
    QString projectXmbh;
    QString operatorName;
    QString phone;
    QString operatorIdentity;
    QString equipmentSn;
    QString companyCode;
    QString appVersion;
    QString longitude;
    QString latitude;
    int equipmentCount;
    int regDetCount;
    int errorDetCount;
    QDateTime blastAt;
    QDateTime createdAt;
    QDateTime updatedAt;
    QDateTime deletedAt;
    qint64 createBy;
    qint64 updateBy;
    bool isOfflineBlast;  // 是否离线爆破
    QList<HBlastEquipmentRecord *> equipmentRecords;
};

#endif  // HBLASTRECORD_H
