<?php

declare(strict_types=1);

namespace Drupal\ffmpeg_media\Form;

use Drupal\Core\Config\Config;
use Drupal\ffmpeg_media\Form\SettingsTab\AdvancedSettingsBuilder;
use Drupal\ffmpeg_media\Form\SettingsTab\AudioSettingsBuilder;
use Drupal\ffmpeg_media\Form\SettingsTab\FfmpegSettingsBuilder;
use Drupal\ffmpeg_media\Form\SettingsTab\GeneralSettingsBuilder;
use Drupal\ffmpeg_media\Form\SettingsTab\HardwareSettingsBuilder;
use Drupal\ffmpeg_media\Form\SettingsTab\ManifestSettingsBuilder;
use Drupal\ffmpeg_media\Form\SettingsTab\ProcessorSettingsBuilder;
use Drupal\ffmpeg_media\Form\SettingsTab\QueueSettingsBuilder;
use Drupal\ffmpeg_media\Form\SettingsTab\RetrySettingsBuilder;
use Drupal\ffmpeg_media\Form\SettingsTab\SecuritySettingsBuilder;
use Drupal\ffmpeg_media\Form\SettingsTab\StatusSettingsBuilder;
use Drupal\ffmpeg_media\Form\SettingsTab\WhisperSettingsBuilder;

/**
 * Builds form sections for the FFmpeg Media settings form.
 *
 * Delegates each tab to a dedicated per-tab builder class.
 */
final class SettingsFormBuilder implements SettingsFormBuilderInterface {

  /**
   * Constructs a SettingsFormBuilder object.
   *
   * @param \Drupal\ffmpeg_media\Form\SettingsTab\StatusSettingsBuilder $statusBuilder
   *   Status tab builder.
   * @param \Drupal\ffmpeg_media\Form\SettingsTab\GeneralSettingsBuilder $generalBuilder
   *   General tab builder.
   * @param \Drupal\ffmpeg_media\Form\SettingsTab\FfmpegSettingsBuilder $ffmpegBuilder
   *   FFmpeg executables tab builder.
   * @param \Drupal\ffmpeg_media\Form\SettingsTab\QueueSettingsBuilder $queueBuilder
   *   Queue tab builder.
   * @param \Drupal\ffmpeg_media\Form\SettingsTab\HardwareSettingsBuilder $hardwareBuilder
   *   Hardware acceleration tab builder.
   * @param \Drupal\ffmpeg_media\Form\SettingsTab\ProcessorSettingsBuilder $processorBuilder
   *   Processors tab builder.
   * @param \Drupal\ffmpeg_media\Form\SettingsTab\ManifestSettingsBuilder $manifestBuilder
   *   Manifest tab builder.
   * @param \Drupal\ffmpeg_media\Form\SettingsTab\AudioSettingsBuilder $audioBuilder
   *   Audio tab builder.
   * @param \Drupal\ffmpeg_media\Form\SettingsTab\WhisperSettingsBuilder $whisperBuilder
   *   Whisper transcription tab builder.
   * @param \Drupal\ffmpeg_media\Form\SettingsTab\RetrySettingsBuilder $retryBuilder
   *   Retry and recovery tab builder.
   * @param \Drupal\ffmpeg_media\Form\SettingsTab\AdvancedSettingsBuilder $advancedBuilder
   *   Advanced settings tab builder.
   * @param \Drupal\ffmpeg_media\Form\SettingsTab\SecuritySettingsBuilder $securityBuilder
   *   Security settings tab builder.
   */
  public function __construct(
    protected readonly StatusSettingsBuilder $statusBuilder,
    protected readonly GeneralSettingsBuilder $generalBuilder,
    protected readonly FfmpegSettingsBuilder $ffmpegBuilder,
    protected readonly QueueSettingsBuilder $queueBuilder,
    protected readonly HardwareSettingsBuilder $hardwareBuilder,
    protected readonly ProcessorSettingsBuilder $processorBuilder,
    protected readonly ManifestSettingsBuilder $manifestBuilder,
    protected readonly AudioSettingsBuilder $audioBuilder,
    protected readonly WhisperSettingsBuilder $whisperBuilder,
    protected readonly RetrySettingsBuilder $retryBuilder,
    protected readonly AdvancedSettingsBuilder $advancedBuilder,
    protected readonly SecuritySettingsBuilder $securityBuilder,
  ) {
  }

  /**
   * {@inheritdoc}
   */
  #[\Override]
  public function buildStatusSection(array &$form, Config $config): void {
    $this->statusBuilder->build($form, $config);
  }

  /**
   * {@inheritdoc}
   */
  #[\Override]
  public function buildGeneralSection(array &$form, Config $config): void {
    $this->generalBuilder->build($form, $config);
  }

  /**
   * {@inheritdoc}
   */
  #[\Override]
  public function buildFfmpegSection(array &$form, Config $config): void {
    $this->ffmpegBuilder->build($form, $config);
  }

  /**
   * {@inheritdoc}
   */
  #[\Override]
  public function buildQueueSection(array &$form, Config $config): void {
    $this->queueBuilder->build($form, $config);
  }

  /**
   * {@inheritdoc}
   */
  #[\Override]
  public function buildHardwareSection(array &$form, Config $config): void {
    $this->hardwareBuilder->build($form, $config);
  }

  /**
   * {@inheritdoc}
   */
  #[\Override]
  public function buildProcessorSection(array &$form, Config $config): void {
    $this->processorBuilder->build($form, $config);
  }

  /**
   * {@inheritdoc}
   */
  #[\Override]
  public function buildManifestSection(array &$form, Config $config): void {
    $this->manifestBuilder->build($form, $config);
  }

  /**
   * {@inheritdoc}
   */
  #[\Override]
  public function buildAudioSection(array &$form, Config $config): void {
    $this->audioBuilder->build($form, $config);
  }

  /**
   * {@inheritdoc}
   */
  #[\Override]
  public function buildWhisperSection(array &$form, Config $config): void {
    $this->whisperBuilder->build($form, $config);
  }

  /**
   * {@inheritdoc}
   */
  #[\Override]
  public function buildRetrySection(array &$form, Config $config): void {
    $this->retryBuilder->build($form, $config);
  }

  /**
   * {@inheritdoc}
   */
  #[\Override]
  public function buildAdvancedSection(array &$form, Config $config): void {
    $this->advancedBuilder->build($form, $config);
  }

  /**
   * {@inheritdoc}
   */
  #[\Override]
  public function buildSecuritySection(array &$form, Config $config): void {
    $this->securityBuilder->build($form, $config);
  }

}
