import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
import 'package:wyatt_clean_code/presentation/features/counter/counter_page.dart';
import 'package:wyatt_clean_code/presentation/features/initial/initial_page.dart';

abstract class AppRouter {
  static Page<void> defaultTransition(
    BuildContext context,
    GoRouterState state,
    Widget child,
  ) =>
      MaterialPage<void>(
        key: state.pageKey,
        child: child,
      );

  static final List<GoRoute> routes = [
    GoRoute(
      path: '/',
      name: InitialPage.pageName,
      pageBuilder: (context, state) => defaultTransition(
        context,
        state,
        const InitialPage(),
      ),
    ),
    GoRoute(
      path: '/counter',
      name: CounterPage.pageName,
      pageBuilder: (context, state) => defaultTransition(
        context,
        state,
        const CounterPage(),
      ),
    ),
  ];
}
