<?php

declare(strict_types=1);

namespace Drupal\flowdrop_interrupt\Controller;

use Drupal\Core\Controller\ControllerBase;
use Drupal\flowdrop_interrupt\Form\InterruptFilterForm;
use Drupal\flowdrop_interrupt\Form\InterruptInboxForm;

/**
 * Controller for the HITL interrupt inbox page.
 *
 * Assembles the exposed filter form and the selectable inbox form. The heavy
 * lifting (querying, rendering rows, bulk dismissal) lives in those forms;
 * this controller only stacks them.
 *
 * Only interrupts whose handler implements {@see HitlInterruptHandlerInterface}
 * are listed — operational types (sub-workflow execution, scheduled
 * continuations, etc.) are resolved by the runtime and hidden from the
 * human-facing inbox.
 *
 * @internal This class is not part of the public API and may change without notice.
 */
final class InterruptInboxController extends ControllerBase {

  /**
   * Renders the interrupt inbox: filter controls above a selectable table.
   *
   * @return array<string, mixed>
   *   A render array.
   */
  public function page(): array {
    return [
      'filter' => $this->formBuilder()->getForm(InterruptFilterForm::class),
      'inbox' => $this->formBuilder()->getForm(InterruptInboxForm::class),
      '#cache' => ['max-age' => 0],
    ];
  }

}
