// GENERATED CODE - DO NOT MODIFY BY HAND

// **************************************************************************
// UserGenerator
// **************************************************************************

import 'package:rxdart/rxdart.dart';
import 'package:gmalpha_flutter/commonModel/sp/SpUtil.dart';

class UserEntityImpl {
  factory UserEntityImpl() => _sharedInstance();

  static UserEntityImpl _instance;

  UserEntityImpl._() {}

  static UserEntityImpl _sharedInstance() {
    if (_instance == null) {
      _instance = UserEntityImpl._();
    }
    return _instance;
  }

  SpUtil spUtil = SpUtil.getInstance();

  String _userId;
  Observable<bool> saveuserId(String userId) {
    return Observable.fromFuture(spUtil.saveStringKv("user_uid", userId))
        .map((value) {
      if (value) {
        this._userId = userId;
      }
      return value;
    });
  }

  Observable<String> getuserId() {
    if (_userId != null) {
      return Observable.fromFuture(Future.value(_userId));
    }
    return Observable.fromFuture(spUtil.getStringKv("user_uid")).map((value) {
      if (value == "") {
        return null;
      }
      return value;
    });
  }

  String _nickName;
  Observable<bool> savenickName(String nickName) {
    return Observable.fromFuture(spUtil.saveStringKv("username", nickName))
        .map((value) {
      if (value) {
        this._nickName = nickName;
      }
      return value;
    });
  }

  Observable<String> getnickName() {
    if (_nickName != null) {
      return Observable.fromFuture(Future.value(_nickName));
    }
    return Observable.fromFuture(spUtil.getStringKv("username")).map((value) {
      if (value == "") {
        return null;
      }
      return value;
    });
  }

  String _profilePic;
  Observable<bool> saveprofilePic(String profilePic) {
    return Observable.fromFuture(spUtil.saveStringKv("potrait", profilePic))
        .map((value) {
      if (value) {
        this._profilePic = profilePic;
      }
      return value;
    });
  }

  Observable<String> getprofilePic() {
    if (_profilePic != null) {
      return Observable.fromFuture(Future.value(_profilePic));
    }
    return Observable.fromFuture(spUtil.getStringKv("potrait")).map((value) {
      if (value == "") {
        return null;
      }
      return value;
    });
  }

  bool _hasAnswered;
  Observable<bool> savehasAnswered(bool hasAnswered) {
    return Observable.fromFuture(spUtil.saveBoolKv("personal_qa", hasAnswered))
        .map((value) {
      if (value) {
        this._hasAnswered = hasAnswered;
      }
      return value;
    });
  }

  Observable<bool> gethasAnswered() {
    if (_hasAnswered != null) {
      return Observable.fromFuture(Future.value(_hasAnswered));
    }
    return Observable.fromFuture(spUtil.getBoolKv("personal_qa"));
  }

  bool _hasScanFace;
  Observable<bool> savehasScanFace(bool hasScanFace) {
    return Observable.fromFuture(
            spUtil.saveBoolKv("has_scan_face", hasScanFace))
        .map((value) {
      if (value) {
        this._hasScanFace = hasScanFace;
      }
      return value;
    });
  }

  Observable<bool> gethasScanFace() {
    if (_hasScanFace != null) {
      return Observable.fromFuture(Future.value(_hasScanFace));
    }
    return Observable.fromFuture(spUtil.getBoolKv("has_scan_face"));
  }

  String _gender;
  Observable<bool> savegender(String gender) {
    return Observable.fromFuture(spUtil.saveStringKv("gender", gender))
        .map((value) {
      if (value) {
        this._gender = gender;
      }
      return value;
    });
  }

  Observable<String> getgender() {
    if (_gender != null) {
      return Observable.fromFuture(Future.value(_gender));
    }
    return Observable.fromFuture(spUtil.getStringKv("gender")).map((value) {
      if (value == "") {
        return null;
      }
      return value;
    });
  }

  String _cityId;
  Observable<bool> savecityId(String cityId) {
    return Observable.fromFuture(spUtil.saveStringKv("current_city_id", cityId))
        .map((value) {
      if (value) {
        this._cityId = cityId;
      }
      return value;
    });
  }

  Observable<String> getcityId() {
    if (_cityId != null) {
      return Observable.fromFuture(Future.value(_cityId));
    }
    return Observable.fromFuture(spUtil.getStringKv("current_city_id"))
        .map((value) {
      if (value == "") {
        return null;
      }
      return value;
    });
  }

  double _birth;
  Observable<bool> savebirth(double birth) {
    return Observable.fromFuture(spUtil.saveDoubleKv("birthday", birth))
        .map((value) {
      if (value) {
        this._birth = birth;
      }
      return value;
    });
  }

