class ArticleItem {

  String title;
  String content;
  Author author;
  List<ArticleImg> images;
  String createdAt;
  int like;

	ArticleItem({this.title,this.content,this.author,this.images,this.createdAt,this.like});

	ArticleItem.fromJsonMap(Map<String, dynamic> map): 
		title = map["title"],
		content = map["content"],
		author = Author.fromJsonMap(map["author"]),
		images = List<ArticleImg>.from((map["images"]??[]).map((it) => ArticleImg.fromJsonMap(it))),
		createdAt = map["created_at"],
		like = map["like"];

	Map<String, dynamic> toJson() {
		final Map<String, dynamic> data = new Map<String, dynamic>();
		data['title'] = title;
		data['content'] = content;
		data['author'] = author == null ? null : author.toJson();
		data['created_at'] = createdAt;
		data['like'] = like;
		return data;
	}
}


class Author {
	String avatar;
	String name;

	Author({this.avatar,this.name});
	Author.fromJsonMap(Map<String, dynamic> map):
				avatar = map["avatar"],
				name = map["name"];

	Map<String, dynamic> toJson() {
		final Map<String, dynamic> data = new Map<String, dynamic>();
		data['avatar'] = avatar;
		data['name'] = name;
		return data;
	}
}

class ArticleImg {
	String url;

	ArticleImg({this.url});
	ArticleImg.fromJsonMap(Map<String, dynamic> map):
				url = map["url"];
}