const String categoryTableName = 'goods_category';
const String categoryColumnId = 'id';
const String categoryColumnParentIn = 'parent_id';
const String categoryColumnName = 'name';
const String categoryColumnAppCompanyId = 'app_company_id';
const String categoryColumnUpdatedAt = 'updated_at';

class Category {

  Category();

  Category.fromMap(Map<String, dynamic> map) {
    id = map[categoryColumnId] as int;
    parentId = map[categoryColumnParentIn] as int;
    name = map[categoryColumnName] as String;
    appCompanyId = map[categoryColumnAppCompanyId] as int;
    updatedAt =  map[categoryColumnUpdatedAt] as String;
  }

  int? id;
  int? parentId;
  String name = '';
  int? appCompanyId;
  String? updatedAt;

  Map<String, dynamic> toMap() {
    final Map<String, dynamic> map = <String, dynamic>{
      categoryColumnParentIn: parentId,
      categoryColumnName: name,
      categoryColumnAppCompanyId: appCompanyId,
      categoryColumnUpdatedAt: updatedAt,
    };
    if (id != null) {
      map[categoryColumnId] = id;
    }
    return map;
  }

}

