{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/myleadtech-app/json-schema/myleadtech-app-answer-out-schema.json",
  "title": "AnswerOut",
  "x-generated": "2026-11-18",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/myleadtech-app-openapi.json#/components/schemas/AnswerOut",
  "properties": {
    "request_id": {
      "type": "string",
      "title": "Request Id"
    },
    "contract_version": {
      "type": "string",
      "title": "Contract Version",
      "default": "ar-00/1"
    },
    "service_revision": {
      "type": "string",
      "title": "Service Revision"
    },
    "publication": {
      "$ref": "#/$defs/Publication"
    },
    "status": {
      "type": "string",
      "title": "Status"
    },
    "partial": {
      "type": "boolean",
      "title": "Partial",
      "default": false
    },
    "missing": {
      "items": {
        "type": "string"
      },
      "type": "array",
      "title": "Missing"
    },
    "degraded": {
      "items": {
        "type": "string"
      },
      "type": "array",
      "title": "Degraded"
    },
    "usage": {
      "$ref": "#/$defs/CatalogUsage"
    },
    "notice": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Notice"
    },
    "answer": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Answer"
    },
    "claims": {
      "items": {
        "$ref": "#/$defs/Claim"
      },
      "type": "array",
      "title": "Claims"
    },
    "limits": {
      "items": {
        "type": "string"
      },
      "type": "array",
      "title": "Limits"
    },
    "passages": {
      "items": {
        "$ref": "#/$defs/Passage"
      },
      "type": "array",
      "title": "Passages"
    },
    "clarification": {
      "anyOf": [
        {
          "$ref": "#/$defs/Clarification"
        },
        {
          "type": "null"
        }
      ]
    },
    "next_action": {
      "anyOf": [
        {
          "type": "string",
          "enum": [
            "answer",
            "ask_clarification",
            "abstain",
            "escalate_to_human"
          ]
        },
        {
          "type": "null"
        }
      ],
      "title": "Next Action"
    },
    "next_action_reason": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Next Action Reason"
    },
    "summary": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Summary"
    },
    "summary_source_ids": {
      "items": {
        "type": "string"
      },
      "type": "array",
      "title": "Summary Source Ids"
    },
    "requires_qualified_technician": {
      "type": "boolean",
      "title": "Requires Qualified Technician",
      "default": false
    }
  },
  "type": "object",
  "required": [
    "request_id",
    "service_revision",
    "publication",
    "status",
    "usage"
  ],
  "$defs": {
    "Boite": {
      "properties": {
        "x0": {
          "type": "number",
          "title": "X0"
        },
        "y0": {
          "type": "number",
          "title": "Y0"
        },
        "x1": {
          "type": "number",
          "title": "X1"
        },
        "y1": {
          "type": "number",
          "title": "Y1"
        }
      },
      "type": "object",
      "required": [
        "x0",
        "y0",
        "x1",
        "y1"
      ],
      "title": "Boite"
    },
    "CatalogUsage": {
      "properties": {
        "operation": {
          "type": "string",
          "title": "Operation"
        },
        "debited": {
          "type": "boolean",
          "title": "Debited"
        },
        "units": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "title": "Units"
        },
        "remaining": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "title": "Remaining"
        },
        "window_end": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Window End"
        }
      },
      "type": "object",
      "required": [
        "operation",
        "debited"
      ],
      "title": "CatalogUsage"
    },
    "Citation": {
      "properties": {
        "citation_window_id": {
          "type": "string",
          "title": "Citation Window Id"
        },
        "page_number": {
          "type": "integer",
          "title": "Page Number"
        },
        "box": {
          "anyOf": [
            {
              "$ref": "#/$defs/Boite"
            },
            {
              "type": "null"
            }
          ]
        },
        "page_actions": {
          "$ref": "#/$defs/PageActions"
        }
      },
      "type": "object",
      "required": [
        "citation_window_id",
        "page_number",
        "page_actions"
      ],
      "title": "Citation"
    },
    "Claim": {
      "properties": {
        "text": {
          "type": "string",
          "title": "Text"
        },
        "source_id": {
          "type": "string",
          "title": "Source Id"
        },
        "page_number": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "title": "Page Number"
        },
        "document_title": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Document Title"
        },
        "citation_window_id": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Citation Window Id"
        }
      },
      "type": "object",
      "required": [
        "text",
        "source_id"
      ],
      "title": "Claim"
    },
    "Clarification": {
      "properties": {
        "question": {
          "type": "string",
          "title": "Question"
        },
        "options": {
          "anyOf": [
            {
              "items": {
                "type": "string"
              },
              "type": "array"
            },
            {
              "type": "null"
            }
          ],
          "title": "Options"
        },
        "field": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Field"
        },
        "reason_code": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Reason Code"
        },
        "choices": {
          "anyOf": [
            {
              "items": {
                "$ref": "#/$defs/ClarificationChoice"
              },
              "type": "array",
              "maxItems": 5
            },
            {
              "type": "null"
            }
          ],
          "title": "Choices"
        }
      },
      "type": "object",
      "required": [
        "question"
      ],
      "title": "Clarification"
    },
    "ClarificationChoice": {
      "properties": {
        "id": {
          "type": "string",
          "title": "Id"
        },
        "label": {
          "type": "string",
          "title": "Label"
        }
      },
      "type": "object",
      "required": [
        "id",
        "label"
      ],
      "title": "ClarificationChoice"
    },
    "PageActions": {
      "properties": {
        "rest_path": {
          "type": "string",
          "title": "Rest Path"
        },
        "default_format": {
          "type": "string",
          "title": "Default Format",
          "default": "png"
        }
      },
      "type": "object",
      "required": [
        "rest_path"
      ],
      "title": "PageActions"
    },
    "Passage": {
      "properties": {
        "source_id": {
          "type": "string",
          "title": "Source Id"
        },
        "document_version_id": {
          "type": "string",
          "title": "Document Version Id"
        },
        "document_type": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Document Type"
        },
        "text": {
          "type": "string",
          "title": "Text"
        },
        "pages": {
          "items": {
            "type": "integer"
          },
          "type": "array",
          "title": "Pages"
        },
        "printed_label": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Printed Label"
        },
        "applicability": {
          "type": "string",
          "enum": [
            "established",
            "family_only",
            "unestablished"
          ],
          "title": "Applicability"
        },
        "citations": {
          "items": {
            "$ref": "#/$defs/Citation"
          },
          "type": "array",
          "title": "Citations"
        },
        "rank": {
          "type": "integer",
          "title": "Rank"
        },
        "context": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Context"
        },
        "truncated": {
          "type": "boolean",
          "title": "Truncated",
          "default": false
        },
        "truncation_reason": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Truncation Reason"
        }
      },
      "type": "object",
      "required": [
        "source_id",
        "document_version_id",
        "text",
        "applicability",
        "rank"
      ],
      "title": "Passage"
    },
    "Publication": {
      "properties": {
        "branch": {
          "type": "string",
          "title": "Branch"
        },
        "snapshot_ref": {
          "type": "string",
          "title": "Snapshot Ref"
        }
      },
      "type": "object",
      "required": [
        "branch",
        "snapshot_ref"
      ],
      "title": "Publication"
    }
  }
}