#ifndef STHREADSENDDICOM_H
#define STHREADSENDDICOM_H

#include <QThread>
#include <QMutex>
#include <QDebug>
#include <QMutexLocker>

#include "qsthread.h"

#include "common.h"

#include "sdcmworklist.h"

#ifdef _SYOLOV5
#include "syolov5.h"
#endif

#include <QImage>

#include <QTimer>
#include <QElapsedTimer>
#include "sdatabase.h"
using namespace SUTIL;

#include "cscallbacksendprogress.h"

class SThreadSendDICOM : public QSThread
{
    Q_OBJECT
public:
    explicit SThreadSendDICOM();

    virtual ~SThreadSendDICOM();

    virtual void InnerRun();

    virtual void Init();



    void SetAutoSendImage();
    void SetSendImageList(const QList<QStringList> listFile);
    void SetCheckSendImageList(const QList<QStringList> listFile);

    void ClearListAutoSend(vector<CAPTURE_IMAGE*>& list);

    bool IsSendFailed();

    void SetExitAutoSend();
    void SetExitSendImageList();

    bool IsExitSendImageList();

    void AutoSend();

    void SendImageList();

    vector<QString> GetListAutoSendCompleteFile();
    vector<QString> GetListImageSendCompleteFile();

    void ClearListCompleteFile();
signals:
    void UpdateSendFailed();
    void SetSendProgress(int nProgress, int nTotal);

protected:
    bool m_bExitAutoSend;
    bool m_bExitSendImageList;
    bool m_bSendFailed;

    int m_nSendPrev;

    QMutex m_LockState;
    QList<QStringList> m_ListSendFile;
    vector<QString> m_ListAutoSendCompleteFile;
    vector<QString> m_ListImageSendCompleteFile;

    QElapsedTimer m_TimeAutoSend;



    CSCallbackSendProgress* m_pCallback;

    bool m_bExecAutoSend;
    bool m_bExecCheckSendImageList;
};

#endif // STHREADSENDDICOM_H
