class TotalContentModel {
  List<TotalContent> contents;
  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': List<dynamic>.from(contents.map((x) => x.toJson())),
      '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;
  final dynamic y;
  final dynamic d;
  final dynamic f;
  final dynamic l;
  final dynamic dl;
  final dynamic dp;
  final String? dt;

  DataItem({
    required this.name,
    this.q,
    this.v,
    this.p,
    this.y,
    this.d,
    this.f,
    this.l,
    this.dl,
    this.dp,
    this.dt,
  });

  factory DataItem.fromJson(Map<String, dynamic> json) {
    return DataItem(
      name: json['name'],
      q: json['q'],
      v: json['v'],
      p: json['p'],
      y: json['y'],
      d: json['d'],
      f: json['f'],
      l: json['l'],
      dl: json['dl'],
      dp: json['dp'],
      dt: json['dt'],
    );
  }

  Map<String, dynamic> toJson() {
    return {
      'name': name,
      'q': q,
      'v': v,
      'p': p,
      'y': y,
      'd': d,
      'f': f,
      'l': l,
      'dl': dl,
      'dp': dp,
      'dt': dt,
    };
  }
}
