// Force a DIFFERENT mitra online (one other than the seeded one) so blast
// flows (TS-02, TS-06) have an acceptor available after the seeded mitra is
// forced offline. Picks any currently-offline mitra excluding MITRA_ID.
//
// Reads MITRA_ID (the seeded mitra to exclude, from seed_history_session.js)
// and BACKEND_INTERNAL_URL.
const excludeId = MITRA_ID
const url = BACKEND_INTERNAL_URL || 'http://localhost:3001'
const resp = http.post(`${url}/internal/_test/force-mitra-online`, {
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({ exclude_mitra_id: excludeId }),
})
if (resp.status !== 200) {
  throw new Error(`force-mitra-online failed (${resp.status}): ${resp.body}`)
}
const data = json(resp.body)
output.OTHER_MITRA_ID = data.mitra_id
