import 'package:fluro/fluro.dart';
import 'package:liftmanager/internal/project/page/project_detail_page.dart';
import 'package:liftmanager/internal/project/page/project_list_page.dart';
import 'package:liftmanager/internal/project/page/project_user_page.dart';
import 'package:liftmanager/routers/router_init.dart';


class ProjectRouter implements IRouterProvider{

  static String projectPage = "/project/list";
  static String projectDetailPage = "/project/detail";
  static String projectUsersPage = "/project/users";

  @override
  void initRouter(FluroRouter router) {
    router.define(projectPage, handler: Handler(handlerFunc: (_, params) => ProjectListPage()));
    router.define(projectDetailPage, handler: Handler(handlerFunc: (_, params){
      String id = params["id"].first;
      return ProjectDetailPage(id);
    }));
    router.define(projectUsersPage, handler: Handler(handlerFunc: (_, params){
      String id = params["id"].first;
      String type = params["type"].first;
      return ProjectUsersPage(id,type=="1"?SelectType.SINGLE:type=="2"?SelectType.MANY:SelectType.NONE);
    }));
  }
}