import { api } from "./client"; import type { CapacityWeek, Dashboard, ProjectAllocationRow, UtilizationRow } from "../types"; export const getDashboard = async () => (await api.get("/dashboard")).data; export const getUtilization = async (start: string, end: string) => (await api.get("/reports/utilization", { params: { start, end } })).data; export const getCapacity = async (start: string, end: string) => (await api.get("/reports/capacity", { params: { start, end } })).data; export const getAvailability = async (start: string, end: string) => (await api.get("/reports/availability", { params: { start, end } })).data; export const getOverallocated = async (start: string, end: string) => (await api.get("/reports/overallocated", { params: { start, end } })).data; export const getProjectAllocation = async (start: string, end: string) => (await api.get("/reports/project-allocation", { params: { start, end } })).data; export interface PeopleWeeklyAvailability { weeks: string[]; people: Array<{ person_id: number; name: string; role: string | null; team: string | null; avatar_color: string; weekly_capacity_hrs: number; weeks: Array<{ week_start: string; available_hours: number; allocated_hours: number; tentative_hours: number; utilization_pct: number; }>; }>; } export const getPeopleWeeklyAvailability = async (start: string, end: string) => ( await api.get("/reports/people-weekly-availability", { params: { start, end }, }) ).data; export interface PeopleDailyAvailability { days: string[]; people: Array<{ person_id: number; name: string; role: string | null; team: string | null; avatar_color: string; weekly_capacity_hrs: number; days: Array<{ date: string; available_hours: number; allocated_hours: number; tentative_hours: number; utilization_pct: number; }>; }>; } export const getPeopleDailyAvailability = async (start: string, end: string) => ( await api.get("/reports/people-daily-availability", { params: { start, end }, }) ).data;