{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/3gppscout-com/json-schema/3gppscout-com-proposal-comparison-response-schema.json",
  "title": "ProposalComparisonResponse",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/3gppscout-com-analysis-api-openapi.yml#/components/schemas/ProposalComparisonResponse",
  "properties": {
    "comparison_id": {
      "type": "string",
      "title": "Comparison Id"
    },
    "status": {
      "type": "string",
      "title": "Status",
      "description": "'complete', 'running' (poll get_proposal_comparison after poll_after_seconds) or 'failed'."
    },
    "poll_after_seconds": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "title": "Poll After Seconds"
    },
    "seconds_elapsed": {
      "type": "number",
      "title": "Seconds Elapsed"
    },
    "restarted": {
      "anyOf": [
        {
          "type": "boolean"
        },
        {
          "type": "null"
        }
      ],
      "title": "Restarted",
      "description": "True when Scout restarted during the run and the comparison started again; the result is still complete."
    },
    "message": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Message"
    },
    "result": {
      "anyOf": [
        {
          "$ref": "#/$defs/ComparisonResult"
        },
        {
          "type": "null"
        }
      ]
    }
  },
  "type": "object",
  "required": [
    "comparison_id",
    "status",
    "seconds_elapsed"
  ],
  "$defs": {
    "ClauseMatch": {
      "properties": {
        "doc_number": {
          "type": "string",
          "title": "Doc Number"
        },
        "doc_type": {
          "type": "string",
          "title": "Doc Type",
          "default": "TS"
        },
        "version": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Version"
        },
        "release": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Release"
        },
        "section_number": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Section Number"
        },
        "section_title": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Section Title"
        },
        "relevance_score": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "title": "Relevance Score",
          "description": "Reranker score of the clause for this proposal's searches, as on /search/text."
        },
        "also_in": {
          "anyOf": [
            {
              "items": {
                "additionalProperties": true,
                "type": "object"
              },
              "type": "array"
            },
            {
              "type": "null"
            }
          ],
          "title": "Also In",
          "description": "Other indexed releases and versions with the same section, as on /search/text."
        },
        "latest_version": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Latest Version"
        },
        "latest_release": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Latest Release"
        },
        "provenance": {
          "anyOf": [
            {
              "additionalProperties": true,
              "type": "object"
            },
            {
              "type": "null"
            }
          ],
          "title": "Provenance",
          "description": "When this version was uploaded to the 3GPP archive and the TSG plenary it came from, as on /search/text."
        },
        "quote": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Quote",
          "description": "Verbatim excerpt of the clause that corresponds to the element."
        },
        "quote_withheld": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Quote Withheld",
          "description": "Why no quote is shown: 'not_verbatim' (the proposed quote is not in the clause text), 'excerpt_cap' (the response reached its excerpt limit) or 'wording'."
        },
        "normative_status": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Normative Status",
          "description": "'mandatory (shall)', 'recommended (should)', 'optional (may)' or 'descriptive', from the quoted text's own wording."
        },
        "capability_conditional": {
          "anyOf": [
            {
              "type": "boolean"
            },
            {
              "type": "null"
            }
          ],
          "title": "Capability Conditional",
          "description": "The quoted text applies only when a capability or feature is supported."
        },
        "rating": {
          "type": "string",
          "title": "Rating",
          "description": "'high', 'medium', 'low' or 'none'."
        },
        "rating_label": {
          "type": "string",
          "title": "Rating Label"
        },
        "note": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Note",
          "description": "One sentence on how the clause relates to the element and what differs."
        },
        "citation": {
          "type": "string",
          "title": "Citation",
          "description": "Attribution line to show with the quote."
        },
        "official_url": {
          "type": "string",
          "title": "Official Url"
        }
      },
      "type": "object",
      "required": [
        "doc_number",
        "rating",
        "rating_label",
        "citation",
        "official_url"
      ],
      "title": "ClauseMatch"
    },
    "ComparisonResult": {
      "properties": {
        "input_kind": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Input Kind",
          "description": "'structured_statement', 'requirements_list' or 'prose'."
        },
        "elements": {
          "items": {
            "$ref": "#/$defs/ProposalElement"
          },
          "type": "array",
          "title": "Elements"
        },
        "terminology": {
          "items": {
            "$ref": "#/$defs/TermBridge"
          },
          "type": "array",
          "title": "Terminology"
        },
        "overall": {
          "$ref": "#/$defs/Overall"
        },
        "ranked_clauses": {
          "items": {
            "additionalProperties": true,
            "type": "object"
          },
          "type": "array",
          "title": "Ranked Clauses",
          "description": "Up to 10 clauses, most central first."
        },
        "scope": {
          "additionalProperties": true,
          "type": "object",
          "title": "Scope",
          "description": "Releases, document types and filters searched."
        },
        "method": {
          "additionalProperties": true,
          "type": "object",
          "title": "Method"
        },
        "notice": {
          "type": "string",
          "title": "Notice"
        }
      },
      "type": "object",
      "required": [
        "elements",
        "terminology",
        "overall",
        "ranked_clauses",
        "scope",
        "method",
        "notice"
      ],
      "title": "ComparisonResult"
    },
    "Overall": {
      "properties": {
        "rating": {
          "type": "string",
          "title": "Rating"
        },
        "rating_label": {
          "type": "string",
          "title": "Rating Label"
        },
        "elements_with_candidates": {
          "type": "integer",
          "title": "Elements With Candidates"
        },
        "substantive_elements": {
          "type": "integer",
          "title": "Substantive Elements"
        },
        "summary": {
          "type": "string",
          "title": "Summary"
        },
        "uncertainty": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "title": "Uncertainty"
        }
      },
      "type": "object",
      "required": [
        "rating",
        "rating_label",
        "elements_with_candidates",
        "substantive_elements",
        "summary",
        "uncertainty"
      ],
      "title": "Overall"
    },
    "ProposalElement": {
      "properties": {
        "id": {
          "type": "string",
          "title": "Id",
          "description": "Stable element ID, e.g. '1pre' for the preamble, then '1a', '1b'."
        },
        "text": {
          "type": "string",
          "title": "Text",
          "description": "The element, copied verbatim from the proposal."
        },
        "is_preamble": {
          "type": "boolean",
          "title": "Is Preamble"
        },
        "is_generic": {
          "type": "boolean",
          "title": "Is Generic",
          "description": "A bare hardware element (processor, memory) that specifications do not define."
        },
        "standard_query": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Standard Query",
          "description": "The element restated in 3GPP vocabulary, as searched."
        },
        "rating": {
          "type": "string",
          "title": "Rating",
          "description": "Best clause rating: 'high', 'medium', 'low', 'none', or 'generic'."
        },
        "rating_label": {
          "type": "string",
          "title": "Rating Label"
        },
        "coverage": {
          "type": "string",
          "title": "Coverage",
          "description": "'Disclosed (express)', 'Disclosed (interpretive)', 'Partial', 'Not applicable (generic hardware)' or 'Not found (searched: ...)'."
        },
        "searched": {
          "anyOf": [
            {
              "items": {
                "type": "string"
              },
              "type": "array"
            },
            {
              "type": "null"
            }
          ],
          "title": "Searched",
          "description": "For elements without a clause worth a closer look: what was searched."
        },
        "matches": {
          "items": {
            "$ref": "#/$defs/ClauseMatch"
          },
          "type": "array",
          "title": "Matches"
        }
      },
      "type": "object",
      "required": [
        "id",
        "text",
        "is_preamble",
        "is_generic",
        "rating",
        "rating_label",
        "coverage",
        "matches"
      ],
      "title": "ProposalElement"
    },
    "TermBridge": {
      "properties": {
        "proposal_term": {
          "type": "string",
          "title": "Proposal Term"
        },
        "standard_term": {
          "type": "string",
          "title": "Standard Term"
        },
        "element_ids": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "title": "Element Ids"
        },
        "defined_in": {
          "anyOf": [
            {
              "additionalProperties": true,
              "type": "object"
            },
            {
              "type": "null"
            }
          ],
          "title": "Defined In",
          "description": "A retrieved clause that defines or normatively uses the 3GPP term."
        },
        "note": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Note"
        }
      },
      "type": "object",
      "required": [
        "proposal_term",
        "standard_term",
        "element_ids"
      ],
      "title": "TermBridge"
    }
  }
}