  Observable<double> getbirth() {
    if (_birth != null) {
      return Observable.fromFuture(Future.value(_birth));
    }
    return Observable.fromFuture(spUtil.getDoubleKv("birthday"));
  }

  String _countryId;
  Observable<bool> savecountryId(String countryId) {
    return Observable.fromFuture(spUtil.saveStringKv("country_id", countryId))
        .map((value) {
      if (value) {
        this._countryId = countryId;
      }
      return value;
    });
  }

  Observable<String> getcountryId() {
    if (_countryId != null) {
      return Observable.fromFuture(Future.value(_countryId));
    }
    return Observable.fromFuture(spUtil.getStringKv("country_id")).map((value) {
      if (value == "") {
        return null;
      }
      return value;
    });
  }

  bool _detailSetted;
  Observable<bool> savedetailSetted(bool detailSetted) {
    return Observable.fromFuture(
            spUtil.saveBoolKv("detail_setted", detailSetted))
        .map((value) {
      if (value) {
        this._detailSetted = detailSetted;
      }
      return value;
    });
  }

  Observable<bool> getdetailSetted() {
    if (_detailSetted != null) {
      return Observable.fromFuture(Future.value(_detailSetted));
    }
    return Observable.fromFuture(spUtil.getBoolKv("detail_setted"));
  }

  String _questionUrl;
  Observable<bool> savequestionUrl(String questionUrl) {
    return Observable.fromFuture(
            spUtil.saveStringKv("question_url", questionUrl))
        .map((value) {
      if (value) {
        this._questionUrl = questionUrl;
      }
      return value;
    });
  }

  Observable<String> getquestionUrl() {
    if (_questionUrl != null) {
      return Observable.fromFuture(Future.value(_questionUrl));
    }
    return Observable.fromFuture(spUtil.getStringKv("question_url"))
        .map((value) {
      if (value == "") {
        return null;
      }
      return value;
    });
  }

  bool _isBind;
  Observable<bool> saveisBind(bool isBind) {
    return Observable.fromFuture(spUtil.saveBoolKv("user_bind_mobile", isBind))
        .map((value) {
      if (value) {
        this._isBind = isBind;
      }
      return value;
    });
  }

  Observable<bool> getisBind() {
    if (_isBind != null) {
      return Observable.fromFuture(Future.value(_isBind));
    }
    return Observable.fromFuture(spUtil.getBoolKv("user_bind_mobile"));
  }

  String _countryInfoName;
  Observable<bool> savecountryInfoName(String countryInfoName) {
    return Observable.fromFuture(
            spUtil.saveStringKv("country_name", countryInfoName))
        .map((value) {
      if (value) {
        this._countryInfoName = countryInfoName;
      }
      return value;
    });
  }

  Observable<String> getcountryInfoName() {
    if (_countryInfoName != null) {
      return Observable.fromFuture(Future.value(_countryInfoName));
    }
    return Observable.fromFuture(spUtil.getStringKv("country_name"))
        .map((value) {
      if (value == "") {
        return null;
      }
      return value;
    });
  }

  String _countryInfoId;
  Observable<bool> savecountryInfoId(String countryInfoId) {
    return Observable.fromFuture(
            spUtil.saveStringKv("country_id", countryInfoId))
        .map((value) {
      if (value) {
        this._countryInfoId = countryInfoId;
      }
      return value;
    });
  }

  Observable<String> getcountryInfoId() {
    if (_countryInfoId != null) {
      return Observable.fromFuture(Future.value(_countryInfoId));
    }
    return Observable.fromFuture(spUtil.getStringKv("country_id")).map((value) {
      if (value == "") {
        return null;
      }
      return value;
    });
  }

  String _countryInfoLanguage;
  Observable<bool> savecountryInfoLanguage(String countryInfoLanguage) {
    return Observable.fromFuture(
            spUtil.saveStringKv("country_language", countryInfoLanguage))
        .map((value) {
      if (value) {
        this._countryInfoLanguage = countryInfoLanguage;
      }
      return value;
    });
  }

  Observable<String> getcountryInfoLanguage() {
    if (_countryInfoLanguage != null) {
      return Observable.fromFuture(Future.value(_countryInfoLanguage));
    }
    return Observable.fromFuture(spUtil.getStringKv("country_language"))
        .map((value) {
      if (value == "") {
        return null;
      }
      return value;
    });
  }

  String _age;
  Observable<bool> saveage(String age) {
    return Observable.fromFuture(spUtil.saveStringKv("user_age", age))
        .map((value) {
      if (value) {
        this._age = age;
      }
      return value;
    });
  }

  Observable<String> getage() {
    if (_age != null) {
      return Observable.fromFuture(Future.value(_age));
    }
    return Observable.fromFuture(spUtil.getStringKv("user_age")).map((value) {
      if (value == "") {
        return null;
      }
      return value;
    });
  }
}
