import 'package:dio/dio.dart';
import '../../logger.dart';

class ResponseInterceptor extends Interceptor {
  @override
  void onResponse(Response response, ResponseInterceptorHandler handler) {
    final uuid = response.requestOptions.extra['uuid'] as String? ?? '';

    _printResponseLog(response, uuid);

    handler.next(response);
  }

  void _printResponseLog(Response response, String uuid) {
    Log.warn('====================== Response START ======================');
    Log.warn('UUID: $uuid');
    Log.warn('Status Code: ${response.statusCode}');
    Log.warn('Data: ${response.data}');
    Log.warn('====================== Response END ======================');
  }
}