import 'package:rasadyar_app/presentation/pages/modules/logic.dart';
import 'package:rasadyar_app/presentation/pages/modules/view.dart';
import 'package:rasadyar_app/presentation/pages/splash/logic.dart';
import 'package:rasadyar_app/presentation/pages/splash/view.dart';
import 'package:rasadyar_app/presentation/pages/system_design/system_design.dart';
import 'package:rasadyar_chicken/chicken.dart';
import 'package:rasadyar_chicken/data/di/chicken_di.dart';
import 'package:rasadyar_core/core.dart';
import 'package:rasadyar_inspection/injection/inspection_di.dart';
import 'package:rasadyar_inspection/inspection.dart';
import 'package:rasadyar_livestock/injection/live_stock_di.dart';
import 'package:rasadyar_livestock/presentation/routes/app_pages.dart';

part 'app_paths.dart';

sealed class AppPages {
  AppPages._();

  static const String initRoutes = AppPaths.splash;
  static const String initDesignSystem = AppPaths.systemDesignPage;

  static List<GetPage> pages = [
    GetPage(name: AppPaths.systemDesignPage, page: () => SystemDesignPage()),

    GetPage(
      name: AppPaths.moduleList,
      page: () => ModulesPage(),
      binding: BindingsBuilder(() {
        Get.lazyPut(() => SliderLogic(), tag: "up");
        Get.lazyPut(() => SliderLogic(), tag: "down");
        Get.put(ModulesLogic());
      }),
    ),

    GetPage(
      name: AppPaths.splash,
      page: () => SplashPage(),
      binding: BindingsBuilder.put(() => SplashLogic()),
    ),

    ...InspectionPages.pages,
    ...LiveStockPages.pages,
    ...ChickenPages.pages,
  ];
}


Map<String, List<Future<void> Function()?>?> getAuthTargetPage(Module? value) {
  switch (value) {
    case Module.inspection:
      return {
        InspectionRoutes.auth: [setupInspectionDI, removeInspectionDI],
      };
    case Module.liveStocks:
      return {
        LiveStockRoutes.auth: [setupLiveStockDI, removeLiveStockDI],
      };
    case Module.chicken:
      return {
        ChickenRoutes.auth: [setupChickenDI, removeChickenDI],
      };
    default:
      return {AppPaths.moduleList: null};
  }
}
