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

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

const trailCover = blobEndpoint({
  path: (id) => `/trails/${id}/cover`,
  schema: TrailResponseSchema,
  unwrap: ({trail}) => trail,
  maxEdge: 1280,
})

export const pickTrailCover = trailCover.pick
export const uploadTrailCover = trailCover.upload
export const removeTrailCover = trailCover.remove
