import { http } from './http' export interface PksSeries { device_code: string start: string end: string count: number times: string[] oil: (number | null)[] coupling: (number | null)[] chain: (number | null)[] } export async function fetchPksSeries( deviceCode: string, start: string, end: string, onProgress?: (percent: number) => void, ): Promise { const res = await http.get('/api/pks-series', { params: { device_code: deviceCode, start, end }, onDownloadProgress: (event) => { if (onProgress && event.total) { onProgress(Math.round((event.loaded / event.total) * 100)) } }, }) onProgress?.(100) return res.data } export async function fetchRecentSeries(deviceCode: string, hours = 6): Promise { const res = await http.get('/api/recent-series', { params: { device_code: deviceCode, hours }, }) return res.data }