import 'package:flutter/material.dart';
import 'package:kmobile/features/auth/screens/mpin_screen.dart';
import 'package:kmobile/features/auth/screens/splash_screen.dart';
import '../app.dart';
import '../features/auth/screens/login_screen.dart';
// import '../features/auth/screens/forgot_password_screen.dart';
// import '../features/auth/screens/register_screen.dart';
import '../features/dashboard/screens/dashboard_screen.dart';
// import '../features/accounts/screens/accounts_screen.dart';
// import '../features/transactions/screens/transactions_screen.dart';
// import '../features/payments/screens/payments_screen.dart';
// import '../features/settings/screens/settings_screen.dart';
import 'package:kmobile/features/auth/screens/tnc_required_screen.dart';

class AppRoutes {
  // Private constructor to prevent instantiation
  AppRoutes._();

  // Route names
  static const String splash = '/';
  static const String login = '/login';
  static const String mPin = '/mPin';
  static const String register = '/register';
  static const String forgotPassword = '/forgot-password';
  static const String navigationScaffold = '/navigation-scaffold';
  static const String dashboard = '/dashboard';
  static const String accounts = '/accounts';
  static const String transactions = '/transactions';
  static const String payments = '/payments';

  // Route generator
  static Route<dynamic> generateRoute(RouteSettings settings) {
    switch (settings.name) {
      case splash:
        return MaterialPageRoute(builder: (_) => const SplashScreen());
      case login:
        return MaterialPageRoute(builder: (_) => const LoginScreen());
      case TncRequiredScreen.routeName: // Renamed class
        return MaterialPageRoute(
            builder: (_) => const TncRequiredScreen()); // Renamed class
      case mPin:
        return MaterialPageRoute(
            builder: (_) => const MPinScreen(
                  mode: MPinMode.enter,
                ));

      case register:
        // Placeholder - create the RegisterScreen class and uncomment
        // return MaterialPageRoute(builder: (_) => const RegisterScreen());
        return _errorRoute();

      case forgotPassword:
        // Placeholder - create the ForgotPasswordScreen class and uncomment
        // return MaterialPageRoute(builder: (_) => const ForgotPasswordScreen());
        return _errorRoute();

      case navigationScaffold:
        return MaterialPageRoute(builder: (_) => const NavigationScaffold());

      case dashboard:
        return MaterialPageRoute(builder: (_) => const DashboardScreen());

      case accounts:
        // Placeholder - create the AccountsScreen class and uncomment
        // return MaterialPageRoute(builder: (_) => const AccountsScreen());
        return _errorRoute();

      case transactions:
        // Placeholder - create the TransactionsScreen class and uncomment
        // return MaterialPageRoute(builder: (_) => const TransactionsScreen());
        return _errorRoute();

      case payments:
        // Placeholder - create the PaymentsScreen class and uncomment
        // return MaterialPageRoute(builder: (_) => const PaymentsScreen());
        return _errorRoute();

      default:
        return _errorRoute();
    }
  }

  // Error route
  static Route<dynamic> _errorRoute() {
    return MaterialPageRoute(builder: (_) {
      return Scaffold(
        appBar: AppBar(
          title: const Text('Error'),
        ),
        body: const Center(
          child: Text('Route not found!'),
        ),
      );
    });
  }
}
