const String goodTableName = 'goods';
const String GoodColumnId = 'id';
const String GoodColumnCategoryId = 'category_id';
const String GoodColumnName = 'name';
const String GoodColumnEan = 'ean';
const String GoodColumnArticul = 'articul';
const String GoodColumnPrice = 'price';
const String GoodColumnOptPrice = 'opt_price';
const String GoodColumnBasePrice = 'base_price';
const String GoodColumnDivisible = 'divisible';
const String GoodColumnUpdatedAt = 'updated_at';
const String GoodColumnAppCompanyId = 'app_company_id';

class Good {
  Good();
  Good.fromMap(Map<String, dynamic> map) {
    id = map[GoodColumnId] as int;
    articul = map[GoodColumnArticul] as int;
    name = (map[GoodColumnName] ?? '') as String ;
    price = map[GoodColumnPrice] as num;
    categoryId = map[GoodColumnCategoryId]  as int;
    ean = map[GoodColumnEan] as String;
    appCompanyId = map[GoodColumnAppCompanyId]  as int;
    optPrice = map[GoodColumnOptPrice]  as num;
    basePrice = map[GoodColumnBasePrice]  as num;
    divisible = map[GoodColumnDivisible] as int;
    updatedAt = map[GoodColumnUpdatedAt] as String;
  }

  int? id;
  int? categoryId;
  String name = '';
  String? ean;
  int? articul;
  num? price;
  num? optPrice;
  num? basePrice;
  int? divisible;
  String? updatedAt;
  int? appCompanyId;



  Map<String, dynamic> toMap() {
    final Map<String, dynamic> map = <String, dynamic>{
      GoodColumnArticul: articul,
      GoodColumnName: name,
      GoodColumnPrice: price,
      GoodColumnCategoryId: categoryId,
      GoodColumnEan: ean,
      GoodColumnAppCompanyId: appCompanyId,
      GoodColumnOptPrice: optPrice,
      GoodColumnBasePrice: basePrice,
      GoodColumnDivisible: divisible,
      GoodColumnUpdatedAt: updatedAt,
    };
    if (id != null) {
      map[GoodColumnId] = id;
    }
    return map;
  }




}
