import { isArrayOf, isObject, isString } from '../../utils/types'

type Trashbox = {
    Lat: number,
    Lng: number,
    Address: string,
    Categories: string[]
}

const isTrashbox = (obj: unknown): obj is Trashbox => isObject(obj, {
    'Lat': 'number',
    'Lng': 'number',
    'Address': 'string',
    'Categories': obj => isArrayOf<string>(obj, isString)
})

type TrashboxResponse = Trashbox[]

const isTrashboxResponse = (obj: unknown): obj is Trashbox[] => isArrayOf(obj, isTrashbox)

export type { Trashbox, TrashboxResponse }
export { isTrashbox, isTrashboxResponse }
