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.
152 lines
4.8 KiB
Dart
152 lines
4.8 KiB
Dart
// To parse this JSON data, do
|
|
//
|
|
// final schedule = scheduleFromJson(jsonString);
|
|
|
|
import 'dart:convert';
|
|
|
|
import 'package:mc_common_app/models/services_models/service_model.dart';
|
|
|
|
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 String? scheduleName;
|
|
final int? serviceProviderBranchId;
|
|
final DateTime? fromDate;
|
|
final DateTime? toDate;
|
|
final String? startTime;
|
|
final String? endTime;
|
|
final int? slotDurationMinute;
|
|
final int? perSlotAppointment;
|
|
final String? branchName;
|
|
final String? address;
|
|
final String? latitude;
|
|
final String? longitude;
|
|
final List<WeeklyOffDay>? weeklyOffDays;
|
|
final List<ServiceModel>? scheduleServices;
|
|
final List<ServiceModel>? selectedServices;
|
|
String branchId;
|
|
int? appointmentType;
|
|
|
|
ScheduleData({
|
|
this.id,
|
|
this.scheduleName,
|
|
this.serviceProviderBranchId,
|
|
this.fromDate,
|
|
this.toDate,
|
|
this.startTime,
|
|
this.endTime,
|
|
this.slotDurationMinute,
|
|
this.perSlotAppointment,
|
|
this.branchName,
|
|
this.address,
|
|
this.latitude,
|
|
this.longitude,
|
|
this.weeklyOffDays,
|
|
this.scheduleServices,
|
|
this.selectedServices,
|
|
this.branchId = "",
|
|
this.appointmentType
|
|
});
|
|
|
|
factory ScheduleData.fromJson(Map<String, dynamic> json) =>
|
|
ScheduleData(
|
|
id: json["id"],
|
|
scheduleName: json["scheduleName"],
|
|
serviceProviderBranchId: json["serviceProviderBranchID"],
|
|
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"],
|
|
branchName: json["branchName"],
|
|
address: json["address"],
|
|
latitude: json["latitude"],
|
|
longitude: json["longitude"],
|
|
appointmentType: json["appointmentType"] == null ? null : json["appointmentType"],
|
|
weeklyOffDays: json["weeklyOffDays"] == null ? [] : List<WeeklyOffDay>.from(json["weeklyOffDays"]!.map((x) => WeeklyOffDay.fromJson(x))),
|
|
scheduleServices: json["scheduleServices"] == null ? [] : List<ServiceModel>.from(json["scheduleServices"]!.map((x) => ServiceModel.fromJson(x))),
|
|
selectedServices: [],
|
|
);
|
|
|
|
Map<String, dynamic> toJson() =>
|
|
{
|
|
"id": id,
|
|
"scheduleName": scheduleName,
|
|
"serviceProviderBranchID": serviceProviderBranchId,
|
|
"fromDate": fromDate?.toIso8601String(),
|
|
"toDate": toDate?.toIso8601String(),
|
|
"startTime": startTime,
|
|
"endTime": endTime,
|
|
"slotDurationMinute": slotDurationMinute,
|
|
"perSlotAppointment": perSlotAppointment,
|
|
"branchName": branchName,
|
|
"address": address,
|
|
"latitude": latitude,
|
|
"longitude": longitude,
|
|
"appointmentType": appointmentType,
|
|
"scheduleServices": scheduleServices == null ? [] : List<dynamic>.from(scheduleServices!.map((x) => x.toJson())),
|
|
};
|
|
|
|
@override
|
|
String toString() {
|
|
return 'ScheduleData{id: $id, scheduleName: $scheduleName, serviceProviderBranchId: $serviceProviderBranchId, fromDate: $fromDate, toDate: $toDate, startTime: $startTime, endTime: $endTime, slotDurationMinute: $slotDurationMinute, perSlotAppointment: $perSlotAppointment, branchName: $branchName, address: $address, latitude: $latitude, longitude: $longitude, weeklyOffDays: $weeklyOffDays, scheduleServices: $scheduleServices, branchId: $branchId}';
|
|
}
|
|
}
|
|
|
|
|
|
class WeeklyOffDay {
|
|
final int? id;
|
|
final int? dayNumber;
|
|
|
|
WeeklyOffDay({
|
|
this.id,
|
|
this.dayNumber,
|
|
});
|
|
|
|
factory WeeklyOffDay.fromJson(Map<String, dynamic> json) =>
|
|
WeeklyOffDay(
|
|
id: json["id"],
|
|
dayNumber: json["dayNumber"],
|
|
);
|
|
|
|
Map<String, dynamic> toJson() =>
|
|
{
|
|
"id": id,
|
|
"dayNumber": dayNumber,
|
|
};
|
|
}
|