import 'dart:async';

import 'package:driverapp/config/localized_values.dart';
import 'package:flutter/foundation.dart' show SynchronousFuture;
import 'package:flutter/material.dart';

class TranslationBase {
  TranslationBase(this.locale);

  final Locale locale;

  static TranslationBase of(BuildContext context) {
    return Localizations.of<TranslationBase>(context, TranslationBase);
  }

  String get dashboardScreenToolbarTitle =>
      localizedValues['dashboardScreenToolbarTitle'][locale.languageCode];

  String get settings => localizedValues['settings'][locale.languageCode];

  String get language => localizedValues['language'][locale.languageCode];

  String get lanEnglish => localizedValues['lanEnglish'][locale.languageCode];

  String get lanArabic => localizedValues['lanArabic'][locale.languageCode];

  String get cancel => localizedValues['cancel'][locale.languageCode];

  String get done => localizedValues['done'][locale.languageCode];

  String get home => localizedValues['home'][locale.languageCode];

  String get services => localizedValues['services'][locale.languageCode];

  String get mySchedule => localizedValues['mySchedule'][locale.languageCode];

  String get replay2 => localizedValues['replay2'][locale.languageCode];

  String get logout => localizedValues['logout'][locale.languageCode];

  String get booking => localizedValues['booking'][locale.languageCode];
  String get enterId => localizedValues['enterId'][locale.languageCode];
  String get pleaseEnterYourID =>
      localizedValues['pleaseEnterYourID'][locale.languageCode];
  String get enterPassword =>
      localizedValues['enterPassword'][locale.languageCode];
  String get pleaseEnterPassword =>
      localizedValues['pleaseEnterPassword'][locale.languageCode];
  String get english => localizedValues['english'][locale.languageCode];

  String get arabic => localizedValues['arabic'][locale.languageCode];

  String get enterCredentialsMsg =>
      localizedValues['enterCredentialsMsg'][locale.languageCode];

  String get forgotPassword =>
      localizedValues['forgotPassword'][locale.languageCode];
  String get login => localizedValues['login'][locale.languageCode];

  String get haveGreatDay =>
      localizedValues['haveGreatDay'][locale.languageCode];

  String get youHave => localizedValues['youHave'][locale.languageCode];

  String get deliveredPackages =>
      localizedValues['deliveredPackages'][locale.languageCode];

  String get seeAll => localizedValues['seeAll'][locale.languageCode];

  String get nearestDropOffs =>
      localizedValues['nearestDropOffs'][locale.languageCode];

  String get undeliveredPackages =>
      localizedValues['undeliveredPackages'][locale.languageCode];

  String get away => localizedValues['away'][locale.languageCode];

  String get scan => localizedValues['scan'][locale.languageCode];

  String get deliveryInfo =>
      localizedValues['deliveryInfo'][locale.languageCode];

  String get location => localizedValues['location'][locale.languageCode];

  String get call => localizedValues['call'][locale.languageCode];

  String get sms => localizedValues['sms'][locale.languageCode];

  String get packageContent =>
      localizedValues['packageContent'][locale.languageCode];

  String get payment => localizedValues['payment'][locale.languageCode];

  String get delivryTime => localizedValues['delivryTime'][locale.languageCode];

  String get clientReached =>
      localizedValues['clientReached'][locale.languageCode];

  String get addNoteBtn => localizedValues['addNoteBtn'][locale.languageCode];

  String get nextDelivery =>
      localizedValues['nextDelivery'][locale.languageCode];

  String get confirmationSent =>
      localizedValues['confirmationSent'][locale.languageCode];
  String get yourDeliveryQue =>
      localizedValues['yourDeliveryQue'][locale.languageCode];
  String get toAddPackageToQue =>
      localizedValues['toAddPackageToQue'][locale.languageCode];

  String get delivered => localizedValues['delivered'][locale.languageCode];

  String get deliveredAccepted =>
      localizedValues['deliveredAccepted'][locale.languageCode];

  String get deliveredRejected =>
      localizedValues['deliveredRejected'][locale.languageCode];

  String get canceled => localizedValues['canceled'][locale.languageCode];

  String get selectAction =>
      localizedValues['selectAction'][locale.languageCode];

  String get youHaveSelected =>
      localizedValues['youHaveSelected'][locale.languageCode];

  String get confirm => localizedValues['confirm'][locale.languageCode];

  String get areYouSure => localizedValues['areYouSure'][locale.languageCode];

  String get languageText =>
      localizedValues['languageText'][locale.languageCode];
  String get notification =>
      localizedValues['notification'][locale.languageCode];
}

class TranslationBaseDelegate extends LocalizationsDelegate<TranslationBase> {
  const TranslationBaseDelegate();

  @override
  bool isSupported(Locale locale) => ['en', 'ar'].contains(locale.languageCode);

  @override
  Future<TranslationBase> load(Locale locale) {
    return SynchronousFuture<TranslationBase>(TranslationBase(locale));
  }

  @override
  bool shouldReload(TranslationBaseDelegate old) => false;
}
