import 'publish_status.dart';

/// A product draft that may be published to the WordPress/WooCommerce store.
class ProductDraft {
  final String id;
  final String name;
  final String description;
  final double price;
  final String sku;
  final String category;
  final String imageUrl;
  final PublishStatus status;
  final DateTime lastModified;

  const ProductDraft({
    required this.id,
    required this.name,
    required this.description,
    required this.price,
    required this.sku,
    required this.category,
    required this.imageUrl,
    required this.status,
    required this.lastModified,
  });

  /// Returns a copy of this [ProductDraft] with the given fields replaced.
  ProductDraft copyWith({
    String? id,
    String? name,
    String? description,
    double? price,
    String? sku,
    String? category,
    String? imageUrl,
    PublishStatus? status,
    DateTime? lastModified,
  }) {
    return ProductDraft(
      id: id ?? this.id,
      name: name ?? this.name,
      description: description ?? this.description,
      price: price ?? this.price,
      sku: sku ?? this.sku,
      category: category ?? this.category,
      imageUrl: imageUrl ?? this.imageUrl,
      status: status ?? this.status,
      lastModified: lastModified ?? this.lastModified,
    );
  }
}
