import 'package:isar/isar.dart'; import 'package:stadtbote/model/short_poll_question.dart'; part 'short_poll.g.dart'; @collection class ShortPoll { late Id id; late int type; late String text; late String title; late int validFrom; late int validTo; late int? imageWidth; late int? imageHeight; late String? imageModified; late bool? commentsAllowed; late bool read = false; late String? url; late String? pdfName; late bool voted; late int numberOfVotes; late List questions; ShortPoll({ required this.id, required this.type, required this.text, required this.title, required this.validFrom, required this.validTo, this.imageWidth, this.imageHeight, this.imageModified, this.commentsAllowed, required this.read, this.url, this.pdfName, required this.voted, required this.numberOfVotes, required this.questions, }); /*factory ShortPoll.fromJson(Map json) { List questions = []; if (json["answers"] != null) { questions = List.from( json["answers"].map((x) => ShortPollQuestion.fromJson(x))); } return ShortPoll( id: json["id"], type: json["type"], text: json["text"], title: json["title"], validFrom: json["validFrom"], validTo: json["validTo"], imageWidth: json["imageWidth"], imageHeight: json["imageHeight"], imageModified: json["imageModified"], commentsAllowed: json["commentsAllowed"], read: json["read"], url: json["url"], pdfName: json["pdfName"], voted: json["voted"], numberOfVotes: json["numberOfVotes"], questions: questions, ); } Map toJson() => { "id": id, "type": type, "text": text, "title": title, "validFrom": validFrom, "validTo": validTo, "imageWidth": imageWidth, "imageHeight": imageHeight, "imageModified": imageModified, "commentsAllowed": commentsAllowed, "read": read, "url": url, "pdfName": pdfName, "voted": voted, "numberOfVotes": numberOfVotes, };*/ }