import { LatLng } from 'leaflet'

import { API_URL } from '../../config'
import { Trashbox, TrashboxResponse } from './types'

const composeTrashboxURL = (position: LatLng) => (
    API_URL + '/trashbox?' + new URLSearchParams({
        lat: position.lat.toString(),
        lng: position.lng.toString()
    }).toString()
)

const processTrashbox = (data: TrashboxResponse): Trashbox[] =>
    data

export { composeTrashboxURL, processTrashbox }
