{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://capp.local/schemas/capp.data-record.v1.schema.json",
  "title": "cApp local-first data record v1",
  "type": "object",
  "required": [
    "protocol",
    "collection",
    "key",
    "revision",
    "baseRevision",
    "localRevision",
    "updatedAt",
    "syncState"
  ],
  "properties": {
    "protocol": {
      "const": "capp.data-record.v1"
    },
    "collection": {
      "type": "string"
    },
    "key": {
      "type": "string"
    },
    "value": {},
    "revision": {
      "type": "integer",
      "minimum": 0
    },
    "baseRevision": {
      "type": "integer",
      "minimum": 0
    },
    "localRevision": {
      "type": "integer",
      "minimum": 0
    },
    "contentHash": {
      "type": [
        "string",
        "null"
      ]
    },
    "deletedAt": {
      "type": [
        "string",
        "null"
      ]
    },
    "createdAt": {
      "type": "string"
    },
    "updatedAt": {
      "type": "string"
    },
    "syncState": {
      "enum": [
        "local",
        "pending",
        "synced",
        "conflict",
        "deleted"
      ]
    },
    "lastOperationId": {
      "type": [
        "string",
        "null"
      ]
    },
    "conflict": {},
    "metadata": {
      "type": "object"
    }
  },
  "additionalProperties": true
}
