{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://upstand.work/schemas/career-record/v1.1.json",
  "title": "Upstand Career Record 1.1",
  "description": "Portable professional claims, provenance and evidence. This document is not itself a secured Verifiable Credential.",
  "type": "object",
  "additionalProperties": false,
  "required": ["$schema", "schema_version", "canonical_uri", "interoperability", "person", "claims", "experiences", "evidence", "generated_at"],
  "properties": {
    "$schema": { "const": "https://upstand.work/schemas/career-record/v1.1.json" },
    "schema_version": { "const": "career-record@1.1" },
    "canonical_uri": { "type": "string", "format": "uri" },
    "interoperability": {
      "type": "object",
      "additionalProperties": false,
      "required": ["conforms_to", "mappings", "notes"],
      "properties": {
        "conforms_to": { "type": "array", "items": { "type": "string", "format": "uri" }, "minItems": 1, "uniqueItems": true },
        "mappings": { "type": "object", "additionalProperties": { "type": "string", "format": "uri" } },
        "notes": { "type": "string" }
      }
    },
    "person": { "$ref": "#/$defs/person" },
    "claims": { "type": "array", "items": { "$ref": "#/$defs/claim" } },
    "experiences": { "type": "array", "items": { "$ref": "#/$defs/experience" } },
    "evidence": { "type": "array", "items": { "$ref": "#/$defs/evidence" } },
    "generated_at": { "type": "string", "format": "date-time" }
  },
  "$defs": {
    "nullableString": { "type": ["string", "null"] },
    "person": {
      "type": "object",
      "additionalProperties": false,
      "required": ["name", "headline", "summary", "profession_group", "languages"],
      "properties": {
        "name": { "type": "string", "minLength": 1 },
        "headline": { "$ref": "#/$defs/nullableString" },
        "summary": { "$ref": "#/$defs/nullableString" },
        "profession_group": { "$ref": "#/$defs/nullableString" },
        "languages": { "type": "array", "items": { "type": "string" }, "uniqueItems": true }
      }
    },
    "claim": {
      "type": "object",
      "additionalProperties": false,
      "required": ["id", "type", "stable_uri", "statement", "confidence", "source", "valid_from", "valid_until", "evidence_refs", "semantic_identifiers"],
      "properties": {
        "id": { "type": "string", "format": "uuid" },
        "type": { "enum": ["identity", "role", "project", "skill", "outcome", "availability", "preference"] },
        "stable_uri": { "type": "string" },
        "statement": { "type": "string", "minLength": 1 },
        "confidence": { "enum": ["self_asserted", "imported", "documented", "externally_confirmed"] },
        "source": { "$ref": "#/$defs/nullableString" },
        "valid_from": { "type": ["string", "null"], "format": "date" },
        "valid_until": { "type": ["string", "null"], "format": "date" },
        "evidence_refs": { "type": "array", "items": { "type": "string" }, "uniqueItems": true },
        "semantic_identifiers": { "type": "array", "items": { "$ref": "#/$defs/semanticIdentifier" } }
      }
    },
    "semanticIdentifier": {
      "type": "object",
      "additionalProperties": false,
      "required": ["scheme", "uri"],
      "properties": { "scheme": { "enum": ["ESCO", "other"] }, "uri": { "type": "string", "format": "uri" } }
    },
    "experience": {
      "type": "object",
      "required": ["id", "stable_uri", "company", "role", "start_date"],
      "properties": {
        "id": { "type": "string", "format": "uuid" }, "stable_uri": { "type": "string" },
        "company": { "type": "string" },
        "company_logo_url": { "type": ["string", "null"], "format": "uri", "pattern": "^https://" },
        "role": { "type": "string" },
        "start_date": { "type": "string", "format": "date" }, "end_date": { "type": ["string", "null"], "format": "date" }
      }
    },
    "evidence": {
      "type": "object",
      "additionalProperties": false,
      "required": ["id", "type", "stable_uri", "claim_ref", "experience_ref", "statement", "url", "issuer", "issued_at"],
      "properties": {
        "id": { "type": "string", "format": "uuid" },
        "type": { "enum": ["verification", "document", "url", "credential", "reference"] },
        "stable_uri": { "type": "string" },
        "claim_ref": { "type": ["string", "null"], "format": "uuid" },
        "experience_ref": { "type": ["string", "null"], "format": "uuid" },
        "statement": { "$ref": "#/$defs/nullableString" },
        "url": { "type": ["string", "null"], "format": "uri" },
        "issuer": { "type": "object", "additionalProperties": false, "properties": { "name": { "type": "string" } } },
        "issued_at": { "type": ["string", "null"], "format": "date" }
      }
    }
  }
}
