76 lines
2.7 KiB
JSON
76 lines
2.7 KiB
JSON
|
|
{
|
||
|
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||
|
|
"$id": "https://baodan.example/schemas/plan-data-snapshot-v1.json",
|
||
|
|
"title": "Insurance PlanData Snapshot v1",
|
||
|
|
"type": "object",
|
||
|
|
"additionalProperties": false,
|
||
|
|
"required": ["schemaVersion", "snapshotVersion", "status", "document", "planData", "validation", "snapshotHash"],
|
||
|
|
"properties": {
|
||
|
|
"schemaVersion": {"const": "plan-data-v1"},
|
||
|
|
"snapshotVersion": {"type": "integer", "minimum": 1},
|
||
|
|
"previousSnapshotId": {"type": ["integer", "null"], "minimum": 1},
|
||
|
|
"status": {"enum": ["draft", "review_required", "confirmed", "superseded", "invalid"]},
|
||
|
|
"document": {
|
||
|
|
"type": "object",
|
||
|
|
"additionalProperties": false,
|
||
|
|
"required": ["documentId", "sha256"],
|
||
|
|
"properties": {
|
||
|
|
"documentId": {"type": "integer", "minimum": 1},
|
||
|
|
"sha256": {"type": "string", "pattern": "^[0-9a-f]{64}$"}
|
||
|
|
}
|
||
|
|
},
|
||
|
|
"planData": {
|
||
|
|
"type": "object",
|
||
|
|
"additionalProperties": false,
|
||
|
|
"required": ["identity", "policy", "benefitScenarios", "assumptions"],
|
||
|
|
"properties": {
|
||
|
|
"identity": {"type": "object", "additionalProperties": {"$ref": "field-value.schema.json"}},
|
||
|
|
"policy": {"type": "object", "additionalProperties": {"$ref": "field-value.schema.json"}},
|
||
|
|
"benefitScenarios": {
|
||
|
|
"type": "array",
|
||
|
|
"items": {
|
||
|
|
"type": "object",
|
||
|
|
"required": ["scenarioType", "rows"],
|
||
|
|
"properties": {
|
||
|
|
"scenarioType": {"type": "string"},
|
||
|
|
"rows": {"type": "array", "items": {"type": "object"}}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
},
|
||
|
|
"withdrawals": {"type": "array", "items": {"type": "object"}},
|
||
|
|
"riders": {"type": "array", "items": {"type": "object"}},
|
||
|
|
"assumptions": {"type": "object"}
|
||
|
|
}
|
||
|
|
},
|
||
|
|
"validation": {
|
||
|
|
"type": "object",
|
||
|
|
"required": ["blockingCount", "warningCount", "conflictCount"],
|
||
|
|
"properties": {
|
||
|
|
"blockingCount": {"type": "integer", "minimum": 0},
|
||
|
|
"warningCount": {"type": "integer", "minimum": 0},
|
||
|
|
"conflictCount": {"type": "integer", "minimum": 0},
|
||
|
|
"issues": {"type": "array", "items": {"type": "object"}}
|
||
|
|
}
|
||
|
|
},
|
||
|
|
"snapshotHash": {"type": "string", "pattern": "^[0-9a-f]{64}$"},
|
||
|
|
"confirmedBy": {"type": ["string", "null"]},
|
||
|
|
"confirmedAt": {"type": ["string", "null"], "format": "date-time"}
|
||
|
|
},
|
||
|
|
"allOf": [
|
||
|
|
{
|
||
|
|
"if": {"properties": {"status": {"const": "confirmed"}}},
|
||
|
|
"then": {
|
||
|
|
"required": ["confirmedBy", "confirmedAt"],
|
||
|
|
"properties": {
|
||
|
|
"validation": {
|
||
|
|
"properties": {
|
||
|
|
"blockingCount": {"const": 0},
|
||
|
|
"conflictCount": {"const": 0}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
]
|
||
|
|
}
|