import client from "./client"; import type { CoverageSummary, TacticCoverage } from "../types/models"; // ── V1 — Coverage ─────────────────────────────────────────────────── /** Fetch the global coverage summary. */ export async function getCoverageSummary(): Promise { const { data } = await client.get("/metrics/summary"); return data; } /** Fetch coverage breakdown by tactic. */ export async function getCoverageByTactic(): Promise { const { data } = await client.get("/metrics/by-tactic"); return data; } // ── V2 — Test Pipeline ────────────────────────────────────────────── export interface TestPipelineCounts { draft: number; red_executing: number; blue_evaluating: number; in_review: number; validated: number; rejected: number; total: number; } /** Fetch test counts per pipeline state. */ export async function getTestPipeline(): Promise { const { data } = await client.get("/metrics/test-pipeline"); return data; } // ── V2 — Team Activity ────────────────────────────────────────────── export interface TeamActivityItem { team: string; tests_completed: number; tests_pending: number; avg_completion_hours: number | null; } /** Fetch activity summary for Red and Blue teams. */ export async function getTeamActivity(): Promise { const { data } = await client.get("/metrics/team-activity"); return data; } // ── V2 — Validation Rate ──────────────────────────────────────────── export interface ValidationRateItem { role: string; total_reviewed: number; approved: number; rejected: number; approval_rate: number; } /** Fetch approval/rejection rates for managers. */ export async function getValidationRate(): Promise { const { data } = await client.get("/metrics/validation-rate"); return data; } // ── V2 — Recent Tests ─────────────────────────────────────────────── export interface RecentTestItem { id: string; name: string; state: string; technique_mitre_id: string | null; technique_name: string | null; created_at: string | null; } /** Fetch the 10 most recently updated tests. */ export async function getRecentTests(): Promise { const { data } = await client.get("/metrics/recent-tests"); return data; }