import 'ShiftLocation.dart'; class LiveRoster { LiveRoster({ this.id, this.rotaTemplateId, this.rosterStartDate, this.rosterEndDate, this.templateWeeks, this.shiftLocation, this.active, this.lastModifiedBy, this.createdAt, this.updatedAt, this.v,}); LiveRoster.fromJson(dynamic json) { id = json['_id']; rotaTemplateId = json['rotaTemplateId']; rosterStartDate = json['rosterStartDate']; rosterEndDate = json['rosterEndDate']; templateWeeks = json['templateWeeks']; if (json['shiftLocation'] != null && json['shiftLocation'] is List) { shiftLocation = []; json['shiftLocation'].forEach((v) { shiftLocation?.add(ShiftLocation.fromJson(v)); }); } active = json['active']; lastModifiedBy = json['lastModifiedBy']; createdAt = json['createdAt']; updatedAt = json['updatedAt']; v = json['__v']; } String? id; String? rotaTemplateId; int? rosterStartDate; int? rosterEndDate; int? templateWeeks; List? shiftLocation; bool? active; String? lastModifiedBy; String? createdAt; String? updatedAt; int? v; Map toJson() { final map = {}; map['_id'] = id; map['rotaTemplateId'] = rotaTemplateId; map['rosterStartDate'] = rosterStartDate; map['rosterEndDate'] = rosterEndDate; map['templateWeeks'] = templateWeeks; if (shiftLocation != null) { map['shiftLocation'] = shiftLocation?.map((v) => v.toJson()).toList(); } map['active'] = active; map['lastModifiedBy'] = lastModifiedBy; map['createdAt'] = createdAt; map['updatedAt'] = updatedAt; map['__v'] = v; return map; } }