import 'package:chat/middleware/auth_middleware.dart';
import 'package:chat/views/contact/index/index_page.dart';
import 'package:chat/views/user/info/index_page.dart';
import 'package:chat/views/user/info/nickname_page.dart';
import 'package:chat/views/user/qr_code/index_page.dart';
import 'package:chat/views/user/safe/index_page.dart';
import 'package:chat/views/user/setting/index_page.dart';
import 'package:chat/views/user/share/index_page.dart';
import 'package:get/get.dart';

abstract class UserRoutes {
  /// 身份验证页面
  static const String index = '/user';
  static const String qrCode = '/user/qrCode';
  static const String setting = '/user/setting';
  static const String share = '/user/share';
  static const String safe = '/user/safe';
  static const String info = '/user/info';
  static const String infoNickname = '/user/info/nickname';

  static GetPage router = GetPage(
    name: UserRoutes.index,
    middlewares: [
      EnsureAuthMiddleware(),
    ],
    page: () => const ContactPage(),
    children: [
      GetPage(
        name: '/share',
        page: () => const UserSharePage(),
      ),
      GetPage(
        name: '/qrCode',
        page: () => const UserQrCodePage(),
      ),
      GetPage(
        name: '/setting',
        page: () => const UserSettingPage(),
      ),
      GetPage(
        name: '/safe',
        page: () => const UserSafePage(),
      ),
      GetPage(
        name: '/info',
        page: () => const UserInfoPage(),
        children: [
          GetPage(
            name: '/nickname',
            page: () => const UserInfoNicknamePage(),
          ),
        ],
      ),
    ],
  );
}
