*Note: This user story heavily overlaps with Order Service, but this is how its requirements are built into the Readable Bot Network Representation. Can adjust as needed.
As the Order API,
I want to use the Cosmos DB bot read model to select candidate bots for new orders,
so that orders can be routed to bots that appear available and stocked.
Acceptance Criteria
*Note: This user story heavily overlaps with Order Service, but this is how its requirements are built into the Readable Bot Network Representation. Can adjust as needed.
As the Order API,
I want to use the Cosmos DB bot read model to select candidate bots for new orders,
so that orders can be routed to bots that appear available and stocked.
Acceptance Criteria
Given a customer submits an order
When the Order API evaluates candidate bots
Then it reads bot availability, location, and inventory from the Cosmos DB Bots container.
Given multiple bots can fulfill the order
When the Order API selects a target bot
Then it chooses a bot based on defined selection rules such as availability, stock, distance, or priority.
Given the Order API selects a target bot
When it creates the order assignment
Then it publishes the assignment to the robot-input Event Hub.
Given the readable bot state may be slightly behind the simulator
When the simulator receives the order assignment
Then the simulator performs final stock and availability validation before accepting the order.
Given the simulator accepts, queues, or rejects the order
When the response event is published
Then downstream processing updates the readable bot representation as needed.