2025-07-30 22:38:44 +07:00
|
|
|
import 'dart:developer';
|
|
|
|
|
|
|
|
|
|
import 'package:image_picker/image_picker.dart';
|
|
|
|
|
|
|
|
|
|
class ProductRequestModel {
|
2025-08-03 00:35:00 +07:00
|
|
|
final String? id;
|
2025-07-30 22:38:44 +07:00
|
|
|
final String name;
|
|
|
|
|
final int price;
|
|
|
|
|
final int stock;
|
|
|
|
|
final int categoryId;
|
|
|
|
|
final int isBestSeller;
|
|
|
|
|
final XFile? image;
|
|
|
|
|
final String? printerType;
|
|
|
|
|
ProductRequestModel({
|
|
|
|
|
this.id,
|
|
|
|
|
required this.name,
|
|
|
|
|
required this.price,
|
|
|
|
|
required this.stock,
|
|
|
|
|
required this.categoryId,
|
|
|
|
|
required this.isBestSeller,
|
|
|
|
|
this.image,
|
|
|
|
|
this.printerType,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
Map<String, String> toMap() {
|
|
|
|
|
log("toMap: $isBestSeller");
|
|
|
|
|
final map = {
|
|
|
|
|
'name': name,
|
|
|
|
|
'price': price.toString(),
|
|
|
|
|
'stock': stock.toString(),
|
|
|
|
|
'category_id': categoryId.toString(),
|
|
|
|
|
'is_best_seller': isBestSeller.toString(),
|
|
|
|
|
'printer_type': printerType ?? '',
|
|
|
|
|
};
|
2025-08-03 00:35:00 +07:00
|
|
|
|
2025-07-30 22:38:44 +07:00
|
|
|
if (id != null) {
|
|
|
|
|
map['id'] = id.toString();
|
|
|
|
|
}
|
2025-08-03 00:35:00 +07:00
|
|
|
|
2025-07-30 22:38:44 +07:00
|
|
|
return map;
|
|
|
|
|
}
|
|
|
|
|
}
|