'use client';

import {staffRepository} from '@/features/staff/repositories/staffRepository';
import {useResource} from '@/shared/hooks/useResource';
import {useScope} from '@/shared/hooks/useScope';

/** Staff data access. See features/dashboard/hooks/useDashboard for the pattern. */

export function useStaffList() {
  return useResource(staffRepository.list(useScope()));
}

export function useStaffSummary() {
  return useResource(staffRepository.summary(useScope()), {
    // A summary of zero people is still a summary; emptiness is the total
    // being zero, not the object being absent.
    isEmpty: (s) => s.total === 0,
  });
}

export function useStaffAttendance() {
  return useResource(staffRepository.attendance(useScope()));
}
