import 'package:flutter_riverpod/flutter_riverpod.dart';

import '../data/admin_service.dart';
import '../models/admin_driver.dart';
import '../models/admin_incident.dart';
import '../models/admin_route.dart';
import '../models/admin_unit.dart';
import '../models/admin_user.dart';

final adminUsersProvider = FutureProvider<List<AdminUserModel>>((ref) {
  return ref.read(adminServiceProvider).listUsers();
});

final adminRoutesProvider = FutureProvider<List<AdminRouteModel>>((ref) {
  return ref.read(adminServiceProvider).listRoutes();
});

final adminUnitsProvider = FutureProvider<List<AdminUnitModel>>((ref) {
  return ref.read(adminServiceProvider).listUnits();
});

final adminDriversProvider = FutureProvider<List<AdminDriverModel>>((ref) {
  return ref.read(adminServiceProvider).listDrivers();
});

final adminIncidentsByUnitProvider =
    FutureProvider.family<List<AdminIncidentModel>, int>((ref, unitId) {
  return ref.read(adminServiceProvider).listIncidentsByUnit(unitId);
});
