import 'package:food_health/layout/layout_page.dart';
import 'package:food_health/page/system/login/login_code_page.dart';
import 'package:food_health/page/system/splash/splash_page.dart';
import 'package:food_health/router/config/route_paths.dart';

import '../../page/system/agree/agree_page.dart';
import '../../page/system/login/login_page.dart';
import '../config/route_type.dart';

List<RouteType> baseRoutes = [
  RouteType(
    path: RoutePaths.splash,
    child: (state) {
      return SplashPage();
    },
  ),
  RouteType(
    path: RoutePaths.agreement,
    child: (state) {
      final extra = state.extra as Map<String, String>;
      return AgreePage(
        title: extra['title'] ?? "",
        url: extra['url'] ?? "",
      );
    },
  ),
  RouteType(
    path: RoutePaths.login,
    child: (state) {
      return LoginPage();
    },
  ),
  RouteType(
    path: RoutePaths.loginCode,
    child: (state) {
      final args = state.extra as Map;
      return LoginCodePage(
        email: args['email'],
        password: args['password'],
      );
    },
  ),
  RouteType(
    path: RoutePaths.layout,
    child: (state) {
      return LayoutPage();
    },
  ),
];
