import apiClient from './client'; export interface DashboardStats { pendingCount: number; approvedThisWeek: number; avgTurnaroundHours: number; totalProposals: number; } export interface UpdateProposalRequest { refinedScope?: string; notes?: string; assignedAdminId?: string; } export interface AuditEntry { id: string; proposalId: string | null; userId: string; userName: string; action: string; details: Record; timestamp: string; ipAddress: string | null; } export const adminApi = { getDashboard: async (): Promise => { const res = await apiClient.get('/admin/dashboard'); return res.data; }, updateProposal: async (id: string, data: UpdateProposalRequest): Promise => { await apiClient.put(`/proposals/${id}`, data); }, approveProposal: async (id: string): Promise => { await apiClient.post(`/proposals/${id}/approve`); }, sendProposal: async (id: string): Promise => { await apiClient.post(`/proposals/${id}/send`); }, reviseProposal: async (id: string): Promise => { await apiClient.post(`/proposals/${id}/revise`); }, getHistory: async (id: string): Promise => { const res = await apiClient.get(`/proposals/${id}/history`); return res.data; }, getAudit: async (id: string): Promise => { const res = await apiClient.get(`/proposals/${id}/audit`); return res.data; }, generateSuggestions: async (id: string): Promise => { await apiClient.post(`/proposals/${id}/generate-suggestions`); }, getSimilar: async (id: string): Promise => { const res = await apiClient.get(`/proposals/${id}/similar`); return res.data; }, getPdf: async (id: string): Promise<{ downloadUrl: string; expiresAt: string } | null> => { try { const res = await apiClient.get(`/proposals/${id}/pdf`); return res.data; } catch { return null; } }, };