import 'package:get/get.dart';
import 'package:keyboard/module/about/about_controller.dart';
import 'package:keyboard/module/browser/browser_controller.dart';
import 'package:keyboard/module/character/content/character_group_content_controller.dart';
import 'package:keyboard/module/character_custom/character_custom_controller.dart';
import 'package:keyboard/module/character_custom/detail/character_custom_detail_page.dart';
import 'package:keyboard/module/character_custom/list/character_custom_list_controller.dart';
import 'package:keyboard/module/feedback/feedback_controller.dart';
import 'package:keyboard/module/keyboard/keyboard_controller.dart';
import 'package:keyboard/module/keyboard_manage/keyboard_manage_controller.dart';
import 'package:keyboard/module/login/login_controller.dart';
import 'package:keyboard/module/mine/mine_controller.dart';
import 'package:keyboard/module/profile/profile_controller.dart';
import 'package:keyboard/module/profile/profile_page.dart';
import 'package:keyboard/module/store/store_controller.dart';
import 'package:keyboard/module/store/store_page.dart';

import '../di/get_it.dart';
import '../module/about/about_page.dart';
import '../module/browser/browser_page.dart';
import '../module/character/character_controller.dart';
import '../module/character_custom/character_custom_page.dart';
import '../module/character_custom/detail/character_custom_detail_controller.dart';
import '../module/character_custom/list/character_custom_list_page.dart';
import '../module/feedback/feedback_page.dart';
import '../module/keyboard_manage/keyboard_manage_page.dart';
import '../module/login/login_page.dart';
import '../module/main/main_controller.dart';
import '../module/main/main_page.dart';
import '../module/store/discount/discount_controller.dart';
import '../module/store/suprise/goods_surprise_controller.dart';

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

abstract class RoutePath {
  static const splash = '/';
  static const mainTab = '/mainTab';
  static const login = '/login';
  static const keyboardSetting = '/keyboardSetting';
  static const feedback = '/feedback';
  static const about = '/about';
  static const browser = '/browser';
  static const keyboardManage = '/keyboardManage';
  static const characterCustom = '/characterCustom';
  static const characterCustomDetail = '/characterCustomDetail';
  static const characterCustomList = '/characterCustomList';
  static const store = '/store';
  static const profile = '/profile';
}

class AppBinding extends Bindings {
  @override
  void dependencies() {
    lazyPut(() => getIt.get<MainController>());
    lazyPut(() => getIt.get<MineController>());
    lazyPut(() => getIt.get<CharacterController>());
    lazyPut(() => getIt.get<LoginController>());
    lazyPut(() => getIt.get<KeyBoardController>());
    lazyPut(() => getIt.get<FeedbackController>());
    lazyPut(() => getIt.get<AboutController>());
    lazyPut(() => getIt.get<BrowserController>());
    lazyPut(() => getIt.get<CharacterGroupContentController>());
    lazyPut(() => getIt.get<KeyboardManageController>());
    lazyPut(() => getIt.get<CharacterCustomController>());
    lazyPut(() => getIt.get<CharacterCustomDetailController>());
    lazyPut(() => getIt.get<CharacterCustomListController>());
    lazyPut(() => getIt.get<StoreController>());
    lazyPut(() => getIt.get<GoodsSurpriseController>());
    lazyPut(() => getIt.get<DiscountController>());
    lazyPut(() => getIt.get<ProfileController>());
  }

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

final generalPages = [
  GetPage(name: RoutePath.mainTab, page: () => MainPage()),
  GetPage(name: RoutePath.login, page: () => LoginPage()),
  GetPage(name: RoutePath.feedback, page: () => FeedbackPage()),
  GetPage(name: RoutePath.about, page: () => AboutPage()),
  GetPage(name: RoutePath.browser, page: () => BrowserPage()),
  GetPage(name: RoutePath.keyboardManage, page: () => KeyboardManagePage()),
  GetPage(name: RoutePath.characterCustom, page: () => CharacterCustomPage()),
  GetPage(
    name: RoutePath.characterCustomDetail,
    page: () => CharacterCustomDetailPage(),
  ),
  GetPage(
    name: RoutePath.characterCustomList,
    page: () => CharacterCustomListPage(),
  ),
  GetPage(name: RoutePath.store, page: () => StorePage()),
  GetPage(name: RoutePath.profile, page: () => ProfilePage()),
];
