UNPKG

@geoapify/route-planner-sdk

Version:

TypeScript SDK for the Geoapify Route Planner API. Supports route optimization, delivery planning, and timeline visualization in browser and Node.js

34 lines (33 loc) 1 kB
export class ShipmentPlan { constructor(shipmentIndex, shipmentInputData, agentPlan) { this.shipmentIndex = shipmentIndex; this.shipmentInputData = shipmentInputData; this.agentPlan = agentPlan; if (!shipmentInputData) { throw new Error("shipmentInputData is undefined"); } } getAgentId() { return this.agentPlan ? this.agentPlan.getAgentId() : undefined; } getAgentIndex() { return this.agentPlan ? this.agentPlan.getAgentIndex() : undefined; } getShipmentId() { return this.shipmentInputData.id; } getShipmentIndex() { return this.shipmentIndex; } getRouteActions() { return this.agentPlan ? this.agentPlan.getActions().filter((action) => { return action.getShipmentIndex() === this.shipmentIndex; }) : []; } getAgentPlan() { return this.agentPlan; } getShipmentInputData() { return this.shipmentInputData; } }