import 'package:flutter/material.dart';
import 'layouts/main_layout.dart';
import 'pages/tables.dart';
import 'pages/categorie.dart';
import 'pages/commandes_screen.dart';
import 'pages/login_screen.dart';
import 'pages/menus_screen.dart';
import 'pages/encaissement_screen.dart'; // NOUVEAU

void main() {
  runApp(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,
        visualDensity: VisualDensity.adaptivePlatformDensity,
      ),
      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(),
            ),
        // NOUVELLE ROUTE pour l'encaissement
        '/encaissement':
            (context) => const MainLayout(
              currentRoute: '/encaissement',
              child: EncaissementScreen(),
            ),
      },
    );
  }
}
