{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/peoplescourt-ai/json-schema/peoplescourt-ai-narrow-evaluation-resource-schema.json",
  "title": "NarrowEvaluationResource",
  "x-generated": "2026-11-21",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/peoplescourt-ai-evaluation-api-openapi.yml#/components/schemas/NarrowEvaluationResource",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "schemaVersion",
    "caseId",
    "externalCaseId",
    "externalEvaluationId",
    "evaluationDigest",
    "question",
    "allowedOutcomes",
    "evidencePolicy",
    "reviewPolicy",
    "record",
    "result"
  ],
  "properties": {
    "schemaVersion": {
      "type": "string",
      "const": "narrow-evaluation-resource-v2"
    },
    "caseId": {
      "type": "string"
    },
    "externalCaseId": {
      "type": "string"
    },
    "externalEvaluationId": {
      "type": "string"
    },
    "evaluationDigest": {
      "type": "string",
      "pattern": "^[a-f0-9]{64}$"
    },
    "question": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "text",
        "criteria"
      ],
      "properties": {
        "text": {
          "type": "string"
        },
        "criteria": {
          "type": "array",
          "minItems": 1,
          "maxItems": 20,
          "items": {
            "$ref": "#/$defs/NarrowEvaluationCriterion"
          }
        }
      }
    },
    "allowedOutcomes": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/NarrowEvaluationOutcome"
      }
    },
    "evidencePolicy": {
      "$ref": "#/$defs/NarrowEvaluationEvidencePolicy"
    },
    "reviewPolicy": {
      "$ref": "#/$defs/NarrowEvaluationReviewPolicy"
    },
    "record": {
      "$ref": "#/$defs/NarrowEvaluationRecord"
    },
    "result": {
      "oneOf": [
        {
          "$ref": "#/$defs/NarrowEvaluationPendingResult"
        },
        {
          "$ref": "#/$defs/NarrowEvaluationServedResult"
        }
      ]
    }
  },
  "$defs": {
    "NarrowEvaluationAwardReference": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "dispositionId",
        "awardHash",
        "resourcePath"
      ],
      "properties": {
        "dispositionId": {
          "type": "string"
        },
        "awardHash": {
          "type": "string",
          "pattern": "^[a-f0-9]{64}$"
        },
        "releasedAt": {
          "type": "string",
          "format": "date-time"
        },
        "resourcePath": {
          "type": "string"
        }
      }
    },
    "NarrowEvaluationCriterion": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "id",
        "text"
      ],
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^[a-z][a-z0-9_]{0,63}$"
        },
        "text": {
          "type": "string",
          "minLength": 1,
          "maxLength": 1000
        }
      }
    },
    "NarrowEvaluationCriterionFinding": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "criterionId",
        "status",
        "finding",
        "confidence"
      ],
      "properties": {
        "criterionId": {
          "type": "string",
          "pattern": "^[a-z][a-z0-9_]{0,63}$"
        },
        "status": {
          "type": "string",
          "enum": [
            "satisfied",
            "not_satisfied",
            "indeterminate"
          ]
        },
        "finding": {
          "type": "string"
        },
        "confidence": {
          "type": "number",
          "minimum": 0,
          "maximum": 1
        }
      }
    },
    "NarrowEvaluationEvidencePolicy": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "sources",
        "additionalPartyEvidence"
      ],
      "properties": {
        "sources": {
          "type": "array",
          "minItems": 1,
          "maxItems": 2,
          "uniqueItems": true,
          "items": {
            "type": "string",
            "enum": [
              "party_submissions",
              "evidence_export_candidates"
            ]
          }
        },
        "additionalPartyEvidence": {
          "type": "boolean",
          "const": true
        }
      }
    },
    "NarrowEvaluationOutcome": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "code",
        "settlementAction"
      ],
      "properties": {
        "code": {
          "type": "string",
          "pattern": "^[a-z][a-z0-9_]{0,63}$"
        },
        "label": {
          "type": "string",
          "minLength": 1,
          "maxLength": 200
        },
        "settlementAction": {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "type"
          ],
          "properties": {
            "type": {
              "type": "string",
              "enum": [
                "release_to_claimant",
                "release_to_respondent",
                "allocate_by_award",
                "none"
              ]
            }
          }
        }
      }
    },
    "NarrowEvaluationPendingResult": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "status",
        "finality"
      ],
      "properties": {
        "status": {
          "type": "string",
          "enum": [
            "pending",
            "under_review"
          ]
        },
        "finality": {
          "type": "string",
          "const": "not_served"
        }
      }
    },
    "NarrowEvaluationRecord": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "status"
      ],
      "properties": {
        "phase": {
          "type": "string",
          "enum": [
            "evidence",
            "close",
            "merits"
          ]
        },
        "status": {
          "type": "string",
          "enum": [
            "open",
            "frozen"
          ]
        }
      }
    },
    "NarrowEvaluationReviewPolicy": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "initialPath",
        "humanReviewRequired"
      ],
      "properties": {
        "initialPath": {
          "type": "string",
          "const": "adjudicative"
        },
        "humanReviewRequired": {
          "type": "boolean",
          "const": false
        }
      }
    },
    "NarrowEvaluationServedResult": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "status",
        "finality",
        "outcomeCode",
        "settlementAction",
        "criterionFindings",
        "determinations",
        "award"
      ],
      "properties": {
        "status": {
          "type": "string",
          "const": "served"
        },
        "finality": {
          "type": "string",
          "enum": [
            "served",
            "appealable",
            "appeal_reserved",
            "appeal_pending",
            "final"
          ]
        },
        "outcomeCode": {
          "type": "string"
        },
        "settlementAction": {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "type"
          ],
          "properties": {
            "type": {
              "type": "string",
              "enum": [
                "release_to_claimant",
                "release_to_respondent",
                "allocate_by_award",
                "none"
              ]
            }
          }
        },
        "criterionFindings": {
          "type": "array",
          "minItems": 1,
          "maxItems": 20,
          "items": {
            "$ref": "#/$defs/NarrowEvaluationCriterionFinding"
          }
        },
        "determinations": {
          "type": "object",
          "additionalProperties": true
        },
        "award": {
          "$ref": "#/$defs/NarrowEvaluationAwardReference"
        }
      }
    }
  }
}