{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://responsibilityinfrastructure.com/reference/responsibility-record.schema.json",
  "title": "Responsibility Record Reference Schema",
  "description": "Non-normative reference schema illustrating the four mandatory sections defined by RI-004: Identity, State, Proof, and Outcome. The issued publications remain the normative source.",
  "type": "object",
  "required": [
    "recordId",
    "schemaVersion",
    "normativeReferences",
    "identity",
    "state",
    "proof",
    "outcome"
  ],
  "properties": {
    "recordId": {
      "type": "string",
      "minLength": 1
    },
    "schemaVersion": {
      "type": "string",
      "const": "0.1-reference"
    },
    "normativeReferences": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "string"
      }
    },
    "identity": {
      "type": "object",
      "required": ["responsibilityId", "responsibility", "holder", "scope", "capturedAt"],
      "properties": {
        "responsibilityId": {
          "type": "string"
        },
        "responsibility": {
          "type": "string"
        },
        "holder": {
          "type": "object",
          "required": ["id", "name", "type"],
          "properties": {
            "id": {
              "type": "string"
            },
            "name": {
              "type": "string"
            },
            "type": {
              "type": "string",
              "enum": ["person", "role", "system", "organisation", "authority"]
            }
          },
          "additionalProperties": true
        },
        "scope": {
          "type": "string"
        },
        "capturedAt": {
          "type": "string",
          "format": "date-time"
        },
        "authority": {
          "type": "string"
        },
        "boundaries": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      },
      "additionalProperties": true
    },
    "state": {
      "type": "object",
      "required": ["current", "history"],
      "properties": {
        "current": {
          "type": "string"
        },
        "history": {
          "type": "array",
          "minItems": 1,
          "items": {
            "type": "object",
            "required": ["stage", "state", "recordedAt", "recordedBy"],
            "properties": {
              "stage": {
                "type": "string"
              },
              "state": {
                "type": "string"
              },
              "recordedAt": {
                "type": "string",
                "format": "date-time"
              },
              "recordedBy": {
                "type": "string"
              },
              "note": {
                "type": "string"
              }
            },
            "additionalProperties": true
          }
        }
      },
      "additionalProperties": true
    },
    "proof": {
      "type": "object",
      "required": ["claims", "evidence", "verifications"],
      "properties": {
        "claims": {
          "type": "array",
          "items": {
            "type": "object",
            "required": ["id", "statement"],
            "properties": {
              "id": {
                "type": "string"
              },
              "statement": {
                "type": "string"
              },
              "evidenceRefs": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            },
            "additionalProperties": true
          }
        },
        "evidence": {
          "type": "array",
          "items": {
            "type": "object",
            "required": ["id", "type", "source", "createdAt"],
            "properties": {
              "id": {
                "type": "string"
              },
              "type": {
                "type": "string"
              },
              "source": {
                "type": "string"
              },
              "uri": {
                "type": "string"
              },
              "createdAt": {
                "type": "string",
                "format": "date-time"
              },
              "integrityMethod": {
                "type": "string"
              },
              "limitations": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            },
            "additionalProperties": true
          }
        },
        "verifications": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "id",
              "claimId",
              "verifier",
              "criteria",
              "determination",
              "verifiedAt"
            ],
            "properties": {
              "id": {
                "type": "string"
              },
              "claimId": {
                "type": "string"
              },
              "verifier": {
                "type": "string"
              },
              "criteria": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "determination": {
                "type": "string"
              },
              "verifiedAt": {
                "type": "string",
                "format": "date-time"
              },
              "limitations": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "reasons": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            },
            "additionalProperties": true
          }
        }
      },
      "additionalProperties": true
    },
    "outcome": {
      "type": "object",
      "required": ["status", "recordedAt", "recordedBy"],
      "properties": {
        "status": {
          "type": "string"
        },
        "recordedAt": {
          "type": "string",
          "format": "date-time"
        },
        "recordedBy": {
          "type": "string"
        },
        "recognitionDecisionRef": {
          "type": "string"
        },
        "registryEntryRef": {
          "type": "string"
        },
        "receiptRef": {
          "type": "string"
        },
        "limitations": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      },
      "additionalProperties": true
    }
  },
  "additionalProperties": true
}
