import { apiClient } from './client'; import type { KpiData, IngresosEgresosData, Alerta } from '@horux/shared'; export async function getKpis(fechaInicio: string, fechaFin: string, conciliacion?: boolean, contribuyenteId?: string | null): Promise { const params = new URLSearchParams(); params.set('fechaInicio', fechaInicio); params.set('fechaFin', fechaFin); if (conciliacion) params.set('conciliacion', 'true'); if (contribuyenteId) params.set('contribuyenteId', contribuyenteId); const response = await apiClient.get(`/dashboard/kpis?${params}`); return response.data; } export async function getIngresosEgresos(año?: number, conciliacion?: boolean, contribuyenteId?: string | null): Promise { const params = new URLSearchParams(); if (año) params.set('año', año.toString()); if (conciliacion) params.set('conciliacion', 'true'); if (contribuyenteId) params.set('contribuyenteId', contribuyenteId); const response = await apiClient.get(`/dashboard/ingresos-egresos?${params}`); return response.data; } export async function getRegimenesDelPeriodo(fechaInicio: string, fechaFin: string, conciliacion?: boolean, contribuyenteId?: string | null): Promise<{ clave: string; descripcion: string }[]> { const params = new URLSearchParams(); params.set('fechaInicio', fechaInicio); params.set('fechaFin', fechaFin); if (conciliacion) params.set('conciliacion', 'true'); if (contribuyenteId) params.set('contribuyenteId', contribuyenteId); const response = await apiClient.get<{ clave: string; descripcion: string }[]>(`/dashboard/regimenes-periodo?${params}`); return response.data; } export async function getAlertas(limit = 5, contribuyenteId?: string | null): Promise { const params = new URLSearchParams({ limit: String(limit) }); if (contribuyenteId) params.set('contribuyenteId', contribuyenteId); const response = await apiClient.get(`/dashboard/alertas?${params}`); return response.data; }