from PyQt6.QtCore import pyqtSignal
from PyQt6.QtWidgets import QVBoxLayout, QWidget


class BaseWindow(QWidget):
    """
    Base class for all windows.
    """

    def __init__(self, size: tuple, title: str) -> None:
        super().__init__()
        self.window_w, self.window_h = size
        self.title = title
        self._init_ui()

    def _init_ui(self) -> None:
        self.setWindowTitle(self.title)
        frame = self.frameGeometry()
        center_point = self.screen().availableGeometry().center()
        frame.moveCenter(center_point)
        self.setFixedSize(self.window_w, self.window_h)
        self.general_layout = QVBoxLayout()
        self.setLayout(self.general_layout)


class DialogWindow(BaseWindow):
    """
    Base class for all dialog windows (windows that are switched to).
    """

    switch_window = pyqtSignal()

    def __init__(self, size: tuple, title: str) -> None:
        super().__init__(size, title)

    def next_window(self) -> None:
        self.switch_window.emit()
