import 'package:electronic_assistant/module/browser/controller.dart';
import 'package:electronic_assistant/module/browser/view.dart';
import 'package:electronic_assistant/module/chat/start/controller.dart';
import 'package:electronic_assistant/module/files/controller.dart';
import 'package:electronic_assistant/module/files/search/controller.dart';
import 'package:electronic_assistant/module/main/controller.dart';
import 'package:electronic_assistant/module/main/drawer/controller.dart';
import 'package:electronic_assistant/module/record/controller.dart';
import 'package:electronic_assistant/module/splash/controller.dart';
import 'package:electronic_assistant/module/store/controller.dart';
import 'package:electronic_assistant/module/store/view.dart';
import 'package:electronic_assistant/module/talk/controller.dart';
import 'package:electronic_assistant/module/talk/summary/controller.dart';
import 'package:electronic_assistant/module/talk/todo/controller.dart';
import 'package:electronic_assistant/module/talk/view.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/talk/original/controller.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';

  static const store = '/store';

  static const browser = '/browser';
}

class AppBinding extends Bindings {
  @override
  void dependencies() {
    lazyPut(() => MainController());
    lazyPut(() => SplashController());
    lazyPut(() => HomePageController());
    lazyPut(() => LoginController());
    lazyPut(() => TaskController());
    lazyPut(() => ChatController());
    lazyPut(() => TalkController());
    lazyPut(() => RecordController());
    lazyPut(() => OriginalController());
    lazyPut(() => SummaryController());
    lazyPut(() => TodoController());
    lazyPut(() => StoreController());
    lazyPut(() => FilesController());
    lazyPut(() => FileSearchController());
    lazyPut(() => ChatStartController());
    lazyPut(() => BrowserController());
    lazyPut(() => MainDrawerController());
  }

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

final generalPages = [
  GetPage(name: RoutePath.splash, page: () => 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.store, page: () => const StorePage()),
  GetPage(name: RoutePath.talkDetail, page: () => const TalkPage()),
  GetPage(name: RoutePath.browser, page: () => const BrowserPage()),
];
