import 'package:prosapp_web_app/router/admin_handlers.dart';
import 'package:prosapp_web_app/router/dashboard_handlers.dart';
import 'package:prosapp_web_app/router/no_page_found_handlers.dart';
import 'package:fluro/fluro.dart';

class Flurorouter {
  static final FluroRouter router = FluroRouter();

  static String rootRoute = "/";

  // Auth Router
  static String phoneLoginRoute = "/auth/phone_login";
  static String loginRoute = "/auth/login";
  static String registerRoute = "/auth/register";

  // Dashboard
  static String dashboardRoute = "/dashboard";
  static String supportRoute = "/dashboard/support";

  // Onboarding
  static String setupNameRoute = "/dashboard/setup-name";
  static String setupCityRoute = "/dashboard/setup-city";

  // Users
  static String profileRoute = "/dashboard/profile";
  static String phoneRoute = "/dashboard/phone";
  static String emailRoute = "/dashboard/email";
  static String userServicesRoute = "/dashboard/user/services";
  static String userServicesHistoryRoute = "/dashboard/user/services/history";
  static String userServiceRoute = "/dashboard/user/service/:uid";
  static String calendarRoute = "/dashboard/calendar/:uid";
  static String requestProfessionalRoute = "/dashboard/request/professional";

  static String userRatingRoute         = "/dashboard/user/service/:serviceId/rating/:professionalId";
  static String professionalRatingRoute = "/dashboard/professional/service/:serviceId/rating/:userId";
  static String userChatRoute           = "/dashboard/user/service/:serviceId/chat/:professionalId";
  static String professionalChatRoute   = "/dashboard/professional/service/:serviceId/chat/:userId";

  // Professionals
  static String professionalProfileRoute = "/dashboard/professional/profile";
  static String professionalScheduleRoute = "/dashboard/professional/schedule";
  static String professionalServicesRoute = "/dashboard/professional/services";
  static String professionalServicesRequestsRoute =
      "/dashboard/professional/requests";
  static String professionalServicesHistoryRoute =
      "/dashboard/professional/services/history";
  static String professionalServiceRoute =
      "/dashboard/professional/service/:uid";
  static String professionalsRoute = "/dashboard/professionals";
  static String professionalCalendarRoute = "/dashboard/professional/calendar";

  static void configureRoutes() {
    // Auth Routes
    router.define(
      rootRoute,
      handler: AdminHandlers.phone,
      transitionType: TransitionType.none,
    );
    router.define(
      phoneLoginRoute,
      handler: AdminHandlers.phone,
      transitionType: TransitionType.none,
    );
    router.define(
      loginRoute,
      handler: AdminHandlers.login,
      transitionType: TransitionType.none,
    );
    router.define(
      registerRoute,
      handler: AdminHandlers.register,
      transitionType: TransitionType.none,
    );

    // Onboarding
    router.define(
      setupNameRoute,
      handler: DashboardHandlers.setupName,
      transitionType: TransitionType.none,
    );
    router.define(
      setupCityRoute,
      handler: DashboardHandlers.setupCity,
      transitionType: TransitionType.none,
    );

    // Dashboard Routes
    router.define(
      dashboardRoute,
      handler: DashboardHandlers.dashboard,
      transitionType: TransitionType.none,
    );
    router.define(
      supportRoute,
      handler: DashboardHandlers.support,
      transitionType: TransitionType.none,
    );

    // users
    router.define(
      profileRoute,
      handler: DashboardHandlers.profile,
      transitionType: TransitionType.none,
    );
    router.define(
      phoneRoute,
      handler: DashboardHandlers.phone,
      transitionType: TransitionType.none,
    );
    router.define(
      emailRoute,
      handler: DashboardHandlers.email,
      transitionType: TransitionType.none,
    );
    router.define(
      professionalsRoute,
      handler: DashboardHandlers.professionals,
      transitionType: TransitionType.none,
    );
    router.define(
      userServicesRoute,
      handler: DashboardHandlers.userServices,
      transitionType: TransitionType.none,
    );
    router.define(
      userServicesHistoryRoute,
      handler: DashboardHandlers.userServicesHistory,
      transitionType: TransitionType.none,
    );

    router.define(
      userServiceRoute,
      handler: DashboardHandlers.userService,
      transitionType: TransitionType.none,
    );
    router.define(
      professionalServiceRoute,
      handler: DashboardHandlers.professionalService,
      transitionType: TransitionType.none,
    );

    router.define(
      userRatingRoute,
      handler: DashboardHandlers.userRating,
      transitionType: TransitionType.none,
    );
    router.define(
      professionalRatingRoute,
      handler: DashboardHandlers.professionalRating,
      transitionType: TransitionType.none,
    );

    router.define(
      userChatRoute,
      handler: DashboardHandlers.userChat,
      transitionType: TransitionType.none,
    );
    router.define(
      professionalChatRoute,
      handler: DashboardHandlers.professionalChat,
      transitionType: TransitionType.none,
    );

    router.define(
      calendarRoute,
      handler: DashboardHandlers.calendar,
      transitionType: TransitionType.none,
    );

    router.define(
      requestProfessionalRoute,
      handler: DashboardHandlers.requestProfessional,
      transitionType: TransitionType.none,
    );

    // profesionals
    router.define(
      professionalProfileRoute,
      handler: DashboardHandlers.professionalProfile,
      transitionType: TransitionType.none,
    );
    router.define(
      professionalScheduleRoute,
      handler: DashboardHandlers.professionalSchedule,
      transitionType: TransitionType.none,
    );
    router.define(
      professionalServicesRoute,
      handler: DashboardHandlers.professionalServices,
      transitionType: TransitionType.none,
    );
    router.define(
      professionalServicesRequestsRoute,
      handler: DashboardHandlers.professionalServicesRequests,
      transitionType: TransitionType.none,
    );
    router.define(
      professionalServicesHistoryRoute,
      handler: DashboardHandlers.professionalServicesHistory,
      transitionType: TransitionType.none,
    );

    router.define(
      professionalCalendarRoute,
      handler: DashboardHandlers.professionalCalendar,
      transitionType: TransitionType.none,
    );

    // 404
    router.notFoundHandler = NoPageFoundHandlers.noPageFound;
  }
}
