Untitled

mail@pastecode.io avatar
unknown
dart
7 months ago
20 kB
1
Indexable
Never
import 'package:base_architecture/data_layer/models/api_models/books_models/book_model.dart';
import 'package:base_architecture/data_layer/models/api_models/books_models/publisher_model.dart';
import 'package:base_architecture/data_layer/models/api_models/books_models/reader_model.dart';
import 'package:base_architecture/data_layer/models/api_models/books_models/translator_model.dart';

class BookDetails {
  BookDetails.fromJson(Map<String, dynamic> json) {
    customMessage = json['custom_message'];
    customCode = json['custom_code'];
    if (json['data'] != null) {
      data = <BookDetailsData>[];
      json['data'].forEach((v) {
        data!.add(new BookDetailsData.fromJson(v));
      });
    }
  }
  BookDetails({this.customMessage, this.customCode, this.data});

  List<BookDetailsData>? data;
  String? customMessage;
  String? customCode;

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['custom_message'] = this.customMessage;
    data['custom_code'] = this.customCode;
    if (this.data != null) {
      data['data'] = this.data!.map((BookDetailsData v) => v.toJson()).toList();
    }
    return data;
  }
}

class BookDetailsData {
  BookDetailsData({
    this.price_dollar,
    this.id,
    this.name,
    this.language,
    this.isbn,
    this.description,
    this.type,
    this.price,
    this.publicationYear,
    this.rateAvg,
    this.lengthBook,
    this.totalPage,
    this.imageFullPath,
    this.soundFullPath,
    this.isFav,
    this.isWish,
    this.soundFiles,
    this.textFiles,
    this.sampleFiles,
    // this.textAreas,
    this.authors,
    this.readers,
    this.publishers,
    this.translators,
    this.category,
    this.subcategory,
    this.subSubcategory,
    this.tags,
    this.limitThreeComments,
    this.similarBooks,
    this.authorBooks,
    this.readerBooks,
    this.isFollowAuthors,
    this.isFollowReaders,
    this.isFollowPublishers,
    this.isFollowTranslators,
    this.isFollowCategory,
    this.is_paid,
    this.code_currency,
    this.has_access,
    this.isDownloadedText,
    this.isDownloadedSound,
    this.isText,
    this.isSound,
    this.soundDuration,
    this.soundChapter,
  });

