import 'interfaces/i_http_response.dart';
import 'package:dio/dio.dart';

class DioResponse<T> implements IHttpResponse<T> {
  final Response<dynamic> _response;

  DioResponse(this._response);

  @override
  T? get data => _response.data;

  @override
  int get statusCode => _response.statusCode ?? 0;

  @override
  Map<String, dynamic>? get headers => _response.headers.map;

  @override
  bool get isSuccessful => statusCode >= 200 && statusCode < 300;
}
