import 'package:flutter/material.dart';

import 'package:get/get.dart';

import '../modules/about/bindings/about_binding.dart';
import '../modules/about/views/about_view.dart';
import '../modules/notfound/views/notfound_view.dart';
import '../modules/account/bindings/account_binding.dart';
import '../modules/account/views/account_view.dart';
import '../modules/deviceauth/bindings/deviceauth_binding.dart';
import '../modules/deviceauth/views/deviceauth_view.dart';
import '../modules/feedback/bindings/feedback_binding.dart';
import '../modules/feedback/views/feedback_view.dart';
import '../modules/forgotpwd/bindings/forgotpwd_binding.dart';
import '../modules/forgotpwd/views/forgotpwd_view.dart';
import '../modules/home/bindings/home_binding.dart';
import '../modules/home/views/home_view.dart';
import '../modules/language/bindings/language_binding.dart';
import '../modules/language/views/language_view.dart';
import '../modules/login/bindings/login_binding.dart';
import '../modules/login/views/login_view.dart';
import '../modules/markdown/bindings/markdown_binding.dart';
import '../modules/markdown/views/markdown_view.dart';
import '../modules/medialocation/bindings/medialocation_binding.dart';
import '../modules/medialocation/views/medialocation_view.dart';
import '../modules/node/bindings/node_binding.dart';
import '../modules/node/views/node_view.dart';
import '../modules/precode/bindings/precode_binding.dart';
import '../modules/precode/sendemail/bindings/precode_sendemail_binding.dart';
import '../modules/precode/sendemail/views/precode_sendemail_view.dart';
import '../modules/precode/views/precode_view.dart';
import '../modules/routingmode/bindings/routingmode_binding.dart';
import '../modules/routingmode/views/routingmode_view.dart';
import '../modules/setting/bindings/setting_binding.dart';
import '../modules/setting/views/setting_view.dart';
import '../modules/signup/bindings/signup_binding.dart';
import '../modules/signup/views/signup_view.dart';
import '../modules/splash/bindings/splash_binding.dart';
import '../modules/splash/views/splash_view.dart';
import '../modules/splittunneling/bindings/splittunneling_binding.dart';
import '../modules/splittunneling/selectapp/bindings/splittunneling_selectapp_binding.dart';
import '../modules/splittunneling/selectapp/views/splittunneling_selectapp_view.dart';
import '../modules/splittunneling/views/splittunneling_view.dart';
import '../modules/subscription/bindings/subscription_binding.dart';
import '../modules/subscription/views/subscription_view.dart';
import '../modules/theme/bindings/theme_binding.dart';
import '../modules/theme/views/theme_view.dart';
import '../modules/web/bindings/web_binding.dart';
import '../modules/web/views/web_view.dart';

part 'app_routes.dart';

/// 路由页面配置类
class AppPages {
  /// 初始路由
  static const initial = Routes.SPLASH;

  /// 未知路由（404页面）
  static final unknownRoute = GetPage(
    name: '/notfound',
    page: () => const NotFoundView(),
    transition: Transition.fade,
  );

