DiscoverModule/lib/ui_screen/add_event/model/event_model.dart

57 lines
1.3 KiB
Dart

import 'package:discover_module/ui_screen/interactionform/model/interaction_data.dart';
import 'package:hive_flutter/hive_flutter.dart';
// import 'package:pwa_ios/model/interaction_data.dart';
part 'event_model.g.dart';
class UIDataEventResponse {
bool success;
String message;
List<FormFieldData> formFields;
UIDataEventResponse({
required this.success,
required this.message,
required this.formFields,
});
factory UIDataEventResponse.fromJson(Map<String, dynamic> json) =>
UIDataEventResponse(
success: json["success"],
message: json["message"],
formFields: List<FormFieldData>.from(
json["data"].map((x) => FormFieldData.fromJson(x))),
);
Map<String, dynamic> toJson() => {
"success": success,
"message": message,
"form-fields": List<dynamic>.from(formFields.map((x) => x.toJson())),
};
@override
String toString() {
// TODO: implement toString
return List<dynamic>.from(formFields.map((x) => x.toJson())).toString();
}
}
@HiveType(typeId: 20)
class EventConfigData {
@HiveField(1)
InteractionResultData widgets;
@HiveField(2)
String id;
@HiveField(3)
String name;
EventConfigData({
required this.widgets,
required this.id,
required this.name,
});
Map<String, dynamic> toJson() => {"widgets": widgets};
}