import { apiFetch } from "./http";
import type { RealtimeAttendanceResponse } from "./types";

export function getTodayAttendance(date: string): Promise<RealtimeAttendanceResponse> {
  return apiFetch<RealtimeAttendanceResponse>(`/api/attendance/realtime/today?date=${encodeURIComponent(date)}`);
}

export function syncRealtimeAttendance(date: string): Promise<RealtimeAttendanceResponse> {
  return apiFetch<RealtimeAttendanceResponse>("/api/attendance/realtime/sync", {
    method: "POST",
    body: JSON.stringify({
      attendance_date: date,
      include_salary_preview: true,
    }),
  });
}
