class ProductRequestModel {
  final String? id;
  final String name;
  final String? description;
  final String categoryId;
  final String? sku;
  final String? barcode;
  final int price;
  final int cost;
  final bool isActive;
  final bool hasVariants;
  final String imageUrl;
  final String? printerType;

  ProductRequestModel({
    this.id,
    required this.name,
    this.description,
    required this.categoryId,
    this.sku,
    this.barcode,
    required this.price,
    required this.cost,
    this.isActive = true,
    this.hasVariants = false,
    required this.imageUrl,
    this.printerType,
  });

  Map<String, dynamic> toMap() {
    final map = <String, dynamic>{
      'name': name,
      'description': description ?? '',
      'category_id': categoryId,
      'sku': sku ?? '',
      'barcode': barcode ?? '',
      'price': price,
      'cost': cost,
      'is_active': isActive,
      'has_variants': hasVariants,
      'image_url': imageUrl,
      'printer_type': printerType ?? '',
    };

    if (id != null) {
      map['id'] = id;
    }

    return map;
  }
}
