//
// Created by 张雪明 <zhangxueming@uniontech.com> on 2024/11/22.
//

#ifndef UOS_RECOVERY_IMMU_FACTORY_RESTORE_WIDGET_H
#define UOS_RECOVERY_IMMU_FACTORY_RESTORE_WIDGET_H

#include <QWidget>
#include <QLabel>
#include <DPushButton>
#include <DTipLabel>
#include <QVBoxLayout>
#include "utils/global.h"

DWIDGET_USE_NAMESPACE

class RadioItem;

class ImmuFactoryRestoreWidget : public QWidget {
    Q_OBJECT
public:
    explicit ImmuFactoryRestoreWidget(QWidget* parent = nullptr);
    void initUI();
    void doSuccess();
    void doError(int errCode);
    void setTipsVisible(const bool &visible);
    void setTipsLabelText(const QString &msg);
    int showFactoryRestoreTips();
    void setRestartBtnVisible(bool visible);

Q_SIGNALS:
    void immuFactoryRestoreClicked();

private Q_SLOTS:
    void startRestore();

private:
    bool isExistInitBackup();

private:
    QLabel *m_titleLabel = nullptr;
    QLabel *m_restoreLabel = nullptr;
    RadioItem *m_savaUserDataItem = nullptr;
    DTipLabel *m_descriptionLabel = nullptr;
    QWidget* m_loadingWidget;
    Dtk::Widget::DTipLabel* m_tipsLabel = nullptr;
    DPushButton *m_startRestoreBtn = nullptr;
    QVBoxLayout *m_mainLayout = nullptr;
    ActionType m_actionType;
    bool m_existInitBackup = false;
};

#endif //UOS_RECOVERY_IMMU_FACTORY_RESTORE_WIDGET_H
