part of models;
/// 1、----------------------------图书分类模型----------------------------
///
class CategoryModel {
  CategoryModel({
    this.categoryId,
    this.name,
  });

  CategoryModel.fromJson(dynamic json) {
    categoryId = json['category_id'];
    name = json['name'];
  }
  num? categoryId;
  String? name;
  CategoryModel copyWith({  num? categoryId,
    String? name,
  }) => CategoryModel(  categoryId: categoryId ?? this.categoryId,
    name: name ?? this.name,
  );
  Map<String, dynamic> toJson() {
    final map = <String, dynamic>{};
    map['category_id'] = categoryId;
    map['name'] = name;
    return map;
  }
}


/// 2、----------------------------图书标签模型----------------------------
///
class LabelModel {
  LabelModel({
    this.labelId,
    this.name,
    this.selected = false,
  });

  LabelModel.fromJson(dynamic json) {
    labelId = json['label_id'];
    name = json['name'];
    selected = false;
  }
  num? labelId;
  String? name;
  late bool selected;
  LabelModel copyWith({  num? labelId,
    String? name,
  }) => LabelModel(  labelId: labelId ?? this.labelId,
    name: name ?? this.name,
  );
  Map<String, dynamic> toJson() {
    final map = <String, dynamic>{};
    map['label_id'] = labelId;
    map['name'] = name;
    return map;
  }

}

/// 3、----------------------------书籍评价模型----------------------------
///

class ScoreModel {
  ScoreModel({
    this.bookCommentId,
    this.comments,
    this.rating,
    this.createTime,
    this.membersId,
    this.users,
    this.usersImg,});

  ScoreModel.fromJson(dynamic json) {
    bookCommentId = json['book_comment_id'];
    comments = json['comments'];
    rating = json['rating'];
    createTime = json['create_time'];
    membersId = json['members_id'];
    users = json['users'];
    usersImg = json['users_img'];
  }
  num? bookCommentId;
  String? comments;
  num? rating;
  String? createTime;
  num? membersId;
  String? users;
  String? usersImg;

  ScoreModel copyWith({  num? bookCommentId,
    String? comments,
    num? rating,
    String? createTime,
    num? membersId,
    String? users,
    String? usersImg,
  }) => ScoreModel(  bookCommentId: bookCommentId ?? this.bookCommentId,
    comments: comments ?? this.comments,
    rating: rating ?? this.rating,
    createTime: createTime ?? this.createTime,
    membersId: membersId ?? this.membersId,
    users: users ?? this.users,
    usersImg: usersImg ?? this.usersImg,
  );
  Map<String, dynamic> toJson() {
    final map = <String, dynamic>{};
    map['book_comment_id'] = bookCommentId;
    map['comments'] = comments;
    map['rating'] = rating;
    map['create_time'] = createTime;
    map['members_id'] = membersId;
    map['users'] = users;
    map['users_img'] = usersImg;
    return map;
  }

}

/// 4、----------------------------章节模型----------------------------
///
class ChapterModel {
  ChapterModel({
    this.id,
    this.name,
    this.pid,
    this.bookId,
    this.isReading,
    this.sort,
    this.seen,
    this.children,
    this.selected = false
  });

  ChapterModel.fromJson(dynamic json) {
    id = json['id'];
    name = json['name'];
    pid = json['pid'];
    bookId = json['book_id'];
    isReading = json['is_reading'];
    sort = json['sort'];
    seen = json['seen'];
    if (json['children'] != null) {
      children = [];
      json['children'].forEach((v) {
        children?.add(ChapterModel.fromJson(v));
      });
    }
    selected = false;
  }
  num? id;
  String? name;
  num? pid;
  num? bookId;
  num? isReading;
  num? sort;
  num? seen;
  late bool selected;
  List<ChapterModel>? children;
  ChapterModel copyWith({  num? id,
    String? name,
    num? pid,
    num? bookId,
    num? isReading,
    num? sort,
    num? seen,
    List<ChapterModel>? children,
  }) => ChapterModel(  id: id ?? this.id,
    name: name ?? this.name,
    pid: pid ?? this.pid,
    bookId: bookId ?? this.bookId,
    isReading: isReading ?? this.isReading,
    sort: sort ?? this.sort,
    seen: seen ?? this.seen,
    children: children ?? this.children,
  );
  Map<String, dynamic> toJson() {
    final map = <String, dynamic>{};
    map['id'] = id;
    map['name'] = name;
    map['pid'] = pid;
    map['book_id'] = bookId;
    map['is_reading'] = isReading;
    map['sort'] = sort;
    map['seen'] = seen;
    if (children != null) {
      map['children'] = children?.map((v) => v.toJson()).toList();
    }
    return map;
  }

}

