{ "$schema": "https://json-schema.org/draft/2020-12/schema", "$id": "https://github.com/LucioLiu/handoff-protocol/contracts/closure-receipt.schema.json", "title": "Closure receipt", "type": "object", "additionalProperties": false, "required": [ "handoff_id", "contract_id", "dispatch_id", "target", "status", "writer" ], "properties": { "handoff_id": {"type": "string", "minLength": 1}, "contract_id": {"type": "string", "minLength": 1}, "dispatch_id": {"type": "string", "minLength": 1}, "target": { "enum": ["employee_memory", "employee_worklog", "team_journal", "central_board"] }, "status": {"enum": ["updated", "proposed_for_parent", "not_applicable"]}, "writer": {"enum": ["recipient", "parent", "single_writer", "none"]}, "path": {"type": "string", "minLength": 1}, "reason": {"type": "string", "minLength": 1}, "evidence": { "type": "object", "additionalProperties": false, "required": ["kind", "value", "evidence_anchor"], "properties": { "kind": {"enum": ["content_anchor", "sha256", "provider_receipt", "proposal"]}, "value": {"type": "string", "minLength": 1}, "evidence_anchor": {"type": "string", "minLength": 1}, "exit_code": {"type": "integer"}, "event_id": {"type": "string", "minLength": 1}, "append_position": {"type": "integer", "minimum": 0}, "timestamp": {"type": "string", "format": "date-time"}, "provider": {"type": "object", "minProperties": 1} } } }, "allOf": [ { "if": { "properties": {"status": {"enum": ["updated", "proposed_for_parent"]}}, "required": ["status"] }, "then": {"required": ["path", "evidence"]} }, { "if": { "properties": {"status": {"const": "not_applicable"}}, "required": ["status"] }, "then": { "properties": {"writer": {"const": "none"}}, "required": ["reason"], "not": { "anyOf": [ {"required": ["path"]}, {"required": ["evidence"]} ] } } }, { "if": { "properties": { "target": { "enum": ["employee_memory", "employee_worklog"] }, "status": {"const": "updated"} }, "required": ["target", "status"] }, "then": { "properties": { "writer": {"const": "recipient"}, "evidence": { "properties": { "kind": {"enum": ["content_anchor", "sha256"]} } } } } }, { "if": { "properties": {"status": {"const": "proposed_for_parent"}}, "required": ["status"] }, "then": { "properties": { "target": {"const": "central_board"}, "writer": {"const": "recipient"}, "evidence": { "properties": {"kind": {"const": "proposal"}}, "required": ["kind", "value", "evidence_anchor"] } } } }, { "if": { "properties": { "target": {"const": "central_board"} }, "required": ["target"] }, "then": { "properties": { "status": {"enum": ["proposed_for_parent", "not_applicable"]} } } }, { "if": { "properties": { "target": {"const": "team_journal"}, "status": {"const": "updated"} }, "required": ["target", "status"] }, "then": { "properties": { "writer": {"const": "recipient"}, "evidence": { "properties": { "kind": {"const": "provider_receipt"}, "exit_code": {"const": 0} }, "required": [ "kind", "value", "evidence_anchor", "exit_code", "event_id", "append_position", "timestamp", "provider" ] } } } }, { "if": { "properties": { "evidence": { "properties": {"kind": {"const": "sha256"}}, "required": ["kind"] } }, "required": ["evidence"] }, "then": { "properties": { "evidence": { "properties": { "value": {"pattern": "^[a-f0-9]{64}$"} } } } } } ] }