import 'package:frontend_eccp_mobile/modules/auth/refresh_token/data/datasources/auth_remote_datasource.dart';
import 'package:frontend_eccp_mobile/modules/auth/refresh_token/data/model/refresh_token_response.dart';
import 'package:injectable/injectable.dart';

@lazySingleton
class AuthRepository {
  AuthRepository(this._remoteDatasource);

  final AuthRemoteDataSource _remoteDatasource;

  Future<RefreshTokenResponse> refreshToken() async {
    final response = await _remoteDatasource.refreshToken();

    if (response.status != 'success') {
      throw Exception(response.message);
    }

    return response;
  }
}