/// 5、----------------------------图书详细模型----------------------------
///
class BookDetailModel {
  BookDetailModel({
    this.bookId,
    this.bookName,
    this.img,
    this.price,
    this.vipPrice,
    this.rating,
    this.readNum,
    this.content,
    this.isFree,
    this.authors,
    this.onsaleTime,
    this.categoryId,
    this.pressId,
    this.producersId,
    this.isHave,
    this.isCollection,
    this.ratingCount,
    this.ratingList,
    this.categoryName,
    this.pressName,
    this.producersName,
    this.chapterId,
    this.chapterName,});

  BookDetailModel.fromJson(dynamic json) {
    bookId = json['book_id'];
    bookName = json['book_name'];
    img = json['img'];
    price = json['price'];
    vipPrice = json['vip_price'];
    rating = json['rating'];
    readNum = json['read_num'];
    content = json['content'];
    isFree = json['is_free'];
    authors = json['authors'];
    onsaleTime = json['onsale_time'];
    categoryId = json['category_id'];
    pressId = json['press_id'];
    producersId = json['producers_id'];
    isHave = json['is_have'];
    isCollection = json['is_collection'];
    ratingCount = json['rating_count'];
    ratingList = json['rating_list'] != null ? json['rating_list'].cast<num>() : [];
    categoryName = json['category_name'];
    pressName = json['press_name'];
    producersName = json['producers_name'];
    chapterId = json['chapter_id'];
    chapterName = json['chapter_name'];
  }
  num? bookId;
  String? bookName;
  String? img;
  String? price;
  String? vipPrice;
  String? rating;
  num? readNum;
  String? content;
  num? isFree;
  String? authors;
  num? onsaleTime;
  num? categoryId;
  num? pressId;
  num? producersId;
  num? isHave;
  num? isCollection;
  num? ratingCount;
  List<num>? ratingList;
  String? categoryName;
  String? pressName;
  String? producersName;
  num? chapterId;
  String? chapterName;
  BookDetailModel copyWith({  num? bookId,
    String? bookName,
    String? img,
    String? price,
    String? vipPrice,
    String? rating,
    num? readNum,
    String? content,
    num? isFree,
    String? authors,
    num? onsaleTime,
    num? categoryId,
    num? pressId,
    num? producersId,
    num? isHave,
    num? isCollection,
    num? ratingCount,
    List<num>? ratingList,
    String? categoryName,
    String? pressName,
    String? producersName,
    num? chapterId,
    String? chapterName,
  }) => BookDetailModel(  bookId: bookId ?? this.bookId,
    bookName: bookName ?? this.bookName,
    img: img ?? this.img,
    price: price ?? this.price,
    vipPrice: vipPrice ?? this.vipPrice,
    rating: rating ?? this.rating,
    readNum: readNum ?? this.readNum,
    content: content ?? this.content,
    isFree: isFree ?? this.isFree,
    authors: authors ?? this.authors,
    onsaleTime: onsaleTime ?? this.onsaleTime,
    categoryId: categoryId ?? this.categoryId,
    pressId: pressId ?? this.pressId,
    producersId: producersId ?? this.producersId,
    isHave: isHave ?? this.isHave,
    isCollection: isCollection ?? this.isCollection,
    ratingCount: ratingCount ?? this.ratingCount,
    ratingList: ratingList ?? this.ratingList,
    categoryName: categoryName ?? this.categoryName,
    pressName: pressName ?? this.pressName,
    producersName: producersName ?? this.producersName,
    chapterId: chapterId ?? this.chapterId,
    chapterName: chapterName ?? this.chapterName,
  );
  Map<String, dynamic> toJson() {
    final map = <String, dynamic>{};
    map['book_id'] = bookId;
    map['book_name'] = bookName;
    map['img'] = img;
    map['price'] = price;
    map['vip_price'] = vipPrice;
    map['rating'] = rating;
    map['read_num'] = readNum;
    map['content'] = content;
    map['is_free'] = isFree;
    map['authors'] = authors;
    map['onsale_time'] = onsaleTime;
    map['category_id'] = categoryId;
    map['press_id'] = pressId;
    map['producers_id'] = producersId;
    map['is_have'] = isHave;
    map['is_collection'] = isCollection;
    map['rating_count'] = ratingCount;
    map['rating_list'] = ratingList;
    map['category_name'] = categoryName;
    map['press_name'] = pressName;
    map['producers_name'] = producersName;
    map['chapter_id'] = chapterId;
    map['chapter_name'] = chapterName;
    return map;
  }



}

class FilterModel {
  FilterModel({
    required this.id,
    required this.name,
    this.selected = false
  });

  String id;
  String name;
  late bool selected = false;

}


