{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "urn:deutsch-learning-system:content:0.1.0",
  "title": "Modelo mínimo propuesto; no contrato aprobado",
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "schema_version": {
      "const": "0.1.0"
    },
    "sources": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/source"
      }
    },
    "competencies": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/competency"
      }
    },
    "concepts": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/concept"
      }
    },
    "lessons": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/lesson"
      }
    },
    "activities": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/activity"
      }
    },
    "resources": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/resource"
      }
    }
  },
  "required": [
    "schema_version",
    "sources",
    "competencies",
    "concepts",
    "lessons",
    "activities",
    "resources"
  ],
  "$defs": {
    "source": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "id": {
          "type": "string",
          "minLength": 1
        },
        "title": {
          "type": "string",
          "minLength": 1
        },
        "url": {
          "type": "string",
          "format": "uri"
        },
        "accessed_on": {
          "type": "string",
          "format": "date"
        }
      },
      "required": [
        "id",
        "title",
        "url",
        "accessed_on"
      ]
    },
    "competency": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "id": {
          "type": "string",
          "minLength": 1
        },
        "level": {
          "enum": [
            "A1",
            "A2",
            "B1",
            "B2"
          ]
        },
        "skill": {
          "enum": [
            "reading",
            "listening",
            "writing",
            "speaking",
            "interaction",
            "mediation"
          ]
        },
        "descriptor": {
          "type": "string",
          "minLength": 1
        },
        "source_refs": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1
          },
          "uniqueItems": true,
          "minItems": 1
        }
      },
      "required": [
        "id",
        "level",
        "skill",
        "descriptor",
        "source_refs"
      ]
    },
    "concept": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "id": {
          "type": "string",
          "minLength": 1
        },
        "name": {
          "type": "string",
          "minLength": 1
        },
        "definition": {
          "type": "string",
          "minLength": 1
        },
        "function": {
          "type": "string",
          "minLength": 1
        },
        "example_es": {
          "type": "string",
          "minLength": 1
        },
        "example_de": {
          "type": "string",
          "minLength": 1
        },
        "first_lesson": {
          "type": "string",
          "minLength": 1
        },
        "prerequisites": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1
          },
          "uniqueItems": true
        },
        "later_lessons": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1
          },
          "uniqueItems": true
        }
      },
      "required": [
        "id",
        "name",
        "definition",
        "function",
        "example_es",
        "first_lesson",
        "prerequisites",
        "later_lessons"
      ]
    },
    "activity": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "id": {
          "type": "string",
          "minLength": 1
        },
        "type": {
          "enum": [
            "closed",
            "open",
            "listening",
            "oral"
          ]
        },
        "prompt": {
          "type": "string",
          "minLength": 1
        },
        "competency_refs": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1
          },
          "uniqueItems": true,
          "minItems": 1
        },
        "concept_refs": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1
          },
          "uniqueItems": true
        },
        "answer": {
          "type": "string",
          "minLength": 1
        },
        "rubric": {
          "type": "string",
          "minLength": 1
        },
        "feedback": {
          "type": "string",
          "minLength": 1
        },
        "resource_refs": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1
          },
          "uniqueItems": true
        }
      },
      "required": [
        "id",
        "type",
        "prompt",
        "competency_refs",
        "concept_refs",
        "feedback",
        "resource_refs"
      ]
    },
    "resource": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "id": {
          "type": "string",
          "minLength": 1
        },
        "type": {
          "enum": [
            "audio",
            "image",
            "text"
          ]
        },
        "uri": {
          "type": "string",
          "minLength": 1
        },
        "transcript": {
          "type": "string",
          "minLength": 1
        },
        "provenance": {
          "type": "string",
          "minLength": 1
        },
        "license": {
          "type": "string",
          "minLength": 1
        },
        "review_status": {
          "enum": [
            "pending",
            "reviewed"
          ]
        }
      },
      "required": [
        "id",
        "type",
        "uri",
        "provenance",
        "license",
        "review_status"
      ]
    },
    "lesson": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "id": {
          "type": "string",
          "minLength": 1
        },
        "level": {
          "enum": [
            "A1",
            "A2",
            "B1",
            "B2"
          ]
        },
        "number": {
          "type": "integer",
          "minimum": 1,
          "maximum": 40
        },
        "status": {
          "enum": [
            "draft",
            "review",
            "approved",
            "published"
          ]
        },
        "duration_minutes": {
          "type": "integer",
          "minimum": 1
        },
        "objectives": {
          "type": "array",
          "minItems": 1,
          "items": {
            "type": "string",
            "minLength": 1
          }
        },
        "competency_refs": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1
          },
          "uniqueItems": true,
          "minItems": 1
        },
        "prerequisites": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1
          },
          "uniqueItems": true
        },
        "introduced_concepts": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1
          },
          "uniqueItems": true
        },
        "used_concepts": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1
          },
          "uniqueItems": true
        },
        "activity_refs": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1
          },
          "uniqueItems": true
        },
        "resource_refs": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1
          },
          "uniqueItems": true
        }
      },
      "required": [
        "id",
        "level",
        "number",
        "status",
        "duration_minutes",
        "objectives",
        "competency_refs",
        "prerequisites",
        "introduced_concepts",
        "used_concepts",
        "activity_refs",
        "resource_refs"
      ]
    }
  }
}
