import 'package:flutter/material.dart';
import 'login_signup_page.dart';
import 'home_page.dart';
import 'forgot_password_page.dart';
import 'theme/app_theme.dart';
import 'splash_page.dart'; // Added
import 'cart_page.dart'; // Added
import 'checkout_page.dart'; // Added
import 'notification_page.dart'; // Added

final GlobalKey<_MyAppState> myAppKey = GlobalKey();

void main() {
  runApp(MyApp(key: myAppKey));
}

class MyApp extends StatefulWidget {
  const MyApp({super.key});

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  ThemeMode themeMode = ThemeMode.light;

  void changeTheme(ThemeMode newThemeMode) {
    setState(() {
      themeMode = newThemeMode;
    });
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Amazons Mock App',
      debugShowCheckedModeBanner: false,
      theme: AppTheme.lightTheme,
      darkTheme: AppTheme.darkTheme,
      themeMode: themeMode,
      initialRoute: '/splash', // Changed to splash
      routes: {
        '/splash': (context) => const SplashPage(), // Added splash route
        '/': (context) => const LoginSignupPage(), // Login/Signup is now root after splash
        '/home': (context) => const HomePage(),
        '/forgot-password': (context) => const ForgotPasswordPage(),
        '/cart': (context) => const CartPage(), // Added cart route
        '/checkout': (context) => const CheckoutPage(), // Added checkout route
        '/notifications': (context) => const NotificationPage(), // Added notification route
      },
    );
  }
}