import 'package:netrain_flutter_app/douwen/custom/http/AdService.dart';

import 'base/IEntity.dart';
import 'base/IRepository.dart';

class AdRepository with IRepository {
  AdRepository._privateConstructor(this._service);

  static AdRepository _instance;

  static AdRepository get instance {
    if (_instance == null) {
      _instance = AdRepository._privateConstructor(AdService());
    }
    return _instance;
  }

  final AdService _service;

  void login(void onSuccess(String str), void onError(IEntity iEntity)) =>
      getResult<String>(_service.login(),
          analysis: (data) => data.toString(),
          onSuccess: (str) => onSuccess(str),
          onError: (iEntity) => onError(iEntity));
}
