{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://vindicaseneca.com/assets/starter-kit/schemas/starter-context.schema.json",
  "title": "Seneca Starter Kit context for Product B (0.1)",
  "description": "What an authorized Product B receives for one purpose, in the Starter Kit's teaching format. Illustrative; not Seneca's production contract. Product A's rows, item IDs and content are never part of it.",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "format",
    "illustrative",
    "request",
    "learner_ref",
    "generated_at",
    "context",
    "provenance",
    "scope",
    "limitations",
    "use",
    "not_included"
  ],
  "properties": {
    "format": {
      "const": "seneca-starter-context@0.1"
    },
    "illustrative": {
      "const": true
    },
    "request": {
      "$ref": "#/$defs/request"
    },
    "learner_ref": {
      "type": "string",
      "pattern": "^lrn_[0-9a-f]{12}$",
      "description": "A reference issued for this recipient only. It differs from the one Product A or any other product sees."
    },
    "generated_at": {
      "type": "string",
      "format": "date-time"
    },
    "context": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "observed",
        "attributed_judgments",
        "readings"
      ],
      "properties": {
        "observed": {
          "type": "array",
          "items": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "skill",
              "summary",
              "conditions"
            ],
            "properties": {
              "skill": {
                "type": "string"
              },
              "summary": {
                "type": "string"
              },
              "conditions": {
                "type": "string"
              }
            }
          }
        },
        "attributed_judgments": {
          "type": "array",
          "items": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "attributed_to",
              "skill",
              "claim"
            ],
            "properties": {
              "attributed_to": {
                "type": "string"
              },
              "skill": {
                "type": "string"
              },
              "claim": {
                "type": "string"
              }
            }
          }
        },
        "readings": {
          "type": "array",
          "items": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "skill",
              "statement",
              "confidence",
              "because"
            ],
            "properties": {
              "skill": {
                "type": "string"
              },
              "statement": {
                "type": "string"
              },
              "confidence": {
                "enum": [
                  "low",
                  "moderate",
                  "high"
                ]
              },
              "because": {
                "type": "string"
              }
            }
          }
        }
      }
    },
    "provenance": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "sources"
      ],
      "properties": {
        "sources": {
          "type": "array",
          "minItems": 1,
          "items": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "product",
              "product_kind",
              "input_format",
              "evidence_from",
              "evidence_to",
              "evidence_age_days"
            ],
            "properties": {
              "product": {
                "type": "string"
              },
              "product_kind": {
                "type": "string"
              },
              "input_format": {
                "type": "string"
              },
              "evidence_from": {
                "type": "string",
                "format": "date-time"
              },
              "evidence_to": {
                "type": "string",
                "format": "date-time"
              },
              "evidence_age_days": {
                "type": "integer",
                "minimum": 0
              }
            }
          }
        }
      }
    },
    "scope": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "covers",
        "not_measured"
      ],
      "properties": {
        "covers": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "not_measured": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      }
    },
    "limitations": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "string"
      }
    },
    "use": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "may_use_for",
        "do_not_infer"
      ],
      "properties": {
        "may_use_for": {
          "type": "array",
          "minItems": 1,
          "items": {
            "type": "string"
          }
        },
        "do_not_infer": {
          "type": "array",
          "minItems": 1,
          "items": {
            "type": "string"
          }
        }
      }
    },
    "not_included": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "string"
      }
    }
  },
  "$defs": {
    "request": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "recipient",
        "purpose",
        "scope",
        "authorization",
        "want"
      ],
      "properties": {
        "recipient": {
          "type": "string"
        },
        "purpose": {
          "type": "string"
        },
        "scope": {
          "type": "string"
        },
        "authorization": {
          "type": "string"
        },
        "want": {
          "type": "array",
          "minItems": 1,
          "items": {
            "enum": [
              "observed",
              "attributed_judgments",
              "readings",
              "limitations"
            ]
          }
        }
      }
    }
  }
}
