{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/codai-ro/json-schema/codai-ro-resolve-job-schema.json",
  "title": "Job",
  "description": "Full job view returned by `GET /v1/resolve/jobs/{id}`. Nullable fields are `null` until the corresponding stage has run.",
  "x-generated": "2026-11-04",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/codai-ro-resolve-openapi.yml#/components/schemas/ResolveJob",
  "type": "object",
  "required": [
    "id",
    "status",
    "repo_url",
    "tier",
    "quote_micro_usd",
    "triage_reason",
    "decline_reason",
    "fail_reason",
    "cost_micro_usd",
    "attestation_id",
    "attestation_url",
    "created_at",
    "completed_at"
  ],
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid"
    },
    "status": {
      "$ref": "#/$defs/ResolveJobStatus"
    },
    "repo_url": {
      "type": "string",
      "format": "uri",
      "description": "Normalised repository URL (trailing slash removed)."
    },
    "tier": {
      "oneOf": [
        {
          "$ref": "#/$defs/ResolveTier"
        },
        {
          "type": "null"
        }
      ],
      "description": "Quote tier; `null` until triage completes."
    },
    "quote_micro_usd": {
      "type": [
        "integer",
        "null"
      ],
      "description": "Quoted price in USD micros; `null` until quoted, `0` on the free tier."
    },
    "paid_with": {
      "allOf": [
        {
          "$ref": "#/$defs/ResolvePaidWith"
        }
      ],
      "description": "Present once the job was accepted (and recorded how it was paid)."
    },
    "triage_reason": {
      "type": [
        "string",
        "null"
      ]
    },
    "decline_reason": {
      "type": [
        "string",
        "null"
      ],
      "description": "Set only when `status` is `declined`."
    },
    "fail_reason": {
      "type": [
        "string",
        "null"
      ],
      "description": "Set when `status` is `failed` or `error` (e.g. `dispatch failed: …`)."
    },
    "cost_micro_usd": {
      "type": "integer",
      "description": "Upstream inference spend attributed to this job, USD micros. Informational — you are billed the quote, not the cost."
    },
    "attestation_id": {
      "type": [
        "string",
        "null"
      ],
      "format": "uuid",
      "description": "Present once the job is `resolved`."
    },
    "attestation_url": {
      "type": [
        "string",
        "null"
      ],
      "description": "Relative path `/v1/resolve/attestations/{attestation_id}`; `null` until resolved."
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    },
    "completed_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "issue_url": {
      "type": [
        "string",
        "null"
      ],
      "format": "uri",
      "description": "The GitHub issue URL given at intake; `null` when the issue was sent as text."
    },
    "issue_title": {
      "type": [
        "string",
        "null"
      ],
      "description": "First line of the issue text (at most 120 characters); `null` when unknown."
    }
  },
  "$defs": {
    "ResolveJobStatus": {
      "type": "string",
      "title": "Job status",
      "description": "Lifecycle: `triage → quoted → accepted → running → resolved | failed`, plus `declined`\n(triage refused) and `error` (infrastructure failure — retryable, never billed).\n",
      "enum": [
        "triage",
        "quoted",
        "declined",
        "accepted",
        "running",
        "resolved",
        "failed",
        "error"
      ]
    },
    "ResolvePaidWith": {
      "type": "string",
      "title": "Payment method",
      "description": "How an accepted job is paid: `free` (free tier), `intro` (first paid job, €1 hold),\n`credit` (one t7 fix credit, no wallet hold) or `wallet` (hold of the list price).\nPrecedence: `free` > `intro` > `credit` > `wallet`.\n",
      "enum": [
        "intro",
        "credit",
        "wallet",
        "free"
      ]
    },
    "ResolveTier": {
      "type": "string",
      "title": "Quote tier",
      "description": "`free` (first 3 resolves per user), `t7` ($7), `t19` ($19), `t49` ($49). Prices are in USD micros on the wire.",
      "enum": [
        "free",
        "t7",
        "t19",
        "t49"
      ]
    }
  }
}