  BookDetailsData.fromJson(Map<String, dynamic> json) {
    id = json['book_id'];
    has_access = json['has_access'];
    code_currency = json['code_currency'];
    is_paid = json['is_paid'];
    price_dollar = json['price_dollar'];
    name = json['name'];
    language = json['language'];
    isbn = json['isbn'];
    description = json['description'];
    type = json['type'];
    price = json['price'];
    publicationYear = json['publication_year'];
    rateAvg = json['rate_avg'];
    lengthBook = json['length_book'];
    totalPage = json['total_page'];
    imageFullPath = json['image_full_path'];
    soundFullPath = json['sound_full_path'];
    isFav = json['is_fav'];
    isWish = json['is_wish'];
    if (json['soundFiles'] != null) {
      soundFiles = <SoundFiles>[];
      json['soundFiles'].forEach((v) {
        soundFiles!.add(new SoundFiles.fromJson(v));
      });
    }
    if (json['textFiles'] != null) {
      textFiles = <TextFiles>[];
      json['textFiles'].forEach((v) {
        textFiles!.add(new TextFiles.fromJson(v));
      });
    }
    sampleFiles = json['sampleFiles'] != null
        ? new SoundFiles.fromJson(json['sampleFiles'])
        : null;
    // if (json['textAreas'] != null) {
    //   textAreas = <Null>[];
    //   json['textAreas'].forEach((v) {
    //     textAreas!.add(new Null.fromJson(v));
    //   });
    // }
    if (json['authors'] != null) {
      authors = <Authors>[];
      json['authors'].forEach((v) {
        authors!.add(new Authors.fromJson(v));
      });
    }
    if (json['readers'] != null) {
      readers = <Readers>[];
      json['readers'].forEach((v) {
        readers!.add(new Readers.fromJson(v));
      });
    }
    if (json['publishers'] != null) {
      publishers = <Publishers>[];
      json['publishers'].forEach((v) {
        publishers!.add(new Publishers.fromJson(v));
      });
    }
    if (json['translators'] != null) {
      translators = <Translators>[];
      json['translators'].forEach((v) {
        translators!.add(new Translators.fromJson(v));
      });
    }
    category = json['category'] != null
        ? new Category.fromJson(json['category'])
        : null;
    subcategory = json['subcategory'] != null
        ? new Category.fromJson(json['subcategory'])
        : null;
    subSubcategory = json['subSubcategory'] != null
        ? new Category.fromJson(json['subSubcategory'])
        : null;
    if (json['tags'] != null) {
      tags = <Tags>[];
      json['tags'].forEach((v) {
        tags!.add(new Tags.fromJson(v));
      });
    }
    if (json['limitThreeComments'] != null) {
      limitThreeComments = <LimitThreeComments>[];
      json['limitThreeComments'].forEach((v) {
        limitThreeComments!.add(new LimitThreeComments.fromJson(v));
      });
    }
    if (json['similarBooks'] != null) {
      similarBooks = <Book>[];
      json['similarBooks'].forEach((v) {
        similarBooks!.add(new Book.fromJson(v));
      });
    }
    if (json['authorBooks'] != null) {
      authorBooks = <Book>[];
      json['authorBooks'].forEach((v) {
        authorBooks!.add(new Book.fromJson(v));
      });
    }
    if (json['readerBooks'] != null) {
      readerBooks = <Book>[];
      json['readerBooks'].forEach((v) {
        readerBooks!.add(new Book.fromJson(v));
      });
    }
    isFollowAuthors = json['is_follow_authors'];
    isFollowReaders = json['is_follow_readers'];
    isFollowPublishers = json['is_follow_publishers'];
    isFollowTranslators = json['is_follow_translators'];
    isFollowCategory = json['isFollowedcategory'];
    isDownloadedText = json['is_downloaded_text'];
    isDownloadedSound = json['is_downloaded_sound'];
    isText = json['is_text'];
    isSound = json['is_sound'];
    soundDuration = json['sound_duration'];
    soundChapter = json['sound_chapter'];
  }
  int? id;
  String? code_currency;
  String? price_dollar;
  String? name;
  String? language;
  String? isbn;
  String? type;
  String? price;
  String? description;
  String? publicationYear;
  String? rateAvg;
  String? lengthBook;
  String? imageFullPath;
  String? soundFullPath;
  bool? isFav;
  bool? isWish;
  List<SoundFiles>? soundFiles;
  List<TextFiles>? textFiles;
  SoundFiles? sampleFiles;
  int? totalPage;
  // List<Null>? textAreas;
  List<Authors>? authors;
  List<Readers>? readers;
  List<Publishers>? publishers;
  List<Translators>? translators;
  Category? category;
  Category? subcategory;
  Category? subSubcategory;
  List<Tags>? tags;
  List<LimitThreeComments>? limitThreeComments;
  List<Book>? similarBooks;
  List<Book>? authorBooks;
  List<Book>? readerBooks;
  bool? isFollowAuthors;
  bool? isFollowReaders;
  bool? isFollowPublishers;
  bool? isFollowTranslators;
  bool? isFollowCategory;
  bool? is_paid;
  bool? has_access;
  bool? isDownloadedText;
  bool? isDownloadedSound;
  bool? isText;
  bool? isSound;
  String? soundDuration;
  int? soundChapter;

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['book_id'] = this.id;
    data['has_access'] = this.has_access;
    data['code_currency'] = this.code_currency;
    data['price_dollar'] = this.price_dollar;
    data['name'] = this.name;
    data['language'] = this.language;
    data['isbn'] = this.isbn;
    data['description'] = this.description;
    data['type'] = this.type;
    data['price'] = this.price;
    data['publication_year'] = this.publicationYear;
    data['rate_avg'] = this.rateAvg;
    data['length_book'] = this.lengthBook;
    data['total_page'] = this.totalPage;
    data['image_full_path'] = this.imageFullPath;
    data['sound_full_path'] = this.soundFullPath;
    data['is_paid'] = this.is_paid;
    data['is_fav'] = this.isFav;
    data['is_wish'] = this.isWish;
    if (this.soundFiles != null) {
      data['soundFiles'] =
          this.soundFiles!.map((SoundFiles v) => v.toJson()).toList();
    }
    if (this.textFiles != null) {
      data['textFiles'] =
          this.textFiles!.map((TextFiles v) => v.toJson()).toList();
    }
    if (this.sampleFiles != null) {
      data['sampleFiles'] = this.sampleFiles!.toJson();
    }
    // if (this.textAreas != null) {
    //   data['textAreas'] = this.textAreas!.map((v) => v.toJson()).toList();
    // }
    if (this.authors != null) {
      data['authors'] = this.authors!.map((Authors v) => v.toJson()).toList();
    }
    if (this.readers != null) {
      data['readers'] = this.readers!.map((Readers v) => v.toJson()).toList();
    }
    if (this.publishers != null) {
      data['publishers'] =
          this.publishers!.map((Publishers v) => v.toJson()).toList();
    }
    if (this.translators != null) {
      data['translators'] =
          this.translators!.map((Translators v) => v.toJson()).toList();
    }
    if (this.category != null) {
      data['category'] = this.category!.toJson();
    }
    if (this.subcategory != null) {
      data['subcategory'] = this.subcategory!.toJson();
    }
    if (this.subSubcategory != null) {
      data['subSubcategory'] = this.subSubcategory!.toJson();
    }
    if (this.tags != null) {
      data['tags'] = this.tags!.map((Tags v) => v.toJson()).toList();
    }
    if (this.limitThreeComments != null) {
      data['limitThreeComments'] = this
          .limitThreeComments!
          .map((LimitThreeComments v) => v.toJson())
          .toList();
    }
    if (this.similarBooks != null) {
      data['similarBooks'] =
          this.similarBooks!.map((Book v) => v.toJson()).toList();
    }
    if (this.authorBooks != null) {
      data['authorBooks'] =
          this.authorBooks!.map((Book v) => v.toJson()).toList();
    }
    if (this.readerBooks != null) {
      data['readerBooks'] =
          this.readerBooks!.map((Book v) => v.toJson()).toList();
    }
    data['is_follow_authors'] = this.isFollowAuthors;
    data['is_follow_readers'] = this.isFollowReaders;
    data['is_follow_publishers'] = this.isFollowPublishers;
    data['is_follow_translators'] = this.isFollowTranslators;
    data['isFollowedcategory'] = this.isFollowCategory;
    data['is_downloaded_text'] = this.isDownloadedText;
    data['is_downloaded_sound'] = this.isDownloadedSound;
    data['is_text'] = this.isText;
    data['is_sound'] = this.isSound;
    data['sound_duration'] = this.soundDuration;
    data['sound_chapter'] = this.soundChapter;

