///|
/// Timing and resource bounds for one session, in milliseconds.
pub(all) struct Limits {
  max_parallel : Int32
  startup_timeout_ms : Int32
  shutdown_grace_ms : Int32
  scenario_timeout_ms : Int32
}

///|
/// Readiness is either process liveness, TCP connectivity, or a local HTTP status.
pub(all) enum Probe {
  Alive
  Tcp(String, Int32, Int32)
  Http(String, Int32, String, Int32, Int32)
}

///|
/// An executable and argument vector with its dependency and readiness contract.
pub(all) struct Service {
  name : String
  program : String
  args : Array[String]
  cwd : String?
  depends_on : Array[String]
  ready : Probe
}

///|
pub(all) struct Config {
  limits : Limits
  services : Array[Service]
}

///|
/// A configuration diagnostic with a JSON field path.
pub suberror ConfigError {
  InvalidConfig(String, String)
}

///|
pub impl Show for ConfigError with fn output(self, logger) {
  let InvalidConfig(path, reason) = self
  logger.write_string("\{path}: \{reason}")
}