{ "$schema": "https://json-schema.org/draft/2020-12/schema", "$id": "https://baodan.example/schemas/field-value-v1.json", "title": "Insurance FieldValue v1", "type": "object", "additionalProperties": false, "required": ["status", "value", "evidence"], "properties": { "status": { "enum": ["missing", "extracted", "conflict", "confirmed", "derived"] }, "value": { "type": ["string", "number", "integer", "boolean", "null"] }, "currency": { "type": ["string", "null"], "enum": ["USD", "HKD", "CNY", "SGD", "EUR", "GBP", null] }, "unit": {"type": ["string", "null"]}, "confidence": {"type": ["number", "null"], "minimum": 0, "maximum": 1}, "evidence": { "type": "array", "items": {"$ref": "#/$defs/evidenceRef"} }, "derivedBy": {"type": ["string", "null"]}, "overrideReason": {"type": ["string", "null"], "minLength": 1}, "conflictCandidates": { "type": "array", "items": {"type": ["string", "number", "integer", "boolean", "null"]} } }, "allOf": [ { "if": {"properties": {"status": {"const": "missing"}}}, "then": {"properties": {"value": {"type": "null"}}} }, { "if": {"properties": {"status": {"const": "derived"}}}, "then": {"required": ["derivedBy"]} }, { "if": {"required": ["overrideReason"]}, "then": {"properties": {"status": {"const": "confirmed"}}} } ], "$defs": { "evidenceRef": { "type": "object", "additionalProperties": false, "required": ["documentId", "pageNumber"], "properties": { "documentId": {"type": "integer", "minimum": 1}, "pageNumber": {"type": "integer", "minimum": 1}, "bbox": { "type": ["array", "null"], "prefixItems": [ {"type": "number"}, {"type": "number"}, {"type": "number"}, {"type": "number"} ], "minItems": 4, "maxItems": 4 }, "tableId": {"type": ["string", "null"]}, "rowId": {"type": ["string", "null"]}, "columnId": {"type": ["string", "null"]}, "textHash": {"type": ["string", "null"], "pattern": "^[0-9a-f]{64}$"} } } } }