import 'dart:convert';

/// 新闻分类 response
class CategoryResponse {
  String code;
  String title;

  CategoryResponse({
    required this.code,
    required this.title,
  });

  factory CategoryResponse.fromRawJson(String str) => CategoryResponse.fromJson(json.decode(str));

  String toRawJson() => json.encode(toJson());

  factory CategoryResponse.fromJson(Map<String, dynamic> json) => CategoryResponse(
    code: json["code"],
    title: json["title"],
  );

  Map<String, dynamic> toJson() => {
    "code": code,
    "title": title,
  };

  @override
  String toString() {
    return "$title【$code】";
  }
}
