mobileApplicationsKonectarApp/lib/model/json_form_data.dart

136 lines
3.7 KiB
Dart
Raw Permalink Normal View History

2024-01-04 07:06:37 +00:00
// To parse this JSON data, do
//
// final saveInteractionFormJson = saveInteractionFormJsonFromJson(jsonString);
import 'dart:convert';
import 'package:hive_flutter/hive_flutter.dart';
part 'json_form_data.g.dart';
SaveInteractionFormJson saveInteractionFormJsonFromJson(String str) =>
SaveInteractionFormJson.fromJson(json.decode(str));
String saveInteractionFormJsonToJson(DataJson data) =>
json.encode(data.toJson());
String saveFormJsonToJson(SendSaveJson data) => json.encode(data.toJson());
class DataJson {
SendSaveJson sendSaveJson;
DataJson({required this.sendSaveJson});
factory DataJson.fromJson(Map<String, dynamic> json) => DataJson(
sendSaveJson: json["data"],
);
Map<String, dynamic> toJson() => {
"data": sendSaveJson,
};
}
@HiveType(typeId: 14)
class SendSaveJson {
@HiveField(0)
List<SaveInteractionFormJson> savedList;
SendSaveJson({required this.savedList});
factory SendSaveJson.fromJson(Map<String, dynamic> json) => SendSaveJson(
savedList: List<SaveInteractionFormJson>.from(
json["data"].map((x) => SaveInteractionFormJson.fromJson(x))),
);
Map<String, dynamic> toJson() => {
"data": List<dynamic>.from(savedList.map((x) => x.toJson())),
};
}
@HiveType(typeId: 15)
class SaveInteractionFormJson {
@HiveField(0)
String interactionForm1;
@HiveField(1)
String intId;
@HiveField(2)
String intName;
@HiveField(3)
List<Save> save;
SaveInteractionFormJson({
required this.interactionForm1,
required this.intId,
required this.intName,
required this.save,
});
factory SaveInteractionFormJson.fromJson(Map<String, dynamic> json) =>
SaveInteractionFormJson(
interactionForm1: json["Interaction-form1"],
intId: json["intId"],
intName: json["intName"],
save: List<Save>.from(json["data"].map((x) => Save.fromJson(x))),
);
Map<String, dynamic> toJson() => {
"id": intId,
"page": intName,
"data": List<dynamic>.from(save.map((x) => x.toJson())),
};
}
@HiveType(typeId: 16)
class Save {
@HiveField(0)
String sectionName;
@HiveField(1)
List<List<MultipleSectionList>> multipleSectionList;
Save({
required this.sectionName,
required this.multipleSectionList,
});
factory Save.fromJson(Map<String, dynamic> json) => Save(
sectionName: json["sectionName"],
multipleSectionList: List<List<MultipleSectionList>>.from(
json["multipleSectionList"].map((x) =>
List<MultipleSectionList>.from(
x.map((x) => MultipleSectionList.fromJson(x))))),
);
Map<String, dynamic> toJson() => {
"sectionName": sectionName,
"multipleSectionList": List<dynamic>.from(multipleSectionList
.map((x) => List<dynamic>.from(x.map((x) => x.toJson())))),
};
}
@HiveType(typeId: 17)
class MultipleSectionList {
@HiveField(0)
String id;
@HiveField(1)
List<dynamic> selectedValue;
@HiveField(2)
List<dynamic>? fileName;
@HiveField(3)
List<dynamic>? extension;
MultipleSectionList(
{required this.id,
required this.selectedValue,
this.extension,
this.fileName});
factory MultipleSectionList.fromJson(Map<String, dynamic> json) =>
MultipleSectionList(
id: json["id"],
selectedValue: List<dynamic>.from(json["selectedValue"].map((x) => x)),
);
Map<String, dynamic> toJson() => {
"id": id,
"selectedValue": List<dynamic>.from(selectedValue.map((x) => x)),
"extension": extension != null
? List<dynamic>.from(extension!.map((x) => x))
: [],
"fileName":
fileName != null ? List<dynamic>.from(fileName!.map((x) => x)) : [],
};
}