{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/aginera-ai/json-schema/aginera-ai-document-create-schema.json",
  "title": "DocumentCreate",
  "x-generated": "2026-11-01",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/aginera-ai-openapi.json#/components/schemas/DocumentCreate",
  "type": "object",
  "properties": {
    "project_id": {
      "$ref": "#/$defs/ProjectId"
    },
    "filename": {
      "type": "string",
      "minLength": 1,
      "maxLength": 255
    },
    "source": {
      "oneOf": [
        {
          "type": "object",
          "properties": {
            "type": {
              "type": "string",
              "enum": [
                "url"
              ]
            },
            "url": {
              "type": "string",
              "maxLength": 2048,
              "format": "uri"
            }
          },
          "required": [
            "type",
            "url"
          ],
          "additionalProperties": false
        },
        {
          "type": "object",
          "properties": {
            "type": {
              "type": "string",
              "enum": [
                "upload"
              ]
            },
            "size_bytes": {
              "type": "integer",
              "exclusiveMinimum": 0
            },
            "content_type": {
              "type": "string",
              "enum": [
                "application/pdf",
                "image/vnd.dwg",
                "application/dxf",
                "image/png",
                "image/jpeg"
              ]
            }
          },
          "required": [
            "type"
          ],
          "additionalProperties": false
        }
      ]
    },
    "kind": {
      "type": "string",
      "enum": [
        "drawing",
        "specification",
        "schedule"
      ],
      "default": "drawing"
    },
    "discipline_hint": {
      "$ref": "#/$defs/Discipline"
    },
    "external_ref": {
      "type": "string",
      "minLength": 1,
      "maxLength": 128,
      "description": "Your own identifier for this resource; unique per tenant."
    },
    "metadata": {
      "$ref": "#/$defs/Metadata"
    }
  },
  "required": [
    "project_id",
    "filename",
    "source"
  ],
  "additionalProperties": false,
  "$defs": {
    "Discipline": {
      "type": "string",
      "enum": [
        "electrical",
        "mechanical",
        "plumbing",
        "fire_protection",
        "process",
        "structural",
        "multi_discipline"
      ]
    },
    "Metadata": {
      "type": "object",
      "additionalProperties": {
        "type": "string",
        "maxLength": 500
      }
    },
    "ProjectId": {
      "type": "string",
      "pattern": "^prj_[0-9A-Za-z]{22}$"
    }
  }
}