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.
58 lines
1.7 KiB
Dart
58 lines
1.7 KiB
Dart
import 'package:fluffychat/pangea/constants/model_keys.dart';
|
|
import 'package:fluffychat/pangea/models/it_response_model.dart';
|
|
|
|
class CustomInputRequestModel {
|
|
String text;
|
|
String customInput;
|
|
String sourceLangCode;
|
|
String targetLangCode;
|
|
String userId;
|
|
String roomId;
|
|
String? classId;
|
|
|
|
String? goldTranslation;
|
|
List<Continuance>? goldContinuances;
|
|
|
|
CustomInputRequestModel({
|
|
required this.text,
|
|
required this.customInput,
|
|
required this.sourceLangCode,
|
|
required this.targetLangCode,
|
|
required this.userId,
|
|
required this.roomId,
|
|
required this.classId,
|
|
required this.goldTranslation,
|
|
required this.goldContinuances,
|
|
});
|
|
|
|
factory CustomInputRequestModel.fromJson(json) => CustomInputRequestModel(
|
|
text: json['text'],
|
|
customInput: json['custom_input'],
|
|
sourceLangCode: json[ModelKey.srcLang],
|
|
targetLangCode: json[ModelKey.tgtLang],
|
|
userId: json['user_id'],
|
|
roomId: json['room_id'],
|
|
classId: json['class_id'],
|
|
goldTranslation: json['gold_translation'],
|
|
goldContinuances: json['gold_continuances'] != null
|
|
? List.from(json['gold_continuances'])
|
|
.map((e) => Continuance.fromJson(e))
|
|
.toList()
|
|
: null,
|
|
);
|
|
|
|
toJson() => {
|
|
'text': text,
|
|
'custom_input': customInput,
|
|
ModelKey.srcLang: sourceLangCode,
|
|
ModelKey.tgtLang: targetLangCode,
|
|
'user_id': userId,
|
|
'room_id': roomId,
|
|
'class_id': classId,
|
|
'gold_translation': goldTranslation,
|
|
'gold_continuances': goldContinuances != null
|
|
? List.from(goldContinuances!.map((e) => e.toJson()))
|
|
: null,
|
|
};
|
|
}
|