    return data;
  }
}

class SoundFiles {
  SoundFiles({
    this.id,
    this.bookId,
    this.type,
    this.fileName,
    this.name,
    this.length,
    this.fullPathFile,
    this.isFifty,
    this.isEightyFive,
  });

  SoundFiles.fromJson(Map<String, dynamic> json) {
    id = json['id'];
    bookId = json['book_id'];
    type = json['type'];
    fileName = json['file_name'];
    name = json['name'];
    length = json['length'];
    fullPathFile = json['full_path_file'];
    isFifty = json['is_fifty'];
    isEightyFive = json['is_eighty_five'];
  }
  SoundFiles.copyWith(SoundFiles oldData, {String? fullPathFile}) {
    id = oldData.id;
    bookId = oldData.bookId;
    type = oldData.type;
    fileName = oldData.fileName;
    name = oldData.name;
    length = oldData.length;
    fullPathFile = fullPathFile;
    isFifty = oldData.isFifty;
    isEightyFive = oldData.isEightyFive;
  }
  int? id;
  int? bookId;
  String? type;
  String? fileName;
  String? name;
  String? length;
  String? fullPathFile;
  bool? isFifty;
  bool? isEightyFive;

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['id'] = this.id;
    data['book_id'] = this.bookId;
    data['type'] = this.type;
    data['file_name'] = this.fileName;
    data['name'] = this.name;
    data['length'] = this.length;
    data['full_path_file'] = this.fullPathFile;
    data['is_fifty'] = this.isFifty;
    data['is_eighty_five'] = this.isEightyFive;
    return data;
  }
}

