<?php

declare(strict_types=1);

namespace Drupal\ffmpeg_media\Service;

/**
 * Persists queue-to-item assignment metadata.
 *
 * @internal
 */
interface QueueAssignmentRepositoryInterface {

  /**
   * Returns whether assignment metadata storage is available.
   */
  #[\NoDiscard]
  public function isAvailable(): bool;

  /**
   * Returns queue assignments keyed by queue item ID.
   *
   * @param array<int, string> $itemIds
   *   Optional queue item IDs to load assignments for.
   *
   * @return array<string, string>
   *   Assignment map.
   */
  #[\NoDiscard]
  public function getAssignments(array $itemIds = []): array;

  /**
   * Saves queue assignment for a single queue item.
   */
  public function persistAssignment(string $itemId, string $queueName): void;

  /**
   * Removes queue assignment for a single queue item.
   */
  public function clearAssignment(string $itemId): void;

  /**
   * Removes queue assignments for multiple queue item IDs.
   *
   * @param array<int, string> $itemIds
   *   Queue item IDs to clear.
   */
  public function clearAssignments(array $itemIds): void;

  /**
   * Removes queue assignments for all items belonging to a media entity.
   */
  public function clearAssignmentsForMedia(int $mediaId): void;

}
