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

/// Use case: create a new product in the catalog.
///
/// Delegates to [ProductPublishingRepository.createProduct] and returns the
/// created [ProductDraft].
class CreateProduct {
  final ProductPublishingRepository _repository;

  const CreateProduct(this._repository);

  Future<ProductDraft> call({
    required String name,
    required double price,
    String description = '',
    String sku = '',
    int? categoryId,
    PublishStatus status = PublishStatus.draft,
  }) {
    return _repository.createProduct(
      name: name,
      price: price,
      description: description,
      sku: sku,
      categoryId: categoryId,
      status: status,
    );
  }
}
