import 'package:electronic_assistant/module/main/controller.dart';
import 'package:electronic_assistant/module/talk/controller.dart';
import 'package:electronic_assistant/module/talk/view.dart';
import 'package:electronic_assistant/module/record/controller.dart';
import 'package:electronic_assistant/module/task/search/task_search.dart';
import 'package:electronic_assistant/module/task/view.dart';
import 'package:get/get.dart';

import '../module/chat/controller.dart';
import '../module/chat/view.dart';
import '../module/files/search/view.dart';
import '../module/files/view.dart';
import '../module/home/controller.dart';
import '../module/login/controller.dart';
import '../module/login/view.dart';
import '../module/main/view.dart';
import '../module/record/view.dart';
import '../module/splash/view.dart';
import '../module/task/controller.dart';

abstract class AppPage {
  static final pages = <GetPage>[
    ...generalPages,
  ];
}

abstract class RoutePath {
  static const splash = '/';

  static const login = '/login';

  static const mainTab = '/mainTab';

  static const files = '/files';

  static const fileSearch = '/fileSearch';

  static const task = '/task';

  static const taskSearch = '/taskSearch';

  static const chat = '/chat';

  static const record = '/record';

  static const talkDetail = '/talkDetail';
}

class AppBinding extends Bindings {
  @override
  void dependencies() {
    lazyPut(() => MainController());
    lazyPut(() => HomePageController());
    lazyPut(() => LoginController());
    lazyPut(() => TaskController());
    lazyPut(() => ChatController());
    lazyPut(() => TalkController());
    lazyPut(() => RecordController());
  }

  void lazyPut<S>(InstanceBuilderCallback<S> builder) {
    Get.lazyPut(builder, fenix: true);
  }
}

final generalPages = [
  GetPage(name: RoutePath.splash, page: () => const SplashPage()),
  GetPage(name: RoutePath.login, page: () => const LoginPage()),
  GetPage(name: RoutePath.mainTab, page: () => MainTabPage()),
  GetPage(name: RoutePath.files, page: () => const FilesPage()),
  GetPage(name: RoutePath.fileSearch, page: () => const FileSearchPage()),
  GetPage(name: RoutePath.chat, page: () => const ChatPage()),
  GetPage(name: RoutePath.task, page: () => const TaskPage()),
  GetPage(name: RoutePath.taskSearch, page: () => const TaskSearchPage()),
  GetPage(name: RoutePath.record, page: () =>  const RecordPage()),
  GetPage(name: RoutePath.talkDetail, page: () => TalkPage()),
];
