import 'package:dio/dio.dart';
import 'package:recording_tool/app/config/app_config.dart';

/// 应用全局 Dio 单例，供业务请求与调试插件共用。
class AppDio {
  AppDio._();

  static Dio? _instance;

  static Dio get instance {
    return _instance ??= Dio(
      BaseOptions(
        baseUrl: AppConfig.current.baseUrl,
        connectTimeout: const Duration(seconds: 30),
        receiveTimeout: const Duration(seconds: 30),
        sendTimeout: const Duration(seconds: 30),
        responseType: ResponseType.json,
      ),
    );
  }
}
