import { LatLng } from 'leaflet'

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

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

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

export { composeTrashboxURL, processTrashbox }
