{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/aginera-ai/json-schema/aginera-ai-cad-status-schema.json",
  "title": "CadStatus",
  "x-generated": "2026-11-01",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/aginera-ai-openapi.json#/components/schemas/CadStatus",
  "type": "object",
  "properties": {
    "document_id": {
      "$ref": "#/$defs/DocumentId"
    },
    "filename": {
      "type": "string"
    },
    "convertible": {
      "type": "boolean",
      "description": "Whether Aginera can turn this PDF into CAD (vector linework, or a scan that traced to linework)."
    },
    "reason": {
      "type": [
        "string",
        "null"
      ],
      "description": "Why not, when convertible is false: not_pdf, raster_or_unreadable, no_vector_linework."
    },
    "page_count": {
      "type": [
        "integer",
        "null"
      ]
    },
    "scan_traced": {
      "type": "boolean"
    },
    "trade_hint": {
      "type": [
        "object",
        "null"
      ],
      "properties": {
        "trade": {
          "type": [
            "string",
            "null"
          ]
        },
        "label": {
          "type": [
            "string",
            "null"
          ]
        },
        "confidence": {
          "type": "number"
        }
      },
      "required": [
        "trade",
        "label",
        "confidence"
      ]
    },
    "access": {
      "type": "string",
      "enum": [
        "purchased",
        "unlocked",
        "free"
      ],
      "description": "purchased = the $2 CAD file was bought for this document; unlocked = a paid plan (no gate); free = free tier (viewing is free; downloading the DXF or DWG needs the purchase)."
    },
    "paid": {
      "type": "boolean",
      "description": "The cad_dwg purchase exists for this document."
    },
    "pricing": {
      "type": "object",
      "properties": {
        "mode": {
          "type": "string",
          "enum": [
            "download_paid",
            "dwg_paid",
            "first_sheet_free"
          ]
        },
        "dxf": {
          "type": "object",
          "properties": {
            "price_usd": {
              "type": "number"
            },
            "watermarked": {
              "type": "boolean"
            },
            "note": {
              "type": "string"
            }
          },
          "required": [
            "price_usd",
            "watermarked",
            "note"
          ]
        },
        "dwg": {
          "type": "object",
          "properties": {
            "usd_cents": {
              "type": "integer"
            },
            "price_usd": {
              "type": "number"
            },
            "credits": {
              "type": "integer"
            },
            "purchase_required": {
              "type": "boolean"
            },
            "note": {
              "type": "string"
            }
          },
          "required": [
            "usd_cents",
            "price_usd",
            "credits",
            "purchase_required",
            "note"
          ]
        },
        "local_currency_note": {
          "type": "string"
        }
      },
      "required": [
        "mode",
        "dxf",
        "dwg",
        "local_currency_note"
      ]
    },
    "size": {
      "type": "object",
      "properties": {
        "min_dxf_mb": {
          "type": [
            "number",
            "null"
          ]
        },
        "free_size_exceeded": {
          "type": "boolean"
        }
      },
      "required": [
        "min_dxf_mb",
        "free_size_exceeded"
      ]
    },
    "next_step": {
      "type": "string"
    }
  },
  "required": [
    "document_id",
    "filename",
    "convertible",
    "reason",
    "page_count",
    "scan_traced",
    "trade_hint",
    "access",
    "paid",
    "pricing",
    "size",
    "next_step"
  ],
  "$defs": {
    "DocumentId": {
      "type": "string",
      "pattern": "^doc_[0-9A-Za-z]{22}$"
    }
  }
}