import 'package:flutter/cupertino.dart';
import 'package:get/get.dart';

import '../routes/app_routes.dart';
import '../services/auth_service.dart';

class ProviderMiddleware extends GetMiddleware {
  @override
  RouteSettings? redirect(String? route) {
    final authService = Get.find<AuthService>();
    if (!authService.user.value.isProvider) {
      return RouteSettings(name: Routes.E_PROVIDERS);
    }
    return null;
  }
}
