class AyaModel {
  int totalItemsCount;
  int statusCode;
  String message;
  List<AyaModelData> data;

  AyaModel({this.totalItemsCount, this.statusCode, this.message, this.data});

  AyaModel.fromJson(Map<String, dynamic> json) {
    totalItemsCount = json['totalItemsCount'];
    statusCode = json['statusCode'];
    message = json['message'];
    if (json['data'] != null) {
      data = [];
      json['data'].forEach((v) {
        data.add(new AyaModelData.fromJson(v));
      });
    }
  }

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

class AyaModelData {
  int surahID;
  String surahNameAR;
  String surahNameEN;
  int numberOfAyahs;
  String englishNameTranslation;
  int revelationID;
  String revelationType;
  int ayahID;
  int numberInSurah;
  int page;
  int quarterID;
  int juzID;
  int manzil;
  bool sajda;
  String ayahText;
  Null eighthsID;

  AyaModelData(
      {this.surahID,
      this.surahNameAR,
      this.surahNameEN,
      this.numberOfAyahs,
      this.englishNameTranslation,
      this.revelationID,
      this.revelationType,
      this.ayahID,
      this.numberInSurah,
      this.page,
      this.quarterID,
      this.juzID,
      this.manzil,
      this.sajda,
      this.ayahText,
      this.eighthsID});

  AyaModelData.fromJson(Map<String, dynamic> json) {
    surahID = json['surahID'];
    surahNameAR = json['surahNameAR'];
    surahNameEN = json['surahNameEN'];
    numberOfAyahs = json['numberOfAyahs'];
    englishNameTranslation = json['englishNameTranslation'];
    revelationID = json['revelation_ID'];
    revelationType = json['revelationType'];
    ayahID = json['ayahID'];
    numberInSurah = json['numberInSurah'];
    page = json['page'];
    quarterID = json['quarter_ID'];
    juzID = json['juz_ID'];
    manzil = json['manzil'];
    sajda = json['sajda'];
    ayahText = json['ayah_Text'];
    eighthsID = json['eighths_ID'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['surahID'] = this.surahID;
    data['surahNameAR'] = this.surahNameAR;
    data['surahNameEN'] = this.surahNameEN;
    data['numberOfAyahs'] = this.numberOfAyahs;
    data['englishNameTranslation'] = this.englishNameTranslation;
    data['revelation_ID'] = this.revelationID;
    data['revelationType'] = this.revelationType;
    data['ayahID'] = this.ayahID;
    data['numberInSurah'] = this.numberInSurah;
    data['page'] = this.page;
    data['quarter_ID'] = this.quarterID;
    data['juz_ID'] = this.juzID;
    data['manzil'] = this.manzil;
    data['sajda'] = this.sajda;
    data['ayah_Text'] = this.ayahText;
    data['eighths_ID'] = this.eighthsID;
    return data;
  }

  String reverseAyatNumber() {
    String _ayaTemp = ayahText.substring(0, ayahText.length - numberInSurah.toString().length);
    String _ayaNum = ayahText.substring(ayahText.length - numberInSurah.toString().length, ayahText.length);
    _ayaNum = _ayaNum.split('').reversed.join('');
    return "$_ayaTemp$_ayaNum";
  }
}