class TextFilesList {
  TextFilesList({this.textFiles});

  TextFilesList.fromJson(Map<String, dynamic> json) {
    if (json['textFiles'] != null) {
      textFiles = <TextFiles>[];
      json['textFiles'].forEach((v) {
        textFiles!.add(new TextFiles.fromJson(v));
      });
    }
  }
  List<TextFiles>? textFiles;

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    if (this.textFiles != null) {
      data['textFiles'] =
          this.textFiles!.map((TextFiles v) => v.toJson()).toList();
    }
    return data;
  }
}

class TextFiles {
  TextFiles({this.id, this.bookId, this.name, this.type, this.fullPathFile});

  TextFiles.fromJson(Map<String, dynamic> json) {
    id = json['id'];
    bookId = json['book_id'];
    name = json['name'];
    type = json['type'];
    fullPathFile = json['full_path_file'];
  }
  int? id;
  int? bookId;
  String? name;
  String? type;
  String? fullPathFile;

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['id'] = this.id;
    data['book_id'] = this.bookId;
    data['name'] = this.name;
    data['type'] = this.type;
    data['full_path_file'] = this.fullPathFile;
    return data;
  }
}

class Authors {
  Authors({
    this.id,
    this.firstName,
    this.lastName,
    this.fullNameDecode,
    this.pivot,
  });

  Authors.fromJson(Map<String, dynamic> json) {
    id = json['id'];
    firstName = json['first_name'];
    lastName = json['last_name'];
    if (json['full_name_decode'] != null) {
      fullNameDecode = <FullNameDecode>[];
      json['full_name_decode'].forEach((v) {
        fullNameDecode!.add(new FullNameDecode.fromJson(v));
      });
    }
    pivot = json['pivot'] != null ? new Pivot.fromJson(json['pivot']) : null;
  }
  int? id;
  String? firstName;
  String? lastName;
  List<FullNameDecode>? fullNameDecode;
  Pivot? pivot;

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['id'] = this.id;
    data['first_name'] = this.firstName;
    data['last_name'] = this.lastName;
    if (this.fullNameDecode != null) {
      data['full_name_decode'] =
          this.fullNameDecode!.map((FullNameDecode v) => v.toJson()).toList();
    }
    if (this.pivot != null) {
      data['pivot'] = this.pivot!.toJson();
    }
    return data;
  }
}

class FullNameDecode {
  FullNameDecode({
    this.firstNameAr,
    this.firstNameEn,
    this.firstNameHe,
    this.lastNameAr,
    this.lastNameEn,
    this.lastNameHe,
  });

  FullNameDecode.fromJson(Map<String, dynamic> json) {
    firstNameAr = json['first_name_ar'];
    firstNameEn = json['first_name_en'];
    firstNameHe = json['first_name_he'];
    lastNameAr = json['last_name_ar'];
    lastNameEn = json['last_name_en'];
    lastNameHe = json['last_name_he'];
  }
  String? firstNameAr;
  String? firstNameEn;
  String? firstNameHe;
  String? lastNameAr;
  String? lastNameEn;
  String? lastNameHe;

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['first_name_ar'] = this.firstNameAr;
    data['first_name_en'] = this.firstNameEn;
    data['first_name_he'] = this.firstNameHe;
    data['last_name_ar'] = this.lastNameAr;
    data['last_name_en'] = this.lastNameEn;
    data['last_name_he'] = this.lastNameHe;
    return data;
  }
}

