// Sane Break is a gentle break reminder that helps you avoid mindlessly skipping breaks
// Copyright (C) 2024-2026 Sane Break developers
// SPDX-License-Identifier: GPL-3.0-or-later

#pragma once

#include <QFlags>
#include <QList>
#include <QMainWindow>
#include <QObject>
#include <QScreen>

#include "core/flags.h"
#include "core/preferences.h"

struct BreakWindowData {
  int totalSeconds;
  bool isPostponed = false;
  struct {
    QString prompt;
    QString fullScreen;
  } message;
  struct {
    QColor mainBackground;
    QColor highlightBackground;
    QColor messageColor;
    QColor countDownColor;
    int flashAnimationDuration;
    QString backgroundImage;
  } theme;
  struct {
    bool prograssBar;
    bool countdown;
    bool clock;
    bool endTime;
    bool buttons;
  } show;
};

class AbstractBreakWindows : public QObject {
  Q_OBJECT
 public:
  enum class Button {
    LockScreen = 1 << 0,
    ExitForceBreak = 1 << 1,
  };
  Q_DECLARE_FLAGS(Buttons, Button)
  using QObject::QObject;
  ~AbstractBreakWindows() = default;
  virtual void create(BreakType, SanePreferences*, int breakDuration,
                      bool isPostponed = false) = 0;
  virtual void destroy() = 0;
  virtual void setTime(int remainingTime) = 0;
  virtual void showFullScreen() = 0;
  virtual void showFlashPrompt() = 0;
  virtual void showButtons(Buttons, bool show = true) = 0;
  virtual void playEnterSound(BreakType, SanePreferences*) = 0;
  virtual void playExitSound(BreakType, SanePreferences*) = 0;
  virtual void showHeadsUp(int totalSeconds, BreakType breakType,
                           SanePreferences* preferences) = 0;
  virtual void setHeadsUpTime(int remainingTime) = 0;
  virtual void hideHeadsUp() = 0;

 signals:
  void lockScreenRequested();
  void exitForceBreakRequested();
  void startBreakRequested();
};

Q_DECLARE_OPERATORS_FOR_FLAGS(AbstractBreakWindows::Buttons)
