# server(id) is Render's dashboard query name for a single service — the same
# Render-shaped `Service` the `services` list returns (backend/internal/api/graphql.go).
# GraphQL exposes the live URL as a flat `url` field (REST nests it under
# serviceDetails.url); `phase`/`replicas`/`revision` are bex-native extras.
# `plan` (w1/m8) is null for an untiered (bare-CR) App — the Settings tab's
# Instance Type row renders an honest "not set" state for that case, not a
# fake selection (backend/internal/apps/service.go's AppView.Plan doc comment).

query Server($id: String!) {
  server(id: $id) {
    id
    name
    type
    suspended
    dashboardUrl
    url
    createdAt
    phase
    replicas
    revision
    plan
    idleTTLSeconds
    # Build-from-git source (empty for an image-backed App); rootDir is
    # Render's Root Directory setting (w1/m18) — the Settings tab's
    # Build & Deploy section (w5/m13).
    repo
    branch
    rootDir
    # Auto-Deploy toggle (w2/m9) — whether a signed git push redeploys the App.
    autoDeploy
    # cron_job fields (null/empty for other service types)
    schedule
    command
    runs {
      name
      startedAt
      finishedAt
      status
    }
    # static_site fields (null/empty for other service types): the published
    # output directory and its edge rules (w1/m21).
    publishPath
    routes {
      type
      source
      destination
    }
    headers {
      path
      name
      value
    }
  }
}