class Pivot {
  Pivot({this.bookId, this.contributorId, this.role});

  Pivot.fromJson(Map<String, dynamic> json) {
    bookId = json['book_id'];
    contributorId = json['contributor_id'];
    role = json['role'];
  }
  int? bookId;
  int? contributorId;
  String? role;

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['book_id'] = this.bookId;
    data['contributor_id'] = this.contributorId;
    data['role'] = this.role;
    return data;
  }
}

class Category {
  Category({this.id, this.nameAr, this.nameEn, this.nameHe});

  Category.fromJson(Map<String, dynamic> json) {
    id = json['id'];
    nameAr = json['name_ar'];
    nameEn = json['name_en'];
    nameHe = json['name_he'];
  }
  int? id;
  String? nameAr;
  String? nameEn;
  String? nameHe;

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['id'] = this.id;
    data['name_ar'] = this.nameAr;
    data['name_en'] = this.nameEn;
    data['name_he'] = this.nameHe;
    return data;
  }
}

class Tags {
  Tags({this.id, this.nameAr, this.nameEn, this.nameHe, this.pivot});

  Tags.fromJson(Map<String, dynamic> json) {
    id = json['id'];
    nameAr = json['name_ar'];
    nameEn = json['name_en'];
    nameHe = json['name_he'];
    pivot = json['pivot'] != null ? new PivotTag.fromJson(json['pivot']) : null;
  }
  int? id;
  String? nameAr;
  String? nameEn;
  String? nameHe;
  PivotTag? pivot;

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['id'] = this.id;
    data['name_ar'] = this.nameAr;
    data['name_en'] = this.nameEn;
    data['name_he'] = this.nameHe;
    if (this.pivot != null) {
      data['pivot'] = this.pivot!.toJson();
    }
    return data;
  }
}

class PivotTag {
  PivotTag({this.bookId, this.tagId});

  PivotTag.fromJson(Map<String, dynamic> json) {
    bookId = json['book_id'];
    tagId = json['tag_id'];
  }
  int? bookId;
  int? tagId;

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['book_id'] = this.bookId;
    data['tag_id'] = this.tagId;
    return data;
  }
}

class LimitThreeComments {
  LimitThreeComments.fromJson(Map<String, dynamic> json) {
    id = json['id'];
    rate = json['rate'];
    note = json['note'];
    user = json['user'] != null ? new User.fromJson(json['user']) : null;
    usersCount = json['users_count'];
    likeByMe = json['like_by_me'];
    isEditDeleteShown = json['isEditDeleteShown'];
    createdAt = json['created_at'];
    updatedAt = json['updated_at'];
  }
  LimitThreeComments({
    this.id,
    this.rate,
    this.note,
    this.user,
    this.createdAt,
    this.usersCount,
    this.likeByMe,
    this.isEditDeleteShown,
  });

  int? id;
  String? rate;
  String? note;
  User? user;
  int? usersCount;
  bool? likeByMe;
  bool? isEditDeleteShown;
  String? createdAt;
  String? updatedAt;

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['id'] = this.id;
    data['rate'] = this.rate;
    data['note'] = this.note;
    if (this.user != null) {
      data['user'] = this.user!.toJson();
    }
    data['users_count'] = this.usersCount;
    data['like_by_me'] = this.likeByMe;
    data['isEditDeleteShown'] = this.isEditDeleteShown;
    data['note'] = this.note;
    data['created_at'] = this.createdAt;
    data['updated_at'] = this.createdAt;

    return data;
  }
}

class User {
  User.fromJson(Map<String, dynamic> json) {
    id = json['id'];
    firstName = json['first_name'];
    lastName = json['last_name'];
  }
  User({this.id, this.firstName, this.lastName});

  int? id;
  String? firstName;
  String? lastName;

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['id'] = this.id;
    data['first_name'] = this.firstName;
    data['last_name'] = this.lastName;
    return data;
  }
}