1import type * as geoRoutes from "@distilled.cloud/aws/geo-routes";
2import type * as Effect from "effect/Effect";
3import * as Binding from "../../Binding.ts";
4
5/**
6 * Runtime binding for `geo-routes:OptimizeWaypoints` — calculate the optimal
7 * order to visit a set of waypoints, minimizing travel time or distance
8 * (the traveling-salesman step of delivery/route planning).
9 *
10 * geo-routes is a standalone, pay-per-call Amazon Location API with no
11 * resource to manage: the binding takes no arguments and grants the function
12 * `geo-routes:OptimizeWaypoints`. Requests and responses are raw distilled
13 * types (positions are `[longitude, latitude]` pairs).
14 *
15 * ### Optimizing Waypoints
16 * Provide the `OptimizeWaypointsHttp` implementation layer on the Function
17 * effect (`.pipe(Effect.provide(AWS.GeoRoutes.OptimizeWaypointsHttp))`), bind
18 * in the init phase, then call the client at runtime.
19 *
20 * **Example:** Optimize the visiting order of two stops
21 * ```typescript
22 * // init
23 * const optimizeWaypoints = yield* AWS.GeoRoutes.OptimizeWaypoints();
24 *
25 * // runtime — positions are [longitude, latitude]
26 * const result = yield* optimizeWaypoints({
27 * Origin: [-122.339, 47.61],
28 * Destination: [-122.201, 47.61],
29 * Waypoints: [
30 * { Id: "stop-1", Position: [-122.335, 47.608] },
31 * { Id: "stop-2", Position: [-122.313, 47.62] },
32 * ],
33 * });
34 * const order = result.OptimizedWaypoints.map((w) => w.Id);
35 * ```
36 *
37 * @binding
38 */
39export interface OptimizeWaypoints extends Binding.Service<
40 OptimizeWaypoints,
41 "AWS.GeoRoutes.OptimizeWaypoints",
42 () => Effect.Effect<
43 (
44 request: geoRoutes.OptimizeWaypointsRequest,
45 ) => Effect.Effect<
46 geoRoutes.OptimizeWaypointsResponse,
47 geoRoutes.OptimizeWaypointsError
48 >
49 >
50> {}
51export const OptimizeWaypoints = Binding.Service<OptimizeWaypoints>(
52 "AWS.GeoRoutes.OptimizeWaypoints",
53);