import 'package:didvan/models/category.dart'; import 'package:didvan/models/overview_data.dart'; import 'content.dart'; import 'tag.dart'; class RadarDetailsData { final int id; final String title; final String image; final int timeToRead; final String createdAt; final String? podcast; final bool forManagers; final bool marked; int comments; final List tags; final List contents; final List categories; final int order; final List relatedContents = []; RadarDetailsData({ required this.id, required this.title, required this.image, required this.timeToRead, required this.createdAt, required this.podcast, required this.forManagers, required this.marked, required this.comments, required this.tags, required this.contents, required this.categories, required this.order, }); factory RadarDetailsData.fromJson(Map json) { return RadarDetailsData( id: json['id'], title: json['title'], image: json['image'], timeToRead: json['timeToRead'], createdAt: json['createdAt'], podcast: json['podcast'], forManagers: json['forManagers'], marked: json['marked'], order: json['order'], comments: json['comments'], tags: List.from(json['tags'].map((tag) => Tag.fromJson(tag))), contents: List.from( json['contents'].map( (content) => Content.fromJson(content), ), ), categories: List.from( json['categories'].map( (cat) => CategoryData.fromJson(cat), ), ), ); } Map toJson() => { 'id': id, 'title': title, 'image': image, 'timeToRead': timeToRead, 'createdAt': createdAt, 'podcast': podcast, 'forManagers': forManagers, 'marked': marked, 'order': order, 'comments': comments, 'tags': tags.map((e) => e.toJson()).toList(), 'contents': contents.map((e) => e.toJson()).toList(), 'categories': categories.map((e) => e.toJson()).toList(), }; }