import { http } from 'msw'
import { jsonResponse, noContent } from '../helpers'

// Default `/api/loader/*` handlers. The loader service brokers media uploads;
// AC-10 (≤ 500 MB cap) is asserted in tests by overriding the POST handler
// with a 413 stub.

export const loaderHandlers = [
  http.post('/api/loader/upload', () => jsonResponse({ id: 'media-uploaded-1', status: 1 }, { status: 201 })),

  http.get('/api/loader/jobs/:id', ({ params }) =>
    jsonResponse({ id: params.id, status: 'completed', progress: 1.0 }),
  ),

  http.delete('/api/loader/jobs/:id', () => noContent()),
]
