import 'package:auto_route/auto_route.dart';
import 'package:flutter/material.dart';
import 'package:router/ext/auto_router_extensions.dart';
import 'package:router/path/router_path.dart';

import '../../modules/community/community_page.dart';
import '../../modules/community/news/news_page.dart';
import '../../modules/community/following/following_page.dart';
import '../../modules/community/foryou/foryou_page.dart';
import '../../modules/community/newsfeed_detail/newsfeed_detail_page.dart';
import '../../modules/community/newsfeed_post/newsfeed_post_page.dart';
// import '../../modules/community/newsfeed_myposts/newsfeed_myposts_page.dart';

import '../../modules/garage/for_sale/for_sale_page.dart';
import '../../modules/garage/for_rent/for_rent_page.dart';
import '../../modules/garage/garagesale_detail/garagesale_detail_page.dart';
import '../../modules/garage/garagesale_post/garagesale_post_page.dart';
// import '../../modules/garage/garagesale_myposts/garagesale_myposts_page.dart';

import '../../modules/my_posts/my_posts_page.dart';
import '../../modules/my_posts/my_posts_newsfeed/my_posts_newsfeed_page.dart';
import '../../modules/my_posts/my_posts_forrent/my_posts_forrent_page.dart';
import '../../modules/my_posts/my_posts_forsale/my_posts_forsale_page.dart';

import '../../modules/my_following/my_following_page.dart';
import '../../modules/my_following/my_follow/my_follow_page.dart';
import '../../modules/my_following/my_follower/my_follower_page.dart';




part 'community_page_router.gr.dart';

/*\
 * Community组件的路由
 */
@AutoRouterConfig(replaceInRouteName: 'Page|Screen,PageRoute')
class CommunityPageRouter extends _$CommunityPageRouter {
  @override
  List<AutoRoute> get routes => [

    CustomRoute(
        page: CommunityPageRoute.page,
        path: RouterPath.community,
        transitionsBuilder: applySlideTransition,
        children: [
           // newsfeed-news page
            CustomRoute(
                page: NewsPageRoute.page,
                path: RouterPath.newsfeedNews,
                transitionsBuilder: applySlideTransition,
            ),
            // newsfeed-following page
            CustomRoute(
                page: FollowingPageRoute.page,
                path: RouterPath.newsfeedFollowing,
                transitionsBuilder: applySlideTransition,
            ),
            // newsfeed-foryou page
            CustomRoute(
                page: ForyouPageRoute.page,
                path: RouterPath.newsfeedForYou,
                transitionsBuilder: applySlideTransition,
            ),
            CustomRoute(
              page: ForsalePageRoute.page,
              path: RouterPath.garageForSale,
              transitionsBuilder: applySlideTransition,
            ),
            // garageSale-forRent page
            CustomRoute(
              page: ForrentPageRoute.page,
              path: RouterPath.garageForRent,
              transitionsBuilder: applySlideTransition,
            )
        ],
    ),
    CustomRoute(
      page: NewsfeedPostPageRoute.page,
      path: RouterPath.newsFeedPost,
      transitionsBuilder: applySlideTransition,
    ),
    CustomRoute(
      page: NewsfeedDetailPageRoute.page,
      path: "${RouterPath.newsFeedDetail}:id/:type",
      transitionsBuilder: applySlideTransition,
    ),
    // Garage
    CustomRoute(
      page: GaragesalePostPageRoute.page,
      path: RouterPath.garageSalePost,
      transitionsBuilder: applySlideTransition,
    ),
    CustomRoute(
      page: GaragesaleDetailPageRoute.page,
      path: RouterPath.garageSaleDetail,
      transitionsBuilder: applySlideTransition,
    ),
    CustomRoute(
      page: MyPostsPageRoute.page,
      path: RouterPath.myPosts,
      transitionsBuilder: applySlideTransition,
      children: [
        // newsfeed
        CustomRoute(
          page: MyPostsNewsfeedPageRoute.page,
          path: RouterPath.garageForSale,
          transitionsBuilder: applySlideTransition,
        ),
        // for sale
        CustomRoute(
          page: MyPostsForSalePageRoute.page,
          path: RouterPath.myPostsForSale,
          transitionsBuilder: applySlideTransition,
        ),
        // for rent
        CustomRoute(
          page: MyPostsForRentPageRoute.page,
          path: RouterPath.myPostsForRent,
          transitionsBuilder: applySlideTransition,
        )
      ]
    ),
    CustomRoute(
        page: MyFollowingPageRoute.page,
        path: RouterPath.myFollowing,
        transitionsBuilder: applySlideTransition,
        children: [
          CustomRoute(
            page: MyFollowPageRoute.page,
            path: RouterPath.myFollowingFollow,
            transitionsBuilder: applySlideTransition,
          ),
          CustomRoute(
            page: MyFollowerPageRoute.page,
            path: RouterPath.myFollowingFollower,
            transitionsBuilder: applySlideTransition,
          ),
        ]
    ),
  ];
}
