{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/frontsail-app/json-schema/frontsail-app-drawing-summary-schema.json",
  "title": "DrawingSummary",
  "x-generated": "2026-11-09",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/aspicio-api-openapi.json#/components/schemas/DrawingSummary",
  "type": "object",
  "required": [
    "format",
    "units",
    "bounds",
    "size",
    "space",
    "entityCount",
    "segmentCount",
    "spaces",
    "layers",
    "entityTypes",
    "unsupported"
  ],
  "properties": {
    "format": {
      "type": "string",
      "description": "Which format was read (\"dxf\", \"pdf\")"
    },
    "units": {
      "type": "string",
      "description": "Drawing unit label (\"mm\", \"in\", …) or \"\" when unitless"
    },
    "bounds": {
      "oneOf": [
        {
          "type": "object",
          "required": [
            "minX",
            "minY",
            "maxX",
            "maxY"
          ],
          "properties": {
            "minX": {
              "type": "number"
            },
            "minY": {
              "type": "number"
            },
            "maxX": {
              "type": "number"
            },
            "maxY": {
              "type": "number"
            }
          }
        },
        {
          "type": "null"
        }
      ],
      "description": "World-space extents, or null for an empty drawing"
    },
    "size": {
      "oneOf": [
        {
          "type": "object",
          "required": [
            "width",
            "height"
          ],
          "properties": {
            "width": {
              "type": "number"
            },
            "height": {
              "type": "number"
            }
          }
        },
        {
          "type": "null"
        }
      ],
      "description": "Bounding-box size in drawing units"
    },
    "space": {
      "oneOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "description": "Which space this summary is scoped to, or null when it covers the whole drawing (in which case bounds/size describe spaces[0], the space render returns)"
    },
    "entityCount": {
      "type": "integer"
    },
    "segmentCount": {
      "type": "integer"
    },
    "spaces": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/SpaceSummary"
      },
      "description": "Every space in the drawing (a PDF's pages, a DXF's model space and layouts), model space first. These do not sum to entityCount: a DXF sheet's viewports re-show model geometry, so an entity can be drawn in two spaces while existing once"
    },
    "layers": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/LayerSummary"
      }
    },
    "entityTypes": {
      "type": "object",
      "additionalProperties": {
        "type": "integer"
      },
      "description": "Top-level entities per DXF type"
    },
    "unsupported": {
      "type": "object",
      "additionalProperties": {
        "type": "integer"
      },
      "description": "Per-type counts of skipped (unsupported) entities"
    },
    "texts": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Unique TEXT/MTEXT strings, including inside blocks reachable via inserts and dimensions (title blocks, dimension values)"
    }
  },
  "$defs": {
    "LayerSummary": {
      "type": "object",
      "required": [
        "name",
        "entityCount",
        "visible",
        "color"
      ],
      "properties": {
        "name": {
          "type": "string"
        },
        "entityCount": {
          "type": "integer"
        },
        "visible": {
          "type": "boolean"
        },
        "color": {
          "type": "string",
          "description": "The color actually drawn on this layer (entity overrides included), #rrggbb"
        }
      }
    },
    "SpaceSummary": {
      "type": "object",
      "required": [
        "name",
        "entityCount",
        "segmentCount",
        "bounds",
        "size"
      ],
      "properties": {
        "name": {
          "type": "string",
          "description": "Pass to the `space` parameter to scope to it"
        },
        "entityCount": {
          "type": "integer"
        },
        "segmentCount": {
          "type": "integer"
        },
        "bounds": {
          "oneOf": [
            {
              "type": "object",
              "required": [
                "minX",
                "minY",
                "maxX",
                "maxY"
              ],
              "properties": {
                "minX": {
                  "type": "number"
                },
                "minY": {
                  "type": "number"
                },
                "maxX": {
                  "type": "number"
                },
                "maxY": {
                  "type": "number"
                }
              }
            },
            {
              "type": "null"
            }
          ]
        },
        "size": {
          "oneOf": [
            {
              "type": "object",
              "required": [
                "width",
                "height"
              ],
              "properties": {
                "width": {
                  "type": "number"
                },
                "height": {
                  "type": "number"
                }
              }
            },
            {
              "type": "null"
            }
          ]
        }
      }
    }
  }
}