class TotalContentModel {
  final List<TotalContent> contents;
  final int lastPage;

  TotalContentModel({required this.contents, required this.lastPage});

  factory TotalContentModel.fromJson(Map<String, dynamic> json) {
    return TotalContentModel(
      contents: List<TotalContent>.from(
          json['contents'].map((content) => TotalContent.fromJson(content))),
      lastPage: json['lastPage'],
    );
  }

  Map<String, dynamic> toJson() {
    return {
      'contents': contents.map((content) => content.toJson()).toList(),
      'lastPage': lastPage,
    };
  }
}

class TotalContent {
  final int id;
  final String label;
  final String title;
  final int type;
  final bool marked;
  final List<DataItem> data;

  TotalContent({
    required this.id,
    required this.label,
    required this.title,
    required this.type,
    required this.marked,
    required this.data,
  });

  factory TotalContent.fromJson(Map<String, dynamic> json) {
    return TotalContent(
      id: json['id'],
      label: json['label'],
      title: json['title'],
      type: json['type'],
      marked: json['marked'],
      data: List<DataItem>.from(
          json['data'].map((data) => DataItem.fromJson(data))),
    );
  }

  Map<String, dynamic> toJson() {
    return {
      'id': id,
      'label': label,
      'title': title,
      'type': type,
      'marked': marked,
      'data': data.map((dataItem) => dataItem.toJson()).toList(),
    };
  }
}

class DataItem {
  final String name;
  final dynamic q;
  final dynamic v;
  final dynamic p;

  DataItem({
    required this.name,
    required this.q,
    required this.v,
    required this.p,
  });

  factory DataItem.fromJson(Map<String, dynamic> json) {
    return DataItem(
      name: json['name'],
      q: json['q'],
      v: json['v'],
      p: json['p'],
    );
  }

  Map<String, dynamic> toJson() {
    return {
      'name': name,
      'q': q,
      'v': v,
      'p': p,
    };
  }
}
