// lib/services/zoom_service.dart
import 'package:flutter_zoom_videosdk/native/zoom_videosdk.dart';

class ZoomService {
  static final ZoomService _instance = ZoomService._internal();
  factory ZoomService() => _instance;
  ZoomService._internal();

  ZoomVideoSdk? _zoom;
  bool _isInitialized = false;

  Future<void> initializeZoomSDK() async {
    if (_isInitialized) return;

    try {
      _zoom = ZoomVideoSdk();
      InitConfig initConfig = InitConfig(
        domain: "zoom.us",
        enableLog: true, // Enable for debugging
      );

      await _zoom!.initSdk(initConfig);
      _isInitialized = true;
      print("Zoom SDK initialized successfully");
    } catch (e) {
      print("Error initializing Zoom SDK: $e");
      rethrow;
    }
  }

  ZoomVideoSdk? get zoom => _zoom;
  bool get isInitialized => _isInitialized;
}