{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://api.aspenflowsim.top/api/v1/equipment-occupancy-schema.json",
  "title": "Aspen CAD equipment tight occupancy frame",
  "description": "Zero-padding axis-aligned equipment envelope stored relative to the CAD insertion base.",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "schema",
    "role",
    "shape",
    "coordinate_system",
    "reference",
    "limits_from_insertion_base",
    "size",
    "contains_insertion_base",
    "padding",
    "derivation",
    "world_transform"
  ],
  "properties": {
    "schema": {
      "const": "cad-aspen-equipment-occupancy-frame/v1"
    },
    "role": {
      "const": "tight_equipment_placement_envelope"
    },
    "shape": {
      "const": "axis_aligned_rectangle"
    },
    "coordinate_system": {
      "const": "insertion_base_relative"
    },
    "reference": {
      "const": "insertion_base_local"
    },
    "limits_from_insertion_base": {
      "description": "Signed extreme coordinates after subtracting insertion_base_local from the precise vector extents.",
      "type": "object",
      "additionalProperties": false,
      "required": [
        "left",
        "bottom",
        "right",
        "top"
      ],
      "properties": {
        "left": {
          "type": "number"
        },
        "bottom": {
          "type": "number"
        },
        "right": {
          "type": "number"
        },
        "top": {
          "type": "number"
        }
      }
    },
    "size": {
      "description": "Convenience dimensions; width=right-left and height=top-bottom.",
      "type": "object",
      "additionalProperties": false,
      "required": [
        "width",
        "height"
      ],
      "properties": {
        "width": {
          "type": "number",
          "minimum": 0
        },
        "height": {
          "type": "number",
          "minimum": 0
        }
      }
    },
    "contains_insertion_base": {
      "type": "boolean"
    },
    "padding": {
      "const": 0.0
    },
    "derivation": {
      "type": "object",
      "required": [
        "method",
        "source_field",
        "included_entity_count",
        "excluded_entity_count",
        "includes_nested_insert_extents",
        "extreme_entity_handles",
        "precision_decimals",
        "precision_source"
      ],
      "properties": {
        "method": {
          "const": "axis_aligned_union_of_precise_entity_bounds"
        },
        "source_field": {
          "const": "entities[].bounds_local"
        },
        "included_entity_count": {
          "type": "integer",
          "minimum": 1
        },
        "excluded_entity_count": {
          "type": "integer",
          "minimum": 0
        },
        "includes_nested_insert_extents": {
          "type": "boolean"
        },
        "extreme_entity_handles": {
          "type": "object",
          "required": [
            "left",
            "bottom",
            "right",
            "top"
          ],
          "additionalProperties": false,
          "properties": {
            "left": {
              "type": "array",
              "items": {
                "type": "string"
              },
              "minItems": 1
            },
            "bottom": {
              "type": "array",
              "items": {
                "type": "string"
              },
              "minItems": 1
            },
            "right": {
              "type": "array",
              "items": {
                "type": "string"
              },
              "minItems": 1
            },
            "top": {
              "type": "array",
              "items": {
                "type": "string"
              },
              "minItems": 1
            }
          }
        },
        "precision_decimals": {
          "const": 6
        },
        "precision_source": {
          "enum": [
            "precise_source_dxf",
            "reviewed_serialized_bounds",
            "mixed_precise_and_serialized_bounds"
          ]
        }
      }
    },
    "world_transform": {
      "type": "string"
    },
    "placement_warning": {
      "type": "string"
    }
  }
}