import {CrumbResponseSchema} from '@crumbs/core/schemas'

import {blobEndpoint} from '@/lib/blob-endpoint'

const crumbImage = blobEndpoint({
  path: (id) => `/crumbs/${id}/image`,
  schema: CrumbResponseSchema,
  unwrap: ({crumb}) => crumb,
  maxEdge: 1280,
})

export const pickCrumbImage = crumbImage.pick
export const uploadCrumbImage = crumbImage.upload
export const removeCrumbImage = crumbImage.remove
