<?php

declare(strict_types=1);

namespace Drupal\ffmpeg_media\Resolver;

/**
 * Value object containing resolved video sources for playback.
 *
 * Returned by VideoSourceResolverInterface::resolveSources(). Contains
 * the converted video sources (or empty if none), an optional poster
 * image URL, subtitle tracks, and a flag indicating whether the sources
 * came from converted outputs or not.
 */
final readonly class ResolvedSources {

  /**
   * Constructs a ResolvedSources object.
   *
   * @param array<int, array{src: string, type: string}> $sources
   *   Video source URLs with MIME types, in priority order.
   * @param string|null $poster
   *   Poster image URL, or NULL if no thumbnail exists.
   * @param array<int, array{src: string, kind: string, language: string, label: string}> $subtitles
   *   Subtitle/caption tracks.
   * @param bool $isConverted
   *   TRUE if sources are from converted outputs, FALSE if no converted
   *   outputs were found (formatter should use original file).
   * @param array<int, string> $cacheTags
   *   Cache tags for render invalidation when outputs change.
   */
  public function __construct(
    public array $sources,
    public ?string $poster,
    public array $subtitles,
    public bool $isConverted,
    public array $cacheTags = [],
  ) {}

}
