import { fetchJson } from './httpClient.ts' export interface AbnormalTrack { id: number mmsi: string timeBucket: string abnormalType: string typeDescription: string abnormalDescription: string distanceNm: number avgSpeed: number maxSpeed: number pointCount: number sourceTable: string detectedAt: string details: Record trackGeoJson: { type: string; coordinates: number[][] } | null } export interface AbnormalStats { statDate: string abnormalType: string vesselCount: number trackCount: number totalPoints: number avgDeviation: number maxDeviation: number } export interface AbnormalSummary { type_count: number total_tracks: number vessel_count: number avg_distance: number max_speed_detected: number typeStatistics: { abnormal_type: string; count: number; vessel_count: number }[] dailyTrend: { date: string; count: number }[] } export const abnormalApi = { getRecent(hours = 24): Promise { return fetchJson(`/api/v1/abnormal-tracks/recent?hours=${hours}`) }, getStatisticsSummary(days = 7): Promise { return fetchJson(`/api/v1/abnormal-tracks/statistics/summary?days=${days}`) }, getTypes(): Promise> { return fetchJson('/api/v1/abnormal-tracks/types') }, }