import type { CreateImageSuiteRequest, ImageSuite, ImageSuitePlanInput } from '@atlas/contracts'; import { api } from './api'; const path = (productId: string) => `/products/${productId}/ai/image-suites`; const headers = (key: string) => ({ headers: { 'Idempotency-Key': key } }); export const imageSuitesApi = { plan: (productId: string, input: ImageSuitePlanInput, key: string) => api.post(`/products/${productId}/ai/suite-plans`, input, headers(key)), generate: (productId: string, input: CreateImageSuiteRequest, key: string) => api.post(path(productId), input, headers(key)), read: (productId: string, id: string) => api.get(`${path(productId)}/${id}`), list: (productId: string, cursor?: string) => api.getList( `${path(productId)}?limit=100${cursor ? `&cursor=${encodeURIComponent(cursor)}` : ''}` ), cancel: (productId: string, id: string) => api.post(`${path(productId)}/${id}/cancel`, {}, headers(crypto.randomUUID())), retry: (productId: string, id: string, key: string) => api.post(`${path(productId)}/${id}/retry`, {}, headers(key)), };