import api from '../../services/api';

export type PrefetchStatus = {
  lastUpdated?: string;
  intervalMinutes: number;
  fastMode: boolean;
  nextApproximate: string;
};

export async function getPrefetchStatus(): Promise<PrefetchStatus> {
  const { data } = await api.get('/admin/prefetch/status');
  return data as PrefetchStatus;
}

export async function triggerPrefetch(): Promise<{ message: string }>{
  const { data } = await api.post('/admin/prefetch/trigger');
  return data as { message: string };
}
