import 'package:PiliPlus/models/dynamics/article_list/category.dart'; import 'package:PiliPlus/models/dynamics/article_list/stats.dart'; class Article { int? id; String? title; int? state; int? publishTime; int? words; List? imageUrls; Category? category; List? categories; String? summary; int? type; String? dynIdStr; int? attributes; int? authorUid; int? onlyFans; Stats? stats; int? likeState; Article({ this.id, this.title, this.state, this.publishTime, this.words, this.imageUrls, this.category, this.categories, this.summary, this.type, this.dynIdStr, this.attributes, this.authorUid, this.onlyFans, this.stats, this.likeState, }); factory Article.fromJson(Map json) => Article( id: json['id'] as int?, title: json['title'] as String?, state: json['state'] as int?, publishTime: json['publish_time'] as int?, words: json['words'] as int?, imageUrls: json['image_urls'], category: json['category'] == null ? null : Category.fromJson(json['category'] as Map), categories: (json['categories'] as List?) ?.map((e) => Category.fromJson(e as Map)) .toList(), summary: json['summary'] as String?, type: json['type'] as int?, dynIdStr: json['dyn_id_str'] as String?, attributes: json['attributes'] as int?, authorUid: json['author_uid'] as int?, onlyFans: json['only_fans'] as int?, stats: json['stats'] == null ? null : Stats.fromJson(json['stats'] as Map), likeState: json['like_state'] as int?, ); Map toJson() => { 'id': id, 'title': title, 'state': state, 'publish_time': publishTime, 'words': words, 'image_urls': imageUrls, 'category': category?.toJson(), 'categories': categories?.map((e) => e.toJson()).toList(), 'summary': summary, 'type': type, 'dyn_id_str': dynIdStr, 'attributes': attributes, 'author_uid': authorUid, 'only_fans': onlyFans, 'stats': stats?.toJson(), 'like_state': likeState, }; }