import '../domain/product_draft.dart';
import '../domain/product_publishing_repository.dart';

/// Use case: update the images attached to a product.
///
/// [imageIds] is an ordered list of WooCommerce media attachment IDs.
/// The first ID becomes the featured image (position 0).
/// Pass an empty list to remove all images.
///
/// Delegates to [ProductPublishingRepository.updateProductImages] and returns
/// the updated [ProductDraft] reflecting the new primary image URL.
class UpdateProductImages {
  final ProductPublishingRepository _repository;

  const UpdateProductImages(this._repository);

  Future<ProductDraft> call(String id, List<int> imageIds) {
    return _repository.updateProductImages(id, imageIds);
  }
}