  /// 路由页面列表
  static final routes = [
    GetPage(
      name: _Paths.SPLASH,
      page: () => const SplashView(),
      binding: SplashBinding(),
      transition: Transition.noTransition,
    ),
    GetPage(
      name: _Paths.HOME,
      page: () => const HomeView(),
      binding: HomeBinding(),
      transition: Transition.noTransition,
    ),
    GetPage(
      name: _Paths.NODE,
      page: () => const NodeView(),
      binding: NodeBinding(),
      transition: Transition.rightToLeftWithFade,
      curve: Curves.easeInOut,
      preventDuplicates: true, // 防止重复打开同一个页面
    ),
    GetPage(
      name: _Paths.WEB,
      page: () => const WebView(),
      binding: WebBinding(),
      transition: Transition.rightToLeftWithFade,
      curve: Curves.easeInOut,
    ),
    GetPage(
      name: _Paths.ABOUT,
      page: () => const AboutView(),
      binding: AboutBinding(),
      transition: Transition.native,
      curve: Curves.easeInOut,
    ),
    GetPage(
      name: _Paths.ACCOUNT,
      page: () => const AccountView(),
      binding: AccountBinding(),
      transition: Transition.native,
      curve: Curves.easeInOut,
    ),
    GetPage(
      name: _Paths.MARKDOWN,
      page: () => const MarkdownView(),
      binding: MarkdownBinding(),
      transition: Transition.native,
      curve: Curves.easeInOut,
    ),
    GetPage(
      name: _Paths.SETTING,
      page: () => const SettingView(),
      binding: SettingBinding(),
      transition: Transition.native,
      curve: Curves.easeInOut,
    ),
    GetPage(
      name: _Paths.PRECODE,
      page: () => const PrecodeView(),
      binding: PrecodeBinding(),
      transition: Transition.native,
      curve: Curves.easeInOut,
      children: [
        GetPage(
          name: _Paths.PRECODE_SENDEMAIL,
          page: () => const PrecodeSendemailView(),
          binding: PrecodeSendemailBinding(),
          transition: Transition.native,
          curve: Curves.easeInOut,
        ),
      ],
    ),
    GetPage(
      name: _Paths.DEVICEAUTH,
      page: () => const DeviceauthView(),
      binding: DeviceauthBinding(),
      transition: Transition.native,
      curve: Curves.easeInOut,
    ),
    GetPage(
      name: _Paths.ROUTINGMODE,
      page: () => const RoutingmodeView(),
      binding: RoutingmodeBinding(),
      transition: Transition.native,
      curve: Curves.easeInOut,
    ),
    GetPage(
      name: _Paths.LANGUAGE,
      page: () => const LanguageView(),
      binding: LanguageBinding(),
      transition: Transition.native,
      curve: Curves.easeInOut,
    ),
    GetPage(
      name: _Paths.FEEDBACK,
      page: () => const FeedbackView(),
      binding: FeedbackBinding(),
      transition: Transition.native,
      curve: Curves.easeInOut,
    ),
    GetPage(
      name: _Paths.SPLITTUNNELING,
      page: () => const SplittunnelingView(),
      binding: SplittunnelingBinding(),
      transition: Transition.native,
      curve: Curves.easeInOut,
      children: [
        GetPage(
          name: _Paths.SPLITTUNNELING_SELECTAPP,
          page: () => SplittunnelingSelectappView(),
          binding: SplittunnelingSelectappBinding(),
          transition: Transition.native,
          curve: Curves.easeInOut,
        ),
      ],
    ),
    GetPage(
      name: _Paths.SIGNUP,
      page: () => const SignupView(),
      binding: SignupBinding(),
      transition: Transition.native,
      curve: Curves.easeInOut,
    ),
    GetPage(
      name: _Paths.FORGOTPWD,
      page: () => const ForgotpwdView(),
      binding: ForgotpwdBinding(),
      transition: Transition.native,
      curve: Curves.easeInOut,
    ),
    GetPage(
      name: _Paths.LOGIN,
      page: () => const LoginView(),
      binding: LoginBinding(),
      transition: Transition.native,
      curve: Curves.easeInOut,
    ),
    GetPage(
      name: _Paths.SUBSCRIPTION,
      page: () => const SubscriptionView(),
      binding: SubscriptionBinding(),
      transition: Transition.downToUp,
      curve: Curves.easeInOut,
    ),
    GetPage(
      name: _Paths.MEDIALOCATION,
      page: () => const MedialocationView(),
      binding: MedialocationBinding(),
      transition: Transition.downToUp,
      curve: Curves.easeInOut,
    ),
    GetPage(
      name: _Paths.THEME,
      page: () => const ThemeView(),
      binding: ThemeBinding(),
      transition: Transition.native,
      curve: Curves.easeInOut,
    ),
  ];

  /// 私有构造函数，防止被实例化
  AppPages._();
}
