import axios from 'axios'

interface SequenceCreatedInterface {
  data: {
    created: string
    description: string
    extent: { spatial: object; temporal: object }
    ['geovisio:status']: string
    id: string
    keywords: string[]
    license: string
    links: object[]
    providers: object[]
    stac_extensions: string[]
    stac_version: string
    ['stats:items']: { count: number }
    title: string
    type: string
  }
}

function createASequence(title: string): Promise<SequenceCreatedInterface> {
  return axios.post('api/collections', { title: title })
}

async function createAPictureToASequence(id: string, body: any): Promise<any> {
  return await axios.post(`api/collections/${id}/items`, body)
}

export { createASequence, createAPictureToASequence }
