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

import 'theme/theme_provider.dart';
import 'screens/settings/appearance_settings.dart';

Future<void> main() async {
  WidgetsFlutterBinding.ensureInitialized();
  final themeProvider = await AutopilotThemeProvider.load();
  runApp(
    ChangeNotifierProvider<AutopilotThemeProvider>.value(
      value: themeProvider,
      child: const ArAutopilotApp(),
    ),
  );
}

class ArAutopilotApp extends StatelessWidget {
  const ArAutopilotApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'AR-Autopilot',
      debugShowCheckedModeBanner: false,
      theme: ThemeData(useMaterial3: true),
      // Initial route — Sprint 4 starts with the Appearance screen for demo
      initialRoute: AppearanceSettingsScreen.routeName,
      routes: {
        AppearanceSettingsScreen.routeName: (_) => const AppearanceSettingsScreen(),
      },
    );
  }
}
