import 'inventory_status.dart';

/// A single inventory item tracked by the Kell Creations operations platform.
class InventoryItem {
  final String id;
  final String sku;
  final String name;
  final String description;
  final String imageUrl;
  final String category;
  final int quantityOnHand;
  final double unitPrice;
  final int reorderPoint;
  final String? supplier;
  final String? location;
  final InventoryStatus status;
  final DateTime lastUpdated;

  const InventoryItem({
    required this.id,
    required this.sku,
    required this.name,
    required this.description,
    required this.imageUrl,
    required this.category,
    required this.quantityOnHand,
    required this.unitPrice,
    required this.reorderPoint,
    this.supplier,
    this.location,
    required this.status,
    required this.lastUpdated,
  });

  /// Returns a copy of this [InventoryItem] with the given fields replaced.
  InventoryItem copyWith({
    String? id,
    String? sku,
    String? name,
    String? description,
    String? imageUrl,
    String? category,
    int? quantityOnHand,
    double? unitPrice,
    int? reorderPoint,
    String? supplier,
    String? location,
    InventoryStatus? status,
    DateTime? lastUpdated,
  }) {
    return InventoryItem(
      id: id ?? this.id,
      sku: sku ?? this.sku,
      name: name ?? this.name,
      description: description ?? this.description,
      imageUrl: imageUrl ?? this.imageUrl,
      category: category ?? this.category,
      quantityOnHand: quantityOnHand ?? this.quantityOnHand,
      unitPrice: unitPrice ?? this.unitPrice,
      reorderPoint: reorderPoint ?? this.reorderPoint,
      supplier: supplier ?? this.supplier,
      location: location ?? this.location,
      status: status ?? this.status,
      lastUpdated: lastUpdated ?? this.lastUpdated,
    );
  }
}
