import 'm_asset_status_model.dart'; import 'warehouse_mode.dart'; class AssetStatusModel { int? id; int? peti_id; DateTime? exit_at; String? exit_pic; int? exit_warehouse; DateTime? enter_at; String? enter_pic; int? enter_warehouse; DateTime? est_pengembalian; String? kondisi_peti; String? created_by; String? updated_by; PetiAssetModel? peti; WarehouseModel? warehouse; WarehouseEnterModel? warehouse_enter; AssetStatusModel({ this.id, this.peti_id, this.exit_at, this.exit_pic, this.exit_warehouse, this.enter_at, this.enter_pic, this.enter_warehouse, this.est_pengembalian, this.kondisi_peti, this.created_by, this.updated_by, this.peti, this.warehouse, this.warehouse_enter, }); factory AssetStatusModel.fromJson(Map json) { return AssetStatusModel( id: json['id'], peti_id: json['peti_id'] != null ? int.parse(json['peti_id'].toString()) : null, exit_at: json['exit_at'] != null ? DateTime.parse(json['exit_at']) : null, exit_pic: json['exit_pic'], exit_warehouse: json['exit_warehouse'] != null ? int.parse(json['exit_warehouse'].toString()) : null, enter_at: json['enter_at'] != null ? DateTime.parse(json['enter_at']) : null, enter_pic: json['enter_pic'] != null ? json['enter_pic'] : null, enter_warehouse: json['enter_warehouse'] != null ? int.parse(json['enter_warehouse'].toString()) : null, est_pengembalian: json['est_pengembalian'] != null ? DateTime.parse(json['est_pengembalian']) : null, kondisi_peti: json['kondisi_peti'] != null ? json['kondisi_peti'] : 'null', created_by: json['created_by'] != null ? json['created_by'] : 'null', updated_by: json['updated_by'] != null ? json['updated_by'] : 'null', peti: PetiAssetModel.fromJson(json['peti'] != null ? json['peti'] : null), warehouse: WarehouseModel.fromJson(json['warehouse'] != null ? json['warehouse'] : {'id': 0, 'name': 'null'}), warehouse_enter: WarehouseEnterModel.fromJson( json['warehouse_enter'] != null ? json['warehouse_enter'] : {'id': 0, 'name': 'null'}), ); } Map toJson() => { 'id': id, 'peti_id': peti_id, 'exit_at': exit_at, 'exit_pic': exit_pic, 'exit_warehouse': exit_warehouse, 'enter_at': enter_at, 'enter_pic': enter_pic, 'enter_warehouse': enter_warehouse, 'est_pengembalian': est_pengembalian, 'kondisi_peti': kondisi_peti, 'created_by': created_by, 'updated_by': updated_by, 'peti': peti!.toJson(), 'warehouse': warehouse!.toJson(), 'warehouse_enter': warehouse_enter!.toJson(), }; }