import apiClient from './client'

export interface DashboardStats {
  allocations: number
  completionRate: number
  personnel: number
  pendingApprovals: number
}

export interface RegimentAllocationStats {
  regimentId: number
  regimentName: string
  totalQuota: number
  totalConsumed: number
  percentage: number
}

export const statsApi = {
  async getDashboardStats(): Promise<DashboardStats> {
    const response = await apiClient.get<DashboardStats>('/stats/dashboard')
    return response.data
  },

  async getRegimentAllocationsStats(): Promise<RegimentAllocationStats[]> {
    const response = await apiClient.get<RegimentAllocationStats[]>('/stats/regiment-allocations')
    return response.data
  }
}
