You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
car_provider_app/lib/common/schedule_model.dart

82 lines
2.3 KiB
Dart

// To parse this JSON data, do
//
// final schedule = scheduleFromJson(jsonString);
import 'dart:convert';
Schedule scheduleFromJson(String str) => Schedule.fromJson(json.decode(str));
String scheduleToJson(Schedule data) => json.encode(data.toJson());
class Schedule {
final int? messageStatus;
final int? totalItemsCount;
final List<ScheduleData>? data;
final String? message;
Schedule({
this.messageStatus,
this.totalItemsCount,
this.data,
this.message,
});
factory Schedule.fromJson(Map<String, dynamic> json) => Schedule(
messageStatus: json["messageStatus"],
totalItemsCount: json["totalItemsCount"],
data: json["data"] == null ? [] : List<ScheduleData>.from(json["data"]!.map((x) => ScheduleData.fromJson(x))),
message: json["message"],
);
Map<String, dynamic> toJson() => {
"messageStatus": messageStatus,
"totalItemsCount": totalItemsCount,
"data": data == null ? [] : List<dynamic>.from(data!.map((x) => x.toJson())),
"message": message,
};
}
class ScheduleData {
final int? id;
final int? branchId;
final DateTime? fromDate;
final DateTime? toDate;
final String? startTime;
final String? endTime;
final int? slotDurationMinute;
final int? perSlotAppointment;
ScheduleData({
this.id,
this.branchId,
this.fromDate,
this.toDate,
this.startTime,
this.endTime,
this.slotDurationMinute,
this.perSlotAppointment,
});
factory ScheduleData.fromJson(Map<String, dynamic> json) => ScheduleData(
id: json["id"],
branchId: json["branchID"],
fromDate: json["fromDate"] == null ? null : DateTime.parse(json["fromDate"]),
toDate: json["toDate"] == null ? null : DateTime.parse(json["toDate"]),
startTime: json["startTime"],
endTime: json["endTime"],
slotDurationMinute: json["slotDurationMinute"],
perSlotAppointment: json["perSlotAppointment"],
);
Map<String, dynamic> toJson() => {
"id": id,
"branchID": branchId,
"fromDate": fromDate?.toIso8601String(),
"toDate": toDate?.toIso8601String(),
"startTime": startTime,
"endTime": endTime,
"slotDurationMinute": slotDurationMinute,
"perSlotAppointment": perSlotAppointment,
};
}