import 'package:dio/dio.dart';
import '../../domain/repositories/leaderboard_repository.dart';
import '../datasources/leaderboard_remote_datasource.dart';

class LeaderboardRepositoryImpl implements LeaderboardRepository {
  final LeaderboardRemoteDatasource remote;

  LeaderboardRepositoryImpl(this.remote);

  @override
  Future<List<LeaderboardEntryModel>> getLeaderboard() async {
    try {
      return await remote.getLeaderboard();
    } on DioException catch (e) {
      throw e.error ?? e;
    }
  }
}