"""Builder for pipeline control section."""

from __future__ import annotations

from PyQt6.QtWidgets import QGroupBox, QHBoxLayout, QLabel, QPushButton, QVBoxLayout


def build_pipeline_group(owner) -> QGroupBox:
    """Create Start/Single/Stop controls section."""
    group = QGroupBox("Pipeline")
    layout = QVBoxLayout(group)
    layout.setSpacing(8)

    action_row = QHBoxLayout()
    action_row.setSpacing(8)

    start_button = QPushButton("Start")
    start_button.clicked.connect(owner._start_run)
    action_row.addWidget(start_button)

    single_button = QPushButton("Single Capture")
    single_button.clicked.connect(owner._start_single_capture)
    action_row.addWidget(single_button)

    stop_button = QPushButton("Stop")
    stop_button.clicked.connect(owner._stop_run)
    action_row.addWidget(stop_button)

    layout.addLayout(action_row)

    hint = QLabel("Start continuous run or single processed collection capture.")
    hint.setObjectName("hintLabel")
    layout.addWidget(hint)
    return group
