$candidate_agent_ids Agents offering this start. * @param array $busy_counts Agent id => booking count in range. * @param array $round_robin_state Mutable state bag for strategies. */ public function choose( array $candidate_agent_ids, array $busy_counts, array &$round_robin_state ): int { unset( $round_robin_state ); sort( $candidate_agent_ids ); $best = $candidate_agent_ids[0]; $best_busy = $busy_counts[ $best ] ?? 0; foreach ( $candidate_agent_ids as $id ) { $busy = $busy_counts[ $id ] ?? 0; if ( $busy < $best_busy ) { $best = $id; $best_busy = $busy; } } return $best; } }