{
  "openapi": "3.1.0",
  "info": {
    "title": "Tracer API",
    "summary": "Service to Store and retrieve Traces between Domain Objects",
    "version": "0.1.0"
  },
  "paths": {
    "/traces": {
      "get": {
        "tags": [
          "traces"
        ],
        "summary": "Get Node Links",
        "description": "Retrieves all traces (links) associated with a node up to `n_hops` distance.\n\nArgs:\n    query_type: Determines the type of query:\n        - \"traces_list\": (default) use for traces entity display\n        - \"traces_list_with_reference_traces\": traces list plus\n          auto-reference traces (have no version)\n        - \"graph\": use for trace entity graph display",
        "operationId": "get_node_links_traces_get",
        "parameters": [
          {
            "name": "node_id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Node Id"
            }
          },
          {
            "name": "node_type",
            "in": "query",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/NodeType"
            }
          },
          {
            "name": "version",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Version"
            }
          },
          {
            "name": "n_hops",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "default": 1,
              "title": "N Hops"
            }
          },
          {
            "name": "query_type",
            "in": "query",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/QueryType",
              "description": "Type of query: 'graph' for graph visualization, 'traces_list' for traces list, or 'traces_list_with_reference_traces' to include auto-reference traces",
              "default": "traces_list"
            },
            "description": "Type of query: 'graph' for graph visualization, 'traces_list' for traces list, or 'traces_list_with_reference_traces' to include auto-reference traces"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConnectedNodesResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        },
        "x-public": true
      }
    },
    "/traces/batch/list": {
      "post": {
        "tags": [
          "traces"
        ],
        "summary": "Batch Retrieve Traces",
        "description": "Retrieve traces for multiple nodes in a single request.\nEach node's traces are retrieved independently and returned in a dictionary\nkeyed by the node identifier.\n\nNodes are processed concurrently. Downstream fan-out is rate-limited by\nthe module-level semaphore in NodeDataService.bulk_resolve, so parallel\nprocessing here does not multiply the upstream load on QMS / TechDoc.",
        "operationId": "batch_retrieve_traces_traces_batch_list_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BatchRetrieveRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BatchRetrieveResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        },
        "x-public": true
      }
    },
    "/node/resolve": {
      "post": {
        "tags": [
          "nodes"
        ],
        "summary": "Resolve Nodes",
        "operationId": "resolve_nodes_node_resolve_post",
        "parameters": [
          {
            "name": "include_latest_approved_and_latest_available",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean",
              "description": "When with_linked_entities is True, collapse multi-version linked targets to latest major/approved and latest fractional/available per entity.",
              "default": true,
              "title": "Include Latest Approved And Latest Available"
            },
            "description": "When with_linked_entities is True, collapse multi-version linked targets to latest major/approved and latest fractional/available per entity."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ResolveNodesRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": {
                    "anyOf": [
                      {
                        "$ref": "#/components/schemas/ResolvedNodeEntity"
                      },
                      {
                        "$ref": "#/components/schemas/ResolvedNodeEntityWithLinkedEntities"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "title": "Response Resolve Nodes Node Resolve Post"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        },
        "x-public": true
      }
    },
    "/nodes/version": {
      "put": {
        "tags": [
          "nodes"
        ],
        "summary": "Update Node Attributes And Associated Traces",
        "description": "Updates a node's version either in-place or by creating a new version with duplicated relationships.\n\nArgs:\n    request: FastAPI request object containing metadata\n    update: The version update parameters\n\nReturns:\n    Node: The updated/new node\n\nRaises:\n    HTTPException: If node not found or update fails",
        "operationId": "update_node_attributes_and_associated_traces_nodes_version_put",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/NodeAttributesUpdate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Node"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        },
        "x-public": true
      }
    }
  },
  "components": {
    "schemas": {
      "AuditInfo": {
        "properties": {
          "user_id_created": {
            "type": "string",
            "title": "User Id Created"
          },
          "timestamp_created": {
            "type": "string",
            "format": "date-time",
            "title": "Timestamp Created"
          },
          "user_id_last_updated": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "User Id Last Updated"
          },
          "timestamp_last_updated": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "title": "Timestamp Last Updated"
          },
          "last_action": {
            "$ref": "#/components/schemas/LastActionType"
          }
        },
        "type": "object",
        "required": [
          "user_id_created",
          "timestamp_created",
          "last_action"
        ],
        "title": "AuditInfo"
      },
      "AutomaticTraceSource": {
        "type": "string",
        "enum": [
          "text_editor",
          "process_modeller",
          "document_creation",
          "submission_creation",
          "schema_association",
          "global_element_reference",
          "external_file_reference",
          "submission_creation_from_template",
          "submission_template_creation"
        ],
        "title": "AutomaticTraceSource"
      },
      "BatchNodeAttributesUpdateRequest": {
        "properties": {
          "updates": {
            "items": {
              "$ref": "#/components/schemas/NodeAttributesUpdate"
            },
            "type": "array",
            "title": "Updates"
          }
        },
        "type": "object",
        "required": [
          "updates"
        ],
        "title": "BatchNodeAttributesUpdateRequest"
      },
      "BatchNodeAttributesUpdateResponse": {
        "properties": {
          "results": {
            "items": {
              "$ref": "#/components/schemas/BatchNodeAttributesUpdateResult"
            },
            "type": "array",
            "title": "Results"
          },
          "status": {
            "$ref": "#/components/schemas/BatchStatus"
          },
          "total_count": {
            "type": "integer",
            "title": "Total Count"
          },
          "success_count": {
            "type": "integer",
            "title": "Success Count"
          },
          "failure_count": {
            "type": "integer",
            "title": "Failure Count"
          }
        },
        "type": "object",
        "required": [
          "results",
          "status",
          "total_count",
          "success_count",
          "failure_count"
        ],
        "title": "BatchNodeAttributesUpdateResponse"
      },
      "BatchNodeAttributesUpdateResult": {
        "properties": {
          "success": {
            "type": "boolean",
            "title": "Success"
          },
          "source_identifier": {
            "type": "string",
            "title": "Source Identifier"
          },
          "target_identifier": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Target Identifier"
          },
          "node": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Node"
              },
              {
                "type": "null"
              }
            ]
          },
          "error": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Error"
          }
        },
        "type": "object",
        "required": [
          "success",
          "source_identifier"
        ],
        "title": "BatchNodeAttributesUpdateResult"
      },
      "BatchNodeDeleteRequest": {
        "properties": {
          "node_identifiers": {
            "items": {
              "type": "string"
            },
            "type": "array",
            "title": "Node Identifiers"
          }
        },
        "type": "object",
        "required": [
          "node_identifiers"
        ],
        "title": "BatchNodeDeleteRequest"
      },
      "BatchNodeDeleteResponse": {
        "properties": {
          "results": {
            "items": {
              "$ref": "#/components/schemas/BatchNodeDeleteResult"
            },
            "type": "array",
            "title": "Results"
          },
          "status": {
            "$ref": "#/components/schemas/BatchStatus"
          },
          "total_count": {
            "type": "integer",
            "title": "Total Count"
          },
          "success_count": {
            "type": "integer",
            "title": "Success Count"
          },
          "failure_count": {
            "type": "integer",
            "title": "Failure Count"
          }
        },
        "type": "object",
        "required": [
          "results",
          "status",
          "total_count",
          "success_count",
          "failure_count"
        ],
        "title": "BatchNodeDeleteResponse"
      },
      "BatchNodeDeleteResult": {
        "properties": {
          "success": {
            "type": "boolean",
            "title": "Success"
          },
          "node_identifier": {
            "type": "string",
            "title": "Node Identifier"
          },
          "edges_deleted": {
            "type": "integer",
            "title": "Edges Deleted",
            "default": 0
          },
          "error": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Error"
          }
        },
        "type": "object",
        "required": [
          "success",
          "node_identifier"
        ],
        "title": "BatchNodeDeleteResult"
      },
      "BatchOperationResult": {
        "properties": {
          "success": {
            "type": "boolean",
            "title": "Success"
          },
          "operation": {
            "$ref": "#/components/schemas/BatchOperationType"
          },
          "trace_id": {
            "anyOf": [
              {
                "type": "string",
                "example": "5eb7cf5a86d9755df3a6c593"
              },
              {
                "type": "null"
              }
            ],
            "title": "Trace Id"
          },
          "target_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Target Id"
          },
          "error": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Error"
          }
        },
        "type": "object",
        "required": [
          "success",
          "operation"
        ],
        "title": "BatchOperationResult"
      },
      "BatchOperationType": {
        "type": "string",
        "enum": [
          "create",
          "delete",
          "delete_by_id"
        ],
        "title": "BatchOperationType"
      },
      "BatchRetrieveMode": {
        "type": "string",
        "enum": [
          "legacy_connected_nodes",
          "resolved"
        ],
        "title": "BatchRetrieveMode"
      },
      "BatchRetrieveNode": {
        "properties": {
          "node_id": {
            "type": "string",
            "title": "Node Id"
          },
          "node_type": {
            "$ref": "#/components/schemas/NodeType"
          },
          "version": {
            "type": "string",
            "title": "Version"
          }
        },
        "type": "object",
        "required": [
          "node_id",
          "node_type",
          "version"
        ],
        "title": "BatchRetrieveNode"
      },
      "BatchRetrieveRequest": {
        "properties": {
          "nodes": {
            "items": {
              "$ref": "#/components/schemas/BatchRetrieveNode"
            },
            "type": "array",
            "title": "Nodes"
          },
          "n_hops": {
            "type": "integer",
            "minimum": 1,
            "title": "N Hops",
            "default": 1
          },
          "mode": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/BatchRetrieveMode"
              },
              {
                "type": "null"
              }
            ],
            "default": "legacy_connected_nodes"
          }
        },
        "type": "object",
        "required": [
          "nodes"
        ],
        "title": "BatchRetrieveRequest"
      },
      "BatchRetrieveResponse": {
        "properties": {
          "results": {
            "additionalProperties": {
              "$ref": "#/components/schemas/ConnectedNodesResponse"
            },
            "type": "object",
            "title": "Results"
          },
          "resolved_results": {
            "anyOf": [
              {
                "additionalProperties": {
                  "items": {
                    "anyOf": [
                      {
                        "$ref": "#/components/schemas/ResolvedTrace"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "type": "array"
                },
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Resolved Results"
          }
        },
        "type": "object",
        "required": [
          "results"
        ],
        "title": "BatchRetrieveResponse"
      },
      "BatchStatus": {
        "type": "string",
        "enum": [
          "completed",
          "partial",
          "failed"
        ],
        "title": "BatchStatus"
      },
      "BatchTraceCreateOperation": {
        "properties": {
          "operation": {
            "type": "string",
            "const": "create",
            "title": "Operation"
          },
          "source": {
            "type": "string",
            "title": "Source"
          },
          "sourceType": {
            "$ref": "#/components/schemas/NodeType"
          },
          "sourceVersion": {
            "type": "string",
            "title": "Sourceversion"
          },
          "target": {
            "type": "string",
            "title": "Target"
          },
          "targetType": {
            "$ref": "#/components/schemas/NodeType"
          },
          "targetVersion": {
            "type": "string",
            "title": "Targetversion"
          },
          "relation_type": {
            "$ref": "#/components/schemas/RelationType"
          },
          "create_bidirectional": {
            "type": "boolean",
            "title": "Create Bidirectional",
            "default": false
          },
          "backward_relation_type": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/RelationType"
              },
              {
                "type": "null"
              }
            ]
          },
          "origin": {
            "$ref": "#/components/schemas/TraceOrigin",
            "default": "manual"
          },
          "automatic_source": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/AutomaticTraceSource"
              },
              {
                "type": "null"
              }
            ]
          },
          "manual_source": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/ManualTraceSource"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "type": "object",
        "required": [
          "operation",
          "source",
          "sourceType",
          "sourceVersion",
          "target",
          "targetType",
          "targetVersion",
          "relation_type"
        ],
        "title": "BatchTraceCreateOperation"
      },
      "BatchTraceDeleteByIdOperation": {
        "properties": {
          "operation": {
            "type": "string",
            "const": "delete_by_id",
            "title": "Operation"
          },
          "trace_id": {
            "type": "string",
            "maxLength": 24,
            "minLength": 24,
            "pattern": "^[0-9a-f]{24}$",
            "title": "Trace Id",
            "example": "5eb7cf5a86d9755df3a6c593"
          }
        },
        "type": "object",
        "required": [
          "operation",
          "trace_id"
        ],
        "title": "BatchTraceDeleteByIdOperation"
      },
      "BatchTraceDeleteByTargetOperation": {
        "properties": {
          "operation": {
            "type": "string",
            "const": "delete",
            "title": "Operation"
          },
          "target": {
            "type": "string",
            "title": "Target"
          },
          "targetType": {
            "$ref": "#/components/schemas/NodeType"
          },
          "targetVersion": {
            "type": "string",
            "title": "Targetversion"
          },
          "source": {
            "type": "string",
            "title": "Source"
          },
          "sourceType": {
            "$ref": "#/components/schemas/NodeType"
          },
          "sourceVersion": {
            "type": "string",
            "title": "Sourceversion"
          },
          "relation_type": {
            "$ref": "#/components/schemas/RelationType"
          },
          "delete_backward": {
            "type": "boolean",
            "title": "Delete Backward",
            "default": false
          },
          "backward_relation_type": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/RelationType"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "type": "object",
        "required": [
          "operation",
          "target",
          "targetType",
          "targetVersion",
          "source",
          "sourceType",
          "sourceVersion",
          "relation_type"
        ],
        "title": "BatchTraceDeleteByTargetOperation"
      },
      "BatchTraceRequest": {
        "properties": {
          "operations": {
            "items": {
              "oneOf": [
                {
                  "$ref": "#/components/schemas/BatchTraceCreateOperation"
                },
                {
                  "$ref": "#/components/schemas/BatchTraceDeleteByIdOperation"
                },
                {
                  "$ref": "#/components/schemas/BatchTraceDeleteByTargetOperation"
                }
              ],
              "discriminator": {
                "propertyName": "operation",
                "mapping": {
                  "create": "#/components/schemas/BatchTraceCreateOperation",
                  "delete": "#/components/schemas/BatchTraceDeleteByTargetOperation",
                  "delete_by_id": "#/components/schemas/BatchTraceDeleteByIdOperation"
                }
              }
            },
            "type": "array",
            "title": "Operations"
          }
        },
        "type": "object",
        "required": [
          "operations"
        ],
        "title": "BatchTraceRequest"
      },
      "BatchTraceResponse": {
        "properties": {
          "results": {
            "items": {
              "$ref": "#/components/schemas/BatchOperationResult"
            },
            "type": "array",
            "title": "Results"
          }
        },
        "type": "object",
        "required": [
          "results"
        ],
        "title": "BatchTraceResponse"
      },
      "ConnectedNode": {
        "properties": {
          "trace_id": {
            "type": "string",
            "title": "Trace Id",
            "example": "5eb7cf5a86d9755df3a6c593"
          },
          "node": {
            "$ref": "#/components/schemas/Node"
          },
          "relation_type": {
            "$ref": "#/components/schemas/RelationType"
          },
          "tenant_metadata": {
            "$ref": "#/components/schemas/TenantMetadata"
          },
          "audit_info": {
            "$ref": "#/components/schemas/AuditInfo"
          },
          "outdated": {
            "type": "boolean",
            "title": "Outdated",
            "default": false
          },
          "trace_metadata": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/TraceMetadata"
              },
              {
                "type": "null"
              }
            ]
          },
          "hopsAwayFromSource": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Hopsawayfromsource"
          }
        },
        "type": "object",
        "required": [
          "trace_id",
          "node",
          "relation_type",
          "tenant_metadata",
          "audit_info"
        ],
        "title": "ConnectedNode"
      },
      "ConnectedNodesResponse": {
        "properties": {
          "source_node": {
            "$ref": "#/components/schemas/Node"
          },
          "target_node_map": {
            "additionalProperties": {
              "items": {
                "$ref": "#/components/schemas/ConnectedNode"
              },
              "type": "array"
            },
            "propertyNames": {
              "$ref": "#/components/schemas/NodeType"
            },
            "type": "object",
            "title": "Target Node Map"
          },
          "edges": {
            "anyOf": [
              {
                "items": {
                  "$ref": "#/components/schemas/EdgeWithDepth"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Edges"
          }
        },
        "type": "object",
        "required": [
          "source_node",
          "target_node_map"
        ],
        "title": "ConnectedNodesResponse"
      },
      "CopyTracesRequest": {
        "properties": {
          "source_node_id": {
            "type": "string",
            "title": "Source Node Id"
          },
          "source_node_type": {
            "$ref": "#/components/schemas/NodeType"
          },
          "source_node_version": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Source Node Version"
          },
          "target_node_id": {
            "type": "string",
            "title": "Target Node Id"
          },
          "target_node_type": {
            "$ref": "#/components/schemas/NodeType"
          },
          "target_node_version": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Target Node Version"
          },
          "include_automatic": {
            "type": "boolean",
            "title": "Include Automatic",
            "default": false
          },
          "include_outdated": {
            "type": "boolean",
            "title": "Include Outdated",
            "default": false
          },
          "excluded_targets": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Excluded Targets"
          },
          "included_relation_types": {
            "anyOf": [
              {
                "items": {
                  "$ref": "#/components/schemas/RelationType"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Included Relation Types"
          },
          "excluded_relation_types": {
            "anyOf": [
              {
                "items": {
                  "$ref": "#/components/schemas/RelationType"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Excluded Relation Types"
          }
        },
        "type": "object",
        "required": [
          "source_node_id",
          "source_node_type",
          "target_node_id",
          "target_node_type"
        ],
        "title": "CopyTracesRequest"
      },
      "DecisionResult": {
        "properties": {
          "traces_created": {
            "type": "integer",
            "title": "Traces Created"
          },
          "rejected": {
            "type": "integer",
            "title": "Rejected"
          }
        },
        "type": "object",
        "required": [
          "traces_created",
          "rejected"
        ],
        "title": "DecisionResult"
      },
      "Edge": {
        "properties": {
          "_id": {
            "anyOf": [
              {
                "type": "string",
                "example": "5eb7cf5a86d9755df3a6c593"
              },
              {
                "type": "null"
              }
            ],
            "title": "Id",
            "description": "MongoDB document ObjectID"
          },
          "source": {
            "type": "string",
            "title": "Source"
          },
          "target": {
            "type": "string",
            "title": "Target"
          },
          "relation_type": {
            "$ref": "#/components/schemas/RelationType",
            "default": "is_related"
          },
          "source_node": {
            "anyOf": [
              {
                "properties": {
                  "id": {
                    "type": "string",
                    "title": "Id"
                  },
                  "collection": {
                    "type": "string",
                    "title": "Collection"
                  }
                },
                "type": "object",
                "required": [
                  "id",
                  "collection"
                ]
              },
              {
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Source Node"
          },
          "target_node": {
            "anyOf": [
              {
                "properties": {
                  "id": {
                    "type": "string",
                    "title": "Id"
                  },
                  "collection": {
                    "type": "string",
                    "title": "Collection"
                  }
                },
                "type": "object",
                "required": [
                  "id",
                  "collection"
                ]
              },
              {
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Target Node"
          },
          "tenant_metadata": {
            "$ref": "#/components/schemas/TenantMetadata"
          },
          "audit_info": {
            "$ref": "#/components/schemas/AuditInfo"
          },
          "outdated": {
            "type": "boolean",
            "title": "Outdated",
            "default": false
          },
          "trace_metadata": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/TraceMetadata"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "type": "object",
        "required": [
          "source",
          "target",
          "tenant_metadata",
          "audit_info"
        ],
        "title": "Edge"
      },
      "EdgeUpdate": {
        "properties": {
          "source": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Source"
          },
          "target": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Target"
          }
        },
        "type": "object",
        "title": "EdgeUpdate"
      },
      "EdgeWithDepth": {
        "properties": {
          "_id": {
            "type": "string",
            "title": "Id",
            "example": "5eb7cf5a86d9755df3a6c593"
          },
          "source": {
            "type": "string",
            "title": "Source"
          },
          "target": {
            "type": "string",
            "title": "Target"
          },
          "relation_type": {
            "items": {
              "$ref": "#/components/schemas/RelationType"
            },
            "type": "array",
            "title": "Relation Type"
          },
          "source_node": {
            "anyOf": [
              {
                "properties": {
                  "id": {
                    "type": "string",
                    "title": "Id"
                  },
                  "collection": {
                    "type": "string",
                    "title": "Collection"
                  }
                },
                "type": "object",
                "required": [
                  "id",
                  "collection"
                ]
              },
              {
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Source Node"
          },
          "target_node": {
            "anyOf": [
              {
                "properties": {
                  "id": {
                    "type": "string",
                    "title": "Id"
                  },
                  "collection": {
                    "type": "string",
                    "title": "Collection"
                  }
                },
                "type": "object",
                "required": [
                  "id",
                  "collection"
                ]
              },
              {
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Target Node"
          },
          "tenant_metadata": {
            "$ref": "#/components/schemas/TenantMetadata"
          },
          "audit_info": {
            "$ref": "#/components/schemas/AuditInfo"
          },
          "outdated": {
            "type": "boolean",
            "title": "Outdated",
            "default": false
          },
          "trace_metadata": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/TraceMetadata"
              },
              {
                "type": "null"
              }
            ]
          },
          "depth": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Depth"
          }
        },
        "type": "object",
        "required": [
          "_id",
          "source",
          "target",
          "relation_type",
          "tenant_metadata",
          "audit_info"
        ],
        "title": "EdgeWithDepth"
      },
      "GlobalElementDecisionResult": {
        "properties": {
          "traces_created": {
            "type": "integer",
            "title": "Traces Created"
          }
        },
        "type": "object",
        "required": [
          "traces_created"
        ],
        "title": "GlobalElementDecisionResult"
      },
      "GlobalElementMatchDecision": {
        "properties": {
          "record_id": {
            "type": "string",
            "title": "Record Id"
          },
          "type": {
            "type": "string",
            "title": "Type"
          },
          "object_id": {
            "type": "string",
            "title": "Object Id"
          }
        },
        "type": "object",
        "required": [
          "record_id",
          "type",
          "object_id"
        ],
        "title": "GlobalElementMatchDecision"
      },
      "GlobalElementMatchDecisionsRequest": {
        "properties": {
          "decisions": {
            "items": {
              "$ref": "#/components/schemas/GlobalElementMatchDecision"
            },
            "type": "array",
            "title": "Decisions"
          }
        },
        "type": "object",
        "required": [
          "decisions"
        ],
        "title": "GlobalElementMatchDecisionsRequest"
      },
      "GraphTraversalOptions": {
        "properties": {
          "direction": {
            "type": "string",
            "enum": [
              "forward",
              "backward"
            ],
            "title": "Direction",
            "default": "forward"
          },
          "allowed_node_types": {
            "anyOf": [
              {
                "items": {
                  "$ref": "#/components/schemas/NodeType"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Allowed Node Types"
          },
          "excluded_node_types": {
            "anyOf": [
              {
                "items": {
                  "$ref": "#/components/schemas/NodeType"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Excluded Node Types"
          },
          "allowed_relation_types": {
            "anyOf": [
              {
                "items": {
                  "$ref": "#/components/schemas/RelationType"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Allowed Relation Types"
          },
          "excluded_relation_types": {
            "anyOf": [
              {
                "items": {
                  "$ref": "#/components/schemas/RelationType"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Excluded Relation Types"
          },
          "max_depth": {
            "type": "integer",
            "title": "Max Depth",
            "default": 2
          }
        },
        "type": "object",
        "title": "GraphTraversalOptions"
      },
      "HTTPValidationError": {
        "properties": {
          "detail": {
            "items": {
              "$ref": "#/components/schemas/ValidationError"
            },
            "type": "array",
            "title": "Detail"
          }
        },
        "type": "object",
        "title": "HTTPValidationError"
      },
      "LastActionType": {
        "type": "string",
        "enum": [
          "created",
          "updated"
        ],
        "title": "LastActionType"
      },
      "ManualTraceSource": {
        "type": "string",
        "enum": [
          "use_case"
        ],
        "title": "ManualTraceSource"
      },
      "MatchDecision": {
        "properties": {
          "type": {
            "type": "string",
            "title": "Type"
          },
          "object_id": {
            "type": "string",
            "title": "Object Id"
          },
          "action": {
            "type": "string",
            "enum": [
              "accept",
              "reject",
              "modify"
            ],
            "title": "Action"
          },
          "override_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Override Id"
          }
        },
        "type": "object",
        "required": [
          "type",
          "object_id",
          "action"
        ],
        "title": "MatchDecision"
      },
      "MatchDecisionsRequest": {
        "properties": {
          "decisions": {
            "items": {
              "$ref": "#/components/schemas/MatchDecision"
            },
            "type": "array",
            "title": "Decisions"
          }
        },
        "type": "object",
        "required": [
          "decisions"
        ],
        "title": "MatchDecisionsRequest"
      },
      "MatrixType": {
        "type": "string",
        "enum": [
          "requirements",
          "requirements_legacy"
        ],
        "title": "MatrixType"
      },
      "MigrateTargetRequest": {
        "properties": {
          "old_node_identifier": {
            "type": "string",
            "title": "Old Node Identifier"
          },
          "new_node_identifier": {
            "type": "string",
            "title": "New Node Identifier"
          }
        },
        "type": "object",
        "required": [
          "old_node_identifier",
          "new_node_identifier"
        ],
        "title": "MigrateTargetRequest"
      },
      "MigrateTargetResponse": {
        "properties": {
          "migrated_count": {
            "type": "integer",
            "title": "Migrated Count"
          }
        },
        "type": "object",
        "required": [
          "migrated_count"
        ],
        "title": "MigrateTargetResponse"
      },
      "Node": {
        "properties": {
          "_id": {
            "anyOf": [
              {
                "type": "string",
                "example": "5eb7cf5a86d9755df3a6c593"
              },
              {
                "type": "null"
              }
            ],
            "title": "Id",
            "description": "MongoDB document ObjectID"
          },
          "type": {
            "$ref": "#/components/schemas/NodeType"
          },
          "node_id": {
            "type": "string",
            "title": "Node Id"
          },
          "version": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Version"
          },
          "tenant_metadata": {
            "$ref": "#/components/schemas/TenantMetadata"
          },
          "audit_info": {
            "$ref": "#/components/schemas/AuditInfo"
          },
          "deleted": {
            "type": "boolean",
            "title": "Deleted",
            "default": false
          }
        },
        "type": "object",
        "required": [
          "type",
          "node_id",
          "tenant_metadata",
          "audit_info"
        ],
        "title": "Node"
      },
      "NodeAIAnalysisRequest": {
        "properties": {
          "filter": {
            "$ref": "#/components/schemas/GraphTraversalOptions"
          },
          "changed_object": {
            "anyOf": [
              {
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Changed Object"
          },
          "product_context": {
            "items": {
              "$ref": "#/components/schemas/ProductContextQuestion"
            },
            "type": "array",
            "title": "Product Context"
          },
          "user_query": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "User Query"
          }
        },
        "type": "object",
        "title": "NodeAIAnalysisRequest"
      },
      "NodeAIAnalysisResponse": {
        "properties": {
          "reply": {
            "type": "string",
            "title": "Reply"
          },
          "source_node_identifier": {
            "type": "string",
            "title": "Source Node Identifier"
          },
          "impacted_resolved_nodes": {
            "additionalProperties": {
              "items": {
                "$ref": "#/components/schemas/ResolvedNodeEntity"
              },
              "type": "array"
            },
            "propertyNames": {
              "$ref": "#/components/schemas/NodeType"
            },
            "type": "object",
            "title": "Impacted Resolved Nodes"
          }
        },
        "type": "object",
        "required": [
          "reply",
          "source_node_identifier",
          "impacted_resolved_nodes"
        ],
        "title": "NodeAIAnalysisResponse"
      },
      "NodeAttributesUpdate": {
        "properties": {
          "sourceType": {
            "$ref": "#/components/schemas/NodeType"
          },
          "sourceId": {
            "type": "string",
            "title": "Sourceid"
          },
          "sourceVersion": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "integer"
              }
            ],
            "title": "Sourceversion"
          },
          "newSourceType": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/NodeType"
              },
              {
                "type": "null"
              }
            ]
          },
          "newSourceId": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Newsourceid"
          },
          "newVersion": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "integer"
              }
            ],
            "title": "Newversion"
          },
          "updateMode": {
            "$ref": "#/components/schemas/NodeAttributesUpdateMode"
          },
          "excludedRelations": {
            "anyOf": [
              {
                "items": {
                  "$ref": "#/components/schemas/RelationType"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Excludedrelations"
          },
          "allowedRelations": {
            "anyOf": [
              {
                "items": {
                  "$ref": "#/components/schemas/RelationType"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Allowedrelations"
          }
        },
        "type": "object",
        "required": [
          "sourceType",
          "sourceId",
          "sourceVersion",
          "newVersion",
          "updateMode"
        ],
        "title": "NodeAttributesUpdate"
      },
      "NodeAttributesUpdateMode": {
        "type": "string",
        "enum": [
          "in_place",
          "create_new"
        ],
        "title": "NodeAttributesUpdateMode"
      },
      "NodeDeleteMode": {
        "type": "string",
        "enum": [
          "only_node",
          "delete_related_edges"
        ],
        "title": "NodeDeleteMode"
      },
      "NodeImpactRequest": {
        "properties": {
          "filter": {
            "$ref": "#/components/schemas/GraphTraversalOptions"
          },
          "changed_object": {
            "anyOf": [
              {
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Changed Object"
          }
        },
        "type": "object",
        "required": [
          "filter"
        ],
        "title": "NodeImpactRequest"
      },
      "NodeImpactResponse": {
        "properties": {
          "impacted_resolved_nodes": {
            "additionalProperties": {
              "items": {
                "$ref": "#/components/schemas/ResolvedNodeEntity"
              },
              "type": "array"
            },
            "propertyNames": {
              "$ref": "#/components/schemas/NodeType"
            },
            "type": "object",
            "title": "Impacted Resolved Nodes"
          }
        },
        "type": "object",
        "required": [
          "impacted_resolved_nodes"
        ],
        "title": "NodeImpactResponse",
        "description": "V1: list of resolved node entities that are impacted by the changed object\nV2: additional information about impacted fields\nV3: diff between old and new values (maybe in tiptap format)"
      },
      "NodeType": {
        "type": "string",
        "enum": [
          "SOP",
          "WorkInstruction",
          "Form",
          "Product",
          "ProductFamily",
          "KnowledgeUnit",
          "KnowledgeTopic",
          "KnowledgeUnitSchema",
          "KnowledgeTopicSchema",
          "Document",
          "Template",
          "Record",
          "File",
          "Submission",
          "ExternalFile",
          "GlobalElement",
          "SubmissionTemplate"
        ],
        "title": "NodeType"
      },
      "PaginatedTraceList": {
        "properties": {
          "traces": {
            "items": {
              "$ref": "#/components/schemas/TraceResponse"
            },
            "type": "array",
            "title": "Traces"
          },
          "total": {
            "type": "integer",
            "title": "Total"
          },
          "skip": {
            "type": "integer",
            "title": "Skip"
          },
          "limit": {
            "type": "integer",
            "title": "Limit"
          }
        },
        "type": "object",
        "required": [
          "traces",
          "total",
          "skip",
          "limit"
        ],
        "title": "PaginatedTraceList"
      },
      "ProductContextQuestion": {
        "properties": {
          "question": {
            "type": "string",
            "title": "Question"
          },
          "answer": {
            "type": "string",
            "title": "Answer"
          }
        },
        "type": "object",
        "required": [
          "question",
          "answer"
        ],
        "title": "ProductContextQuestion"
      },
      "QueryType": {
        "type": "string",
        "enum": [
          "graph",
          "traces_list",
          "traces_list_with_reference_traces"
        ],
        "title": "QueryType"
      },
      "RelationType": {
        "type": "string",
        "enum": [
          "is_related",
          "mentions",
          "is_mentioned_by",
          "is_parent",
          "has_parent",
          "contributes_to",
          "connected_within_use_case",
          "auto_referenced_in_text_editor",
          "auto_referenced_in_process_modeller",
          "auto_based_on_template",
          "auto_document_part_of_submission",
          "auto_submission_contains_document",
          "auto_based_on_schema",
          "auto_schema_for",
          "auto_referenced_by_domain_object",
          "auto_referenced_global_element",
          "auto_referenced_product_data_collection",
          "auto_referenced_external_file",
          "auto_referenced_domain_object_contains_external_file",
          "auto_based_on_submission_template",
          "auto_template_part_of_submission_template",
          "auto_submission_template_contains_template"
        ],
        "title": "RelationType"
      },
      "RequirementUseCase": {
        "type": "string",
        "enum": [
          "user_requirements",
          "system_requirements",
          "verification",
          "validation",
          "requirements",
          "design_input",
          "design_output"
        ],
        "title": "RequirementUseCase"
      },
      "ResolveNodesRequest": {
        "properties": {
          "node_identifiers": {
            "items": {
              "type": "string"
            },
            "type": "array",
            "title": "Node Identifiers",
            "default": []
          },
          "include_data": {
            "type": "boolean",
            "title": "Include Data",
            "default": false
          },
          "with_linked_entities": {
            "type": "boolean",
            "title": "With Linked Entities",
            "default": false
          },
          "linked_entity_filters": {
            "anyOf": [
              {
                "additionalProperties": {
                  "items": {
                    "type": "string"
                  },
                  "type": "array"
                },
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Linked Entity Filters",
            "description": "When with_linked_entities is True: maps each node identifier to allowed linked_* groups (e.g. linked_documents, linked_global_element_entries). None means resolve requested nodes only — no hop-1 trace targets are loaded."
          }
        },
        "type": "object",
        "title": "ResolveNodesRequest",
        "description": "Request body for POST /node/resolve (node_identifiers may be empty)."
      },
      "ResolvedNodeEntity": {
        "properties": {
          "entity_id": {
            "type": "string",
            "title": "Entity Id",
            "description": "the id of the entity. in case of versioned entites, this is the parent id"
          },
          "entity_type": {
            "$ref": "#/components/schemas/NodeType"
          },
          "name": {
            "type": "string",
            "title": "Name"
          },
          "entity_version": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Entity Version",
            "default": ""
          },
          "additional_data": {
            "anyOf": [
              {
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Additional Data"
          },
          "versions": {
            "anyOf": [
              {
                "items": {
                  "$ref": "#/components/schemas/VersionData"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Versions"
          }
        },
        "type": "object",
        "required": [
          "entity_id",
          "entity_type",
          "name"
        ],
        "title": "ResolvedNodeEntity"
      },
      "ResolvedNodeEntityWithLinkedEntities": {
        "properties": {
          "entity": {
            "$ref": "#/components/schemas/ResolvedNodeEntity"
          },
          "linked_sops": {
            "items": {
              "$ref": "#/components/schemas/ResolvedNodeEntity"
            },
            "type": "array",
            "title": "Linked Sops",
            "default": []
          },
          "linked_work_instructions": {
            "items": {
              "$ref": "#/components/schemas/ResolvedNodeEntity"
            },
            "type": "array",
            "title": "Linked Work Instructions",
            "default": []
          },
          "linked_products": {
            "items": {
              "$ref": "#/components/schemas/ResolvedNodeEntity"
            },
            "type": "array",
            "title": "Linked Products",
            "default": []
          },
          "linked_files": {
            "items": {
              "$ref": "#/components/schemas/ResolvedNodeEntity"
            },
            "type": "array",
            "title": "Linked Files",
            "default": []
          },
          "linked_documents": {
            "items": {
              "$ref": "#/components/schemas/ResolvedNodeEntity"
            },
            "type": "array",
            "title": "Linked Documents",
            "default": []
          },
          "linked_forms": {
            "items": {
              "$ref": "#/components/schemas/ResolvedNodeEntity"
            },
            "type": "array",
            "title": "Linked Forms",
            "default": []
          },
          "linked_knowledge_topics": {
            "items": {
              "$ref": "#/components/schemas/ResolvedNodeEntity"
            },
            "type": "array",
            "title": "Linked Knowledge Topics",
            "default": []
          },
          "linked_knowledge_units": {
            "items": {
              "$ref": "#/components/schemas/ResolvedNodeEntity"
            },
            "type": "array",
            "title": "Linked Knowledge Units",
            "default": []
          },
          "linked_templates": {
            "items": {
              "$ref": "#/components/schemas/ResolvedNodeEntity"
            },
            "type": "array",
            "title": "Linked Templates",
            "default": []
          },
          "linked_submissions": {
            "items": {
              "$ref": "#/components/schemas/ResolvedNodeEntity"
            },
            "type": "array",
            "title": "Linked Submissions",
            "default": []
          },
          "linked_records": {
            "items": {
              "$ref": "#/components/schemas/ResolvedNodeEntity"
            },
            "type": "array",
            "title": "Linked Records",
            "default": []
          },
          "linked_global_elements": {
            "items": {
              "$ref": "#/components/schemas/ResolvedNodeEntity"
            },
            "type": "array",
            "title": "Linked Global Elements",
            "default": []
          },
          "linked_global_element_entries": {
            "items": {
              "$ref": "#/components/schemas/ResolvedNodeEntity"
            },
            "type": "array",
            "title": "Linked Global Element Entries",
            "default": []
          }
        },
        "type": "object",
        "required": [
          "entity"
        ],
        "title": "ResolvedNodeEntityWithLinkedEntities",
        "description": "Resolved entity plus optional linked entities (traces resolved and grouped by type)."
      },
      "ResolvedTrace": {
        "properties": {
          "trace_id": {
            "anyOf": [
              {
                "type": "string",
                "example": "5eb7cf5a86d9755df3a6c593"
              },
              {
                "type": "null"
              }
            ],
            "title": "Trace Id"
          },
          "relation_type": {
            "type": "string",
            "title": "Relation Type"
          },
          "resolved_source": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/ResolvedNodeEntity"
              },
              {
                "type": "null"
              }
            ]
          },
          "resolved_target": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/ResolvedNodeEntity"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "type": "object",
        "required": [
          "trace_id",
          "relation_type",
          "resolved_source",
          "resolved_target"
        ],
        "title": "ResolvedTrace"
      },
      "TenantMetadata": {
        "properties": {
          "tenant_id": {
            "type": "string",
            "title": "Tenant Id"
          }
        },
        "type": "object",
        "required": [
          "tenant_id"
        ],
        "title": "TenantMetadata"
      },
      "TraceCreate": {
        "properties": {
          "source": {
            "type": "string",
            "title": "Source"
          },
          "sourceType": {
            "$ref": "#/components/schemas/NodeType"
          },
          "sourceVersion": {
            "type": "string",
            "title": "Sourceversion"
          },
          "target": {
            "type": "string",
            "title": "Target"
          },
          "targetType": {
            "$ref": "#/components/schemas/NodeType"
          },
          "targetVersion": {
            "type": "string",
            "title": "Targetversion"
          },
          "relation_type": {
            "$ref": "#/components/schemas/RelationType",
            "default": "is_related"
          },
          "create_bidirectional": {
            "type": "boolean",
            "title": "Create Bidirectional",
            "default": false
          },
          "backward_relation_type": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/RelationType"
              },
              {
                "type": "null"
              }
            ]
          },
          "origin": {
            "$ref": "#/components/schemas/TraceOrigin",
            "default": "manual"
          },
          "automatic_source": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/AutomaticTraceSource"
              },
              {
                "type": "null"
              }
            ]
          },
          "manual_source": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/ManualTraceSource"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "type": "object",
        "required": [
          "source",
          "sourceType",
          "sourceVersion",
          "target",
          "targetType",
          "targetVersion"
        ],
        "title": "TraceCreate"
      },
      "TraceDelete": {
        "properties": {
          "source": {
            "type": "string",
            "title": "Source"
          },
          "sourceType": {
            "$ref": "#/components/schemas/NodeType"
          },
          "sourceVersion": {
            "type": "string",
            "title": "Sourceversion"
          },
          "target": {
            "type": "string",
            "title": "Target"
          },
          "targetType": {
            "$ref": "#/components/schemas/NodeType"
          },
          "targetVersion": {
            "type": "string",
            "title": "Targetversion"
          },
          "relation_type": {
            "$ref": "#/components/schemas/RelationType",
            "default": "is_related"
          },
          "delete_backward": {
            "type": "boolean",
            "title": "Delete Backward",
            "default": false
          },
          "backward_relation_type": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/RelationType"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "type": "object",
        "required": [
          "source",
          "sourceType",
          "sourceVersion",
          "target",
          "targetType",
          "targetVersion"
        ],
        "title": "TraceDelete"
      },
      "TraceList": {
        "properties": {
          "traces": {
            "items": {
              "$ref": "#/components/schemas/TraceResponse"
            },
            "type": "array",
            "title": "Traces"
          }
        },
        "type": "object",
        "required": [
          "traces"
        ],
        "title": "TraceList"
      },
      "TraceMetadata": {
        "properties": {
          "origin": {
            "$ref": "#/components/schemas/TraceOrigin",
            "default": "manual"
          },
          "automatic_source": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/AutomaticTraceSource"
              },
              {
                "type": "null"
              }
            ]
          },
          "manual_source": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/ManualTraceSource"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "type": "object",
        "title": "TraceMetadata",
        "description": "Additional metadata for traces, including origin information"
      },
      "TraceOrigin": {
        "type": "string",
        "enum": [
          "manual",
          "automatic"
        ],
        "title": "TraceOrigin"
      },
      "TraceResponse": {
        "properties": {
          "id": {
            "type": "string",
            "title": "Id",
            "example": "5eb7cf5a86d9755df3a6c593"
          },
          "source": {
            "type": "string",
            "title": "Source"
          },
          "target": {
            "type": "string",
            "title": "Target"
          },
          "relation_type": {
            "$ref": "#/components/schemas/RelationType"
          },
          "source_node": {
            "$ref": "#/components/schemas/Node"
          },
          "target_node": {
            "$ref": "#/components/schemas/Node"
          },
          "trace_id": {
            "type": "string",
            "title": "Trace Id",
            "example": "5eb7cf5a86d9755df3a6c593"
          },
          "tenant_metadata": {
            "$ref": "#/components/schemas/TenantMetadata"
          },
          "audit_info": {
            "$ref": "#/components/schemas/AuditInfo"
          },
          "outdated": {
            "type": "boolean",
            "title": "Outdated",
            "default": false
          },
          "trace_metadata": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/TraceMetadata"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "type": "object",
        "required": [
          "id",
          "source",
          "target",
          "relation_type",
          "source_node",
          "target_node",
          "trace_id",
          "tenant_metadata",
          "audit_info"
        ],
        "title": "TraceResponse"
      },
      "TraceabilityMatrixRequest": {
        "properties": {
          "matrix_type": {
            "$ref": "#/components/schemas/MatrixType"
          },
          "records": {
            "additionalProperties": {
              "$ref": "#/components/schemas/UseCaseRecord-Input"
            },
            "type": "object",
            "title": "Records",
            "description": "Dictionary mapping record_id to record"
          }
        },
        "type": "object",
        "required": [
          "matrix_type",
          "records"
        ],
        "title": "TraceabilityMatrixRequest"
      },
      "TraceabilityMatrixResponse": {
        "properties": {
          "matrix": {
            "items": {
              "additionalProperties": {
                "items": {
                  "$ref": "#/components/schemas/UseCaseRecord-Output"
                },
                "type": "array"
              },
              "type": "object"
            },
            "type": "array",
            "title": "Matrix",
            "description": "Dictionary mapping record_id to list of connected node IDs"
          }
        },
        "type": "object",
        "required": [
          "matrix"
        ],
        "title": "TraceabilityMatrixResponse"
      },
      "UseCaseRecord-Input": {
        "properties": {
          "record_id": {
            "type": "string",
            "title": "Record Id"
          },
          "related_use_case_topic": {
            "$ref": "#/components/schemas/RequirementUseCase"
          },
          "name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Name"
          },
          "description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Description"
          },
          "previous_use_case_record": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/UseCaseRecord-Input"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "type": "object",
        "required": [
          "record_id",
          "related_use_case_topic"
        ],
        "title": "UseCaseRecord"
      },
      "UseCaseRecord-Output": {
        "properties": {
          "record_id": {
            "type": "string",
            "title": "Record Id"
          },
          "related_use_case_topic": {
            "$ref": "#/components/schemas/RequirementUseCase"
          },
          "name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Name"
          },
          "description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Description"
          },
          "previous_use_case_record": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/UseCaseRecord-Output"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "type": "object",
        "required": [
          "record_id",
          "related_use_case_topic"
        ],
        "title": "UseCaseRecord"
      },
      "ValidationError": {
        "properties": {
          "loc": {
            "items": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "integer"
                }
              ]
            },
            "type": "array",
            "title": "Location"
          },
          "msg": {
            "type": "string",
            "title": "Message"
          },
          "type": {
            "type": "string",
            "title": "Error Type"
          }
        },
        "type": "object",
        "required": [
          "loc",
          "msg",
          "type"
        ],
        "title": "ValidationError"
      },
      "VersionData": {
        "properties": {
          "version": {
            "type": "string",
            "title": "Version"
          },
          "revision_id": {
            "type": "string",
            "title": "Revision Id",
            "description": "the id of each revision"
          },
          "commit_message": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Commit Message"
          },
          "is_latest_approved": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Is Latest Approved"
          }
        },
        "type": "object",
        "required": [
          "version",
          "revision_id",
          "commit_message",
          "is_latest_approved"
        ],
        "title": "VersionData"
      }
    },
    "securitySchemes": {
      "ApiKeyAuth": {
        "type": "apiKey",
        "in": "header",
        "name": "X-API-Key"
      }
    }
  },
  "security": [
    {
      "ApiKeyAuth": []
    }
  ]
}
