import 'package:flutter/material.dart';
import 'package:logger/logger.dart';

import 'app.dart';
import 'injection_container.dart';

void main() async {
  WidgetsFlutterBinding.ensureInitialized();

  final logger = Logger();

  try {
    // Initialize dependencies
    logger.i('Initializing dependencies...');
    await initializeDependencies();

    // Initialize services and connect to bridges
    logger.i('Initializing services...');
    await initializeServices();

    logger.i('Starting COPILOT Keyboard app...');
  } catch (e, stackTrace) {
    logger.e('Initialization failed', error: e, stackTrace: stackTrace);
    // Continue anyway - app will show disconnected state
  }

  runApp(const CopilotKeyboardApp());
}
