{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/prosp-cc/json-schema/prosp-cc-job-accepted-schema.json",
  "title": "JobAccepted",
  "description": "Returned when a discovery has been accepted for processing (see `status` for where it stands at the moment of the response).",
  "x-generated": "2026-11-22",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/prosp-cc-openapi.yaml#/components/schemas/JobAccepted",
  "type": "object",
  "required": [
    "jobId",
    "status"
  ],
  "properties": {
    "jobId": {
      "type": "string",
      "description": "Id of the newly queued discovery. Use it to poll status and read results."
    },
    "status": {
      "type": "string",
      "description": "The job's live lifecycle state at the moment the start response is built. A job admitted straight into a free slot can already be `running` or `processing` by then (the pipeline advances the state within milliseconds of admission), and a job held by the global concurrency gate reports `queued` together with `queue_position`. Poll `GET /api/v1/discoveries/{jobId}` for every later state. Values are the same `JobState` vocabulary the status read uses; none of them is terminal on the start response.",
      "enum": [
        "queued",
        "running",
        "processing"
      ]
    },
    "queue_position": {
      "type": "integer",
      "minimum": 1,
      "description": "Present only when the job was HELD by the global admission gate (every concurrency slot busy); 1 is the next to start. Absent when the job was admitted immediately."
    },
    "createdAt": {
      "type": "string",
      "format": "date-time",
      "description": "When the discovery was queued (ISO-8601)."
    },
    "poll_after_seconds": {
      "type": "integer",
      "minimum": 1,
      "description": "Recommended number of seconds to wait before polling this discovery's status again. A cadence hint for polite back-off — poll no more often than this rather than hammering the API."
    },
    "estimated_duration_seconds": {
      "type": "integer",
      "minimum": 1,
      "description": "Expected wall-clock duration for this discovery, in seconds — the single planning-safe number, always present. Equals the p95 of recent OBSERVED job runtimes (the industry-standard user-facing UPPER BOUND so a slow-but-healthy run is not mistaken for a stuck one, and a client planning timeouts is not misled low): it is identical to `estimated_duration_p95_seconds` once history exists, and falls back to a static coarse default until enough jobs have finished. For the full percentile trio read `estimated_duration_p50_seconds` / `estimated_duration_p90_seconds` / `estimated_duration_p95_seconds`. An estimate, not a guarantee."
    },
    "estimated_duration_p50_seconds": {
      "type": "integer",
      "minimum": 1,
      "description": "Median (p50) of recent OBSERVED job runtimes, in seconds — the TYPICAL duration. The lowest member of the explicit p50/p90/p95 trio; `estimated_duration_p95_seconds` is the planning-safe upper bound. Omitted (together with the p90 and p95 fields) until enough jobs have finished to derive it."
    },
    "estimated_duration_p90_seconds": {
      "type": "integer",
      "minimum": 1,
      "description": "90th-percentile (p90) of recent OBSERVED job runtimes, in seconds — a monitoring-baseline percentile and the middle member of the explicit p50/p90/p95 trio. Omitted (together with the p50 and p95 fields) until enough jobs have finished to derive it."
    },
    "estimated_duration_p95_seconds": {
      "type": "integer",
      "minimum": 1,
      "description": "95th-percentile (p95) of recent OBSERVED job runtimes, in seconds — the planning-safe user-facing UPPER BOUND, and the top member of the explicit p50/p90/p95 trio. This is the same value carried by `estimated_duration_seconds` whenever history exists (that field is the always-present single number; this one is the labelled member of the trio). Omitted (together with the p50 and p90 fields) until enough jobs have finished to derive it."
    },
    "estimated_yield": {
      "type": "integer",
      "minimum": 0,
      "description": "Expectation-setting hint: the TOTAL number of prospects this discovery is likely to DELIVER — i.e. total deliverable, NOT net-new. It is projected from YOUR own historical delivery ratio (prospects delivered ÷ target requested, accumulated across your completed discoveries) applied to this run's requested target, and it is never projected above the request. \"Total deliverable\" means the count is GROSS: it includes domains you may already own from a prior discovery (see `already_owned_count` on the status/result for how many of the delivered set were already yours); it is not a promise of that many BRAND-NEW companies. The projection is deliberately CONSERVATIVE (it tracks your historical delivery ratio and empirically under-predicts a fast-converging run), so on the status poll it is floored at the live `prospectsFound` — the value shown is `max(frozen_estimate, prospectsFound)` and therefore never sits BELOW the count already delivered in the same response. Omitted entirely (never null) until you have enough completed-discovery history to project honestly. An estimate, not a guarantee."
    }
  }
}