import api from './api'; import type { FeedbackAction, HistoryEntry } from '../types'; export const historyService = { // POST /api/history { trackId, completed?, batchId? } -> { historyId } async recordPlay( trackId: string, completed?: boolean, batchId?: string ): Promise<{ historyId: string }> { const res = await api.post<{ historyId: string }>('/history', { trackId, completed, batchId, }); return res.data; }, // POST /api/history/skip { trackId } -> { status } async skip(trackId: string): Promise<{ status: string }> { const res = await api.post<{ status: string }>('/history/skip', { trackId }); return res.data; }, // GET /api/history -> recent play history (Track + playback metadata) async list(): Promise { const res = await api.get('/history'); return res.data; }, // POST /api/feedback { trackId, action } -> { status } async feedback(trackId: string, action: FeedbackAction): Promise<{ status: string }> { const res = await api.post<{ status: string }>('/feedback', { trackId, action }); return res.data; }, };