{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://vindicaseneca.com/assets/starter-kit/schemas/starter-record.schema.json",
  "title": "Seneca Starter Kit record view (0.1)",
  "description": "How the learner's Seneca record reads after Product A's evidence arrives, in the Starter Kit's teaching format. Illustrative; not Seneca's production contract.",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "format",
    "illustrative",
    "note",
    "learner",
    "observed",
    "attributed_judgments",
    "readings",
    "provenance",
    "scope",
    "limitations"
  ],
  "properties": {
    "format": {
      "const": "seneca-starter-record@0.1"
    },
    "illustrative": {
      "const": true
    },
    "note": {
      "type": "string"
    },
    "learner": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "ref",
        "authorizations"
      ],
      "properties": {
        "ref": {
          "type": "string",
          "pattern": "^lrn_[0-9a-f]{12}$"
        },
        "authorizations": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/authorization"
          }
        }
      }
    },
    "observed": {
      "type": "array",
      "minItems": 1,
      "items": {
        "$ref": "#/$defs/observed"
      }
    },
    "attributed_judgments": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/judgment"
      }
    },
    "readings": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/reading"
      }
    },
    "provenance": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "sources",
        "alignment",
        "pseudonyms"
      ],
      "properties": {
        "sources": {
          "type": "array",
          "minItems": 1,
          "items": {
            "$ref": "#/$defs/source"
          }
        },
        "alignment": {
          "type": "string"
        },
        "pseudonyms": {
          "type": "string"
        }
      }
    },
    "scope": {
      "$ref": "#/$defs/scope"
    },
    "limitations": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "string"
      }
    }
  },
  "$defs": {
    "authorization": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "recipient",
        "purpose",
        "scope",
        "granted_at",
        "expires_at",
        "revocable"
      ],
      "properties": {
        "recipient": {
          "type": "string"
        },
        "purpose": {
          "type": "string"
        },
        "scope": {
          "type": "string"
        },
        "granted_at": {
          "type": "string",
          "format": "date-time"
        },
        "expires_at": {
          "type": "string",
          "format": "date-time"
        },
        "revocable": {
          "const": true
        }
      }
    },
    "counts": {
      "type": "object",
      "additionalProperties": {
        "type": "integer",
        "minimum": 0
      }
    },
    "observed": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "skill",
        "source",
        "items",
        "evidence_types",
        "assistance",
        "conditions",
        "window"
      ],
      "properties": {
        "skill": {
          "type": "string"
        },
        "local_code": {
          "type": "string"
        },
        "source": {
          "type": "string"
        },
        "items": {
          "type": "integer",
          "minimum": 0
        },
        "outcomes": {
          "$ref": "#/$defs/counts"
        },
        "evidence_types": {
          "$ref": "#/$defs/counts"
        },
        "assistance": {
          "$ref": "#/$defs/counts"
        },
        "conditions": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "window": {
          "$ref": "#/$defs/window"
        }
      },
      "description": "For item-based evidence, skill is the skill and items the answered items. For writing, skill is the writing task and items the drafts submitted."
    },
    "judgment": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "attributed_to",
        "skill",
        "method",
        "seneca_rederived",
        "note"
      ],
      "properties": {
        "attributed_to": {
          "type": "string"
        },
        "skill": {
          "type": "string"
        },
        "claim": {
          "type": "string"
        },
        "method": {
          "type": "string"
        },
        "seneca_rederived": {
          "const": false
        },
        "note": {
          "type": "string"
        },
        "score": {
          "type": "string",
          "description": "For rubric scores, e.g. \"3/4 on draft 2\"."
        }
      }
    },
    "reading": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "skill",
        "statement",
        "kind",
        "confidence",
        "because"
      ],
      "properties": {
        "skill": {
          "type": "string"
        },
        "statement": {
          "type": "string"
        },
        "kind": {
          "const": "inferred by Seneca"
        },
        "confidence": {
          "enum": [
            "low",
            "moderate",
            "high"
          ]
        },
        "because": {
          "type": "array",
          "minItems": 1,
          "items": {
            "type": "string"
          }
        }
      }
    },
    "source": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "product",
        "product_kind",
        "product_version",
        "input_format",
        "transformed",
        "received_at",
        "observations"
      ],
      "properties": {
        "product": {
          "type": "string"
        },
        "product_kind": {
          "type": "string"
        },
        "product_version": {
          "type": [
            "string",
            "null"
          ]
        },
        "input_format": {
          "type": "string"
        },
        "transformed": {
          "type": "string"
        },
        "received_at": {
          "type": "string",
          "format": "date-time"
        },
        "observations": {
          "type": "integer",
          "minimum": 0
        },
        "withheld_at_source": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      }
    },
    "window": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "from",
        "to"
      ],
      "properties": {
        "from": {
          "type": "string",
          "format": "date-time"
        },
        "to": {
          "type": "string",
          "format": "date-time"
        }
      }
    },
    "scope": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "domain",
        "skills_covered",
        "not_measured",
        "window",
        "settings"
      ],
      "properties": {
        "domain": {
          "type": "string"
        },
        "skills_covered": {
          "type": "array",
          "minItems": 1,
          "items": {
            "type": "string"
          }
        },
        "not_measured": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "window": {
          "$ref": "#/$defs/window"
        },
        "settings": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      }
    }
  }
}
