"""
Find nearby points of interest.
Find points of interest near the given location using map services.
"""
name = "navigation/nearby-poi"
version = "1.0.0"

"""
Find nearby points of interest
Find points of interest near the given location.
"""
usecase NearbyPoi {
	input {
		"""
		center
		Center of the search
		"""
		center! Coordinates!
		
		"""
		radius
		Radius of the search
		"""
		radius! number!
		
		"""
		categories
		Optional categories filter
		Points belonging to at least one of these categories are returned
		"""
		categories [InterestCategory!]
	}

	result [
		{
			"Coordinates of this point"
			coordinates! Coordinates!
			"Name of the point of interest"
			name! string!
			"Categories this point belongs to"
			categories! [InterestCategory!]
		}
	]

	error {
		"Human-readable status description"
		status! string!
		"Human-readable error message"
		message! string!
	}

  example success {
    input {
      center = {
        latitude = 51.477,
        longitude = 0.0,
      },
      radius = 100,
      categories = ['CAFE'],
    }
  

  result [{
      categories = [
        'CAFE',
      ],
      coordinates = {
        latitude = 51.476838,
        longitude = -0.0006877,
      },
      name = "2738840351",
    }
  ]
}

  example failed {
    input {
      center = {
        latitude = 589.477,
        longitude = 998.0,
      },
      radius = 10
    }

    error {
      status = 400,
      message = "Invalid parameters"
    }
  }
}

model Coordinates {
	latitude! number!
	longitude! number!
}

model InterestCategory enum {
	RESTAURANT,
	CAFE,
	BAR,
  SCHOOL,
  TAXI,
  POST,
  POLICE,
  HEALTHCARE,
  BANK,
  ATM,
  PARKING
}