import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'providers/auth_provider.dart';
import 'layouts/main_layout.dart';
import 'pages/login_screen.dart';
import 'pages/tables.dart';
import 'pages/categorie.dart';
import 'pages/commandes_screen.dart';
import 'pages/menus_screen.dart';
import 'pages/historique_commande.dart';
import 'pages/information.dart';
import 'pages/printer_page.dart';
import 'pages/encaissement_screen.dart';

void main() {
  runApp(
    MultiProvider(
      providers: [
        ChangeNotifierProvider(create: (_) => AuthProvider()),
      ],
      child: const MyApp(),
    ),
  );
}

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

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Restaurant App',
      debugShowCheckedModeBanner: false,
      theme: ThemeData(primarySwatch: Colors.green),
      initialRoute: '/login',
      routes: {
        '/login': (context) => const LoginScreen(),
        '/tables': (context) => const MainLayout(
              currentRoute: '/tables',
              child: TablesScreen(),
            ),
        '/categories': (context) => const MainLayout(
              currentRoute: '/categories',
              child: CategoriesPage(),
            ),
        '/commandes': (context) => const MainLayout(
              currentRoute: '/commandes',
              child: OrdersManagementScreen(),
            ),
        '/plats': (context) => const MainLayout(
              currentRoute: '/plats',
              child: PlatsManagementScreen(),
            ),
        '/encaissement': (context) => const MainLayout(
              currentRoute: '/encaissement',
              child: EncaissementScreen(),
            ),
        '/historique': (context) => MainLayout(
              currentRoute: '/historique',
              child: OrderHistoryPage(),
            ),
        '/information': (context) => MainLayout(
              currentRoute: '/information',
              child: PrintTemplateManagementScreen(),
            ),
        '/Setting': (context) => MainLayout(
              currentRoute: '/Setting',
              child: PrinterPage(),
            ),
      },
    );
  }
}
