{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://psym.pl/led-course/learner-state.schema.json",
  "title": "Power LED drivers \u2014 current, light and heat learner state v1",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "schema_version",
    "course_id",
    "course_version",
    "updated_at",
    "current_chapter",
    "goal",
    "chapters",
    "gates"
  ],
  "properties": {
    "schema_version": {
      "const": 1
    },
    "course_id": {
      "const": "power-led-drivers"
    },
    "course_version": {
      "const": "1.0.0"
    },
    "updated_at": {
      "type": "string",
      "format": "date-time"
    },
    "current_chapter": {
      "type": "string",
      "pattern": "^(ch00|ch01|ch02|ch03|ch04|ch05|ch06|ch07|ch08|ch09|ch10|ch11|ch12|ch13|ch14|ch15|ch16|ch17|ch18|ch19|ch20|ch21|ch22)$"
    },
    "goal": {
      "type": "string",
      "maxLength": 20000
    },
    "chapters": {
      "type": "object",
      "additionalProperties": false,
      "patternProperties": {
        "^(ch00|ch01|ch02|ch03|ch04|ch05|ch06|ch07|ch08|ch09|ch10|ch11|ch12|ch13|ch14|ch15|ch16|ch17|ch18|ch19|ch20|ch21|ch22)$": {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "notes",
            "completed",
            "status"
          ],
          "properties": {
            "notes": {
              "type": "string",
              "maxLength": 100000
            },
            "completed": {
              "type": "boolean"
            },
            "status": {
              "enum": [
                "not_started",
                "attempted",
                "reviewed",
                "evidence_available"
              ]
            }
          }
        }
      }
    },
    "gates": {
      "type": "object",
      "additionalProperties": false,
      "patternProperties": {
        "^G[0-7]$": {
          "enum": [
            "open",
            "in_progress",
            "evidence_ready",
            "reviewed_with_evidence"
          ]
        }
      }
    }
  }
}
