import 'package:satu/core/utils/utils_parse.dart';

class ProductDao {
  ProductDao();

  ProductDao.fromMap(dynamic map) {
    id = map['id'] as int;
    categoryId = map['categoryId'] as int;
    count = map['count'] as num;
    price = map['price'] as num;
    productName = cast<String>(map['productName']) ?? '';
    categoryName = cast<String>(map['categoryName']);
    eanCode = cast<String>(map['eanCode']);
    article = map['article'] as int;
    excise = cast<String>(map['excise']);
    transactionId = cast<int>(map['transactionId']);
  }

  int? id;
  int? categoryId;
  num? count;
  num? price;
  String productName = '';
  String? categoryName;
  String? eanCode;
  int? article;
  String? excise;
  int? transactionId;

  Map<String, dynamic> toMap() {
    final Map<String, dynamic> map = <String, dynamic>{
      'id': id,
      'categoryId': categoryId,
      'count': count,
      'price': price,
      'productName': productName,
      'categoryName': categoryName,
      'eanCode': eanCode,
      'article': article,
      'excise': excise,
      'transactionId': transactionId,
    };
    return map;
  }
}
