import 'package:electronic_assistant/module/audiopicker/controller.dart';
import 'package:electronic_assistant/module/audiopicker/view.dart';
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/complaint/controller.dart';
import 'package:electronic_assistant/module/main/drawer/complaint/view.dart';
import 'package:electronic_assistant/module/main/drawer/controller.dart';
import 'package:electronic_assistant/module/modelexplain/view.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/view.dart';
import 'package:electronic_assistant/module/template/template_detail/controller.dart';
import 'package:electronic_assistant/module/template/template_detail/view.dart';
import 'package:electronic_assistant/module/template/template_edit/controller.dart';
import 'package:get/get.dart';
import '../module/agenda/controller.dart';
import '../module/agenda/detail/controller.dart';
import '../module/agenda/detail/view.dart';
import '../module/agenda/search/view.dart';
import '../module/agenda/view.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/modelexplain/controller.dart';
import '../module/record/view.dart';
import '../module/splash/view.dart';
import '../module/talk/controller.dart';
import '../module/template/template_edit/view.dart';
import '../module/template/template_list/controller.dart';
import '../module/template/template_list/view.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';

  static const agendaDetail = '/agendaDetail';

  static const audioPicker = '/audioPicker';

  static const complaintOpinion = '/complaintOpinion';

  static const modelExplain = '/modelExplain';

  static const templateEdit = '/templateEdit';

  static const templateList = '/templateList';

  static const templateDetail = '/templateDetail';
}

class AppBinding extends Bindings {
  @override
  void dependencies() {
    lazyPut(() => MainController());
    lazyPut(() => SplashController());
    lazyPut(() => HomePageController());
    lazyPut(() => LoginController());
    lazyPut(() => AgendaController());
    lazyPut(() => ChatController());
    lazyPut(() => TalkController());
    lazyPut(() => RecordController());
    lazyPut(() => StoreController());
    lazyPut(() => FilesController());
    lazyPut(() => FileSearchController());
    lazyPut(() => ChatStartController());
    lazyPut(() => BrowserController());
    lazyPut(() => MainDrawerController());
    lazyPut(() => AgendaDetailController());
    lazyPut(() => AudioPickerController());
    lazyPut(() => ComplaintOpinionController());
    lazyPut(() => ModelExplainController());
    lazyPut(() => TemplateEditController());
    lazyPut(() => TemplateListController());
    lazyPut(() => TemplateDetailController());
  }

  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 AgendaPage()),
  GetPage(name: RoutePath.taskSearch, page: () => const AgendaSearchPage()),
  GetPage(name: RoutePath.record, page: () => const RecordPage()),
  GetPage(name: RoutePath.store, page: () => const StorePage()),
  GetPage(
      name: RoutePath.talkDetail,
      page: () => TalkPage(),
      preventDuplicates: false),
  GetPage(name: RoutePath.browser, page: () => const BrowserPage()),
  GetPage(name: RoutePath.agendaDetail, page: () => const AgendaDetailPage()),
  GetPage(name: RoutePath.audioPicker, page: () => const AudioPickerPage()),
  GetPage(
      name: RoutePath.complaintOpinion,
      page: () => const ComplaintOpinionPage()),
  GetPage(name: RoutePath.modelExplain, page: () => const ModelExplainPage()),
  GetPage(name: RoutePath.templateEdit, page: () => const TemplateEditPage()),
  GetPage(name: RoutePath.templateList, page: () => const TemplateListPage()),
  GetPage(
      name: RoutePath.templateDetail, page: () => const TemplateDetailPage()),
];
