{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/aginera-ai/json-schema/aginera-ai-export-schema.json",
  "title": "Export",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/aginera-ai-exports-api-openapi.yml#/components/schemas/Export",
  "type": "object",
  "properties": {
    "id": {
      "$ref": "#/$defs/ExportId"
    },
    "takeoff_id": {
      "$ref": "#/$defs/TakeoffId"
    },
    "format": {
      "$ref": "#/$defs/ExportFormat"
    },
    "status": {
      "$ref": "#/$defs/JobStatus"
    },
    "external_ref": {
      "type": [
        "string",
        "null"
      ]
    },
    "credits_charged": {
      "type": "number"
    },
    "download": {
      "type": "object",
      "properties": {
        "url": {
          "type": "string",
          "format": "uri"
        },
        "filename": {
          "type": "string"
        },
        "expires_at": {
          "type": "string",
          "format": "date-time"
        }
      },
      "required": [
        "url",
        "filename",
        "expires_at"
      ]
    },
    "failure": {
      "$ref": "#/$defs/Failure"
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    },
    "completed_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    }
  },
  "required": [
    "id",
    "format",
    "status",
    "external_ref",
    "credits_charged",
    "created_at",
    "completed_at"
  ],
  "$defs": {
    "ExportFormat": {
      "type": "string",
      "enum": [
        "csv",
        "xlsx",
        "json",
        "accubid",
        "mccormick",
        "intellibid",
        "bluebeam_ost",
        "procore"
      ]
    },
    "ExportId": {
      "type": "string",
      "pattern": "^exp_[0-9A-Za-z]{22}$"
    },
    "Failure": {
      "type": "object",
      "properties": {
        "code": {
          "type": "string",
          "enum": [
            "document_unreadable",
            "unsupported_content",
            "no_pages_selected",
            "capacity",
            "cancelled",
            "internal"
          ]
        },
        "message": {
          "type": "string"
        }
      },
      "required": [
        "code",
        "message"
      ]
    },
    "JobStatus": {
      "type": "string",
      "enum": [
        "queued",
        "processing",
        "completed",
        "failed",
        "cancelled"
      ]
    },
    "TakeoffId": {
      "type": "string",
      "pattern": "^tko_[0-9A-Za-z]{22}$"
    }
  }
}