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.
cloudsolutions-atoms/lib/modules/cx_module/survey/questionnaire_model.dart

173 lines
5.6 KiB
Dart

class Questionnaire {
int? questionnaireId;
int? surveySubmissionId;
SurveyType? surveyType;
String? surveyName;
String? surveyDescription;
ServiceRequestDetails? serviceRequestDetails;
List<SurveyQuestions>? surveyQuestions;
Questionnaire({this.questionnaireId, this.surveySubmissionId, this.surveyType, this.surveyName, this.surveyDescription, this.serviceRequestDetails, this.surveyQuestions});
Questionnaire.fromJson(Map<String, dynamic> json) {
questionnaireId = json['questionnaireId'];
surveySubmissionId = json['surveySubmissionId'];
surveyType = json['surveyType'] != null ? new SurveyType.fromJson(json['surveyType']) : null;
surveyName = json['surveyName'];
surveyDescription = json['surveyDescription'];
serviceRequestDetails = json['serviceRequestDetails'] != null ? new ServiceRequestDetails.fromJson(json['serviceRequestDetails']) : null;
if (json['surveyQuestions'] != null) {
surveyQuestions = <SurveyQuestions>[];
json['surveyQuestions'].forEach((v) {
surveyQuestions!.add(new SurveyQuestions.fromJson(v));
});
}
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['questionnaireId'] = this.questionnaireId;
data['surveySubmissionId'] = this.surveySubmissionId;
if (this.surveyType != null) {
data['surveyType'] = this.surveyType!.toJson();
}
data['surveyName'] = this.surveyName;
data['surveyDescription'] = this.surveyDescription;
if (this.serviceRequestDetails != null) {
data['serviceRequestDetails'] = this.serviceRequestDetails!.toJson();
}
if (this.surveyQuestions != null) {
data['surveyQuestions'] = this.surveyQuestions!.map((v) => v.toJson()).toList();
}
return data;
}
}
class SurveyType {
int? id;
String? name;
int? value;
SurveyType({this.id, this.name, this.value});
SurveyType.fromJson(Map<String, dynamic> json) {
id = json['id'];
name = json['name'];
value = json['value'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['name'] = this.name;
data['value'] = this.value;
return data;
}
}
class ServiceRequestDetails {
int? serviceRequestTypeId;
String? serviceRequestType;
String? serviceRequestNo;
ServiceRequestDetails({this.serviceRequestTypeId, this.serviceRequestType, this.serviceRequestNo});
ServiceRequestDetails.fromJson(Map<String, dynamic> json) {
serviceRequestTypeId = json['serviceRequestTypeId'];
serviceRequestType = json['serviceRequestType'];
serviceRequestNo = json['serviceRequestNo'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['serviceRequestTypeId'] = this.serviceRequestTypeId;
data['serviceRequestType'] = this.serviceRequestType;
data['serviceRequestNo'] = this.serviceRequestNo;
return data;
}
}
class SurveyQuestions {
int? questionId;
String? questionText;
SurveyType? questionType;
bool? isMandatory;
List<SurveyAnswerOptions>? surveyAnswerOptions;
SurveyQuestions({this.questionId, this.questionText, this.questionType, this.surveyAnswerOptions, this.isMandatory});
SurveyQuestions.fromJson(Map<String, dynamic> json) {
questionId = json['questionId'];
questionText = json['questionText'];
isMandatory = json['isMandatory'];
questionType = json['questionType'] != null ? new SurveyType.fromJson(json['questionType']) : null;
if (json['surveyAnswerOptions'] != null) {
surveyAnswerOptions = <SurveyAnswerOptions>[];
json['surveyAnswerOptions'].forEach((v) {
surveyAnswerOptions!.add(new SurveyAnswerOptions.fromJson(v));
});
}
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['questionId'] = this.questionId;
data['questionText'] = this.questionText;
data['isMandatory'] = this.isMandatory;
if (this.questionType != null) {
data['questionType'] = this.questionType!.toJson();
}
if (this.surveyAnswerOptions != null) {
data['surveyAnswerOptions'] = this.surveyAnswerOptions!.map((v) => v.toJson()).toList();
}
return data;
}
}
class SurveyAnswerOptions {
int? optionId;
String? optionText;
int? displayOrder;
SurveyAnswerOptions({this.optionId, this.optionText, this.displayOrder});
SurveyAnswerOptions.fromJson(Map<String, dynamic> json) {
optionId = json['optionId'];
optionText = json['optionText'];
displayOrder = json['displayOrder'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['optionId'] = this.optionId;
data['optionText'] = this.optionText;
data['displayOrder'] = this.displayOrder;
return data;
}
}
class SurveyAnswers {
int? questionId;
int? surveyAnswerOptionId;
String? surveyAnswerText;
int? surveyAnswerRating;
SurveyAnswers({this.questionId, this.surveyAnswerOptionId, this.surveyAnswerText, this.surveyAnswerRating});
SurveyAnswers.fromJson(Map<String, dynamic> json) {
questionId = json['questionId'];
surveyAnswerOptionId = json['surveyAnswerOptionId'];
surveyAnswerText = json['surveyAnswerText'];
surveyAnswerRating = json['surveyAnswerRating'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['questionId'] = this.questionId;
data['surveyAnswerOptionId'] = this.surveyAnswerOptionId;
data['surveyAnswerText'] = this.surveyAnswerText;
data['surveyAnswerRating'] = this.surveyAnswerRating;
return data;
}
}