{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://edu.daven.ai/schemas/activity-submission/v1",
  "title": "ActivitySubmissionEnvelope",
  "description": "Student work submitted from an education app to Classroom Hub (LMS). Distinct from developer Playground mcp-app submissions.",
  "type": "object",
  "additionalProperties": false,
  "required": ["title", "primaryUrl", "assets"],
  "properties": {
    "title": {
      "type": "string",
      "minLength": 1,
      "maxLength": 200,
      "description": "Teacher list title (one line)"
    },
    "summary": {
      "type": "string",
      "maxLength": 2000,
      "description": "Optional preview text for teacher list"
    },
    "primaryUrl": {
      "type": "string",
      "format": "uri",
      "description": "HTTPS URL the teacher opens first (page, image, or PDF). No localhost/blob."
    },
    "assets": {
      "type": "array",
      "minItems": 1,
      "items": { "$ref": "#/$defs/SubmissionAsset" }
    },
    "attachments": {
      "type": "array",
      "description": "Optional archive/print files. Prefer URLs in assets for normal review.",
      "items": { "$ref": "#/$defs/SubmissionAttachment" }
    },
    "meta": {
      "type": "object",
      "additionalProperties": true,
      "description": "App-specific fields (score, poem text id, etc.). LMS may ignore for UI."
    }
  },
  "$defs": {
    "SubmissionAsset": {
      "type": "object",
      "additionalProperties": false,
      "required": ["role", "url"],
      "properties": {
        "role": {
          "type": "string",
          "enum": ["cover", "image", "audio", "video", "page", "file", "other"]
        },
        "url": { "type": "string", "format": "uri" },
        "mimeType": { "type": "string", "maxLength": 128 },
        "label": { "type": "string", "maxLength": 120 }
      }
    },
    "SubmissionAttachment": {
      "type": "object",
      "additionalProperties": false,
      "required": ["url", "filename"],
      "properties": {
        "url": { "type": "string", "format": "uri" },
        "filename": { "type": "string", "maxLength": 255 },
        "bytes": { "type": "integer", "minimum": 0 },
        "mimeType": { "type": "string", "maxLength": 128 }
      }
    }
  }
}
