{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://speakupminutes.parset.in/schema.json",
  "title": "SpeakUp Minutes meeting library",
  "type": "object",
  "required": [
    "version",
    "meetings"
  ],
  "properties": {
    "$schema": {
      "type": "string"
    },
    "version": {
      "const": 1
    },
    "meetings": {
      "type": "array",
      "minItems": 1,
      "maxItems": 200,
      "items": {
        "$ref": "#/$defs/meeting"
      }
    }
  },
  "additionalProperties": false,
  "$defs": {
    "person": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string",
          "maxLength": 180
        },
        "title": {
          "type": "string",
          "maxLength": 500
        }
      },
      "required": [
        "name",
        "title"
      ],
      "additionalProperties": false
    },
    "role": {
      "type": "object",
      "properties": {
        "role": {
          "type": "string",
          "maxLength": 180
        },
        "name": {
          "type": "string",
          "maxLength": 180
        }
      },
      "required": [
        "role",
        "name"
      ],
      "additionalProperties": false
    },
    "award": {
      "type": "object",
      "properties": {
        "award": {
          "type": "string",
          "maxLength": 180
        },
        "name": {
          "type": "string",
          "maxLength": 180
        }
      },
      "required": [
        "award",
        "name"
      ],
      "additionalProperties": false
    },
    "photo": {
      "type": "object",
      "properties": {
        "dataUrl": {
          "type": "string",
          "pattern": "^data:image/(jpeg|png|webp);base64,"
        },
        "caption": {
          "type": "string",
          "maxLength": 1000
        }
      },
      "required": [
        "dataUrl",
        "caption"
      ],
      "additionalProperties": false
    },
    "meeting": {
      "type": "object",
      "required": [
        "id",
        "status",
        "club",
        "theme",
        "date"
      ],
      "properties": {
        "id": {
          "type": "string",
          "maxLength": 100
        },
        "status": {
          "enum": [
            "sample",
            "draft",
            "ready"
          ]
        },
        "club": {
          "type": "string",
          "maxLength": 180
        },
        "meetingNumber": {
          "type": "string",
          "maxLength": 50
        },
        "theme": {
          "type": "string",
          "maxLength": 500
        },
        "date": {
          "type": "string",
          "pattern": "^(|[0-9]{4}-[0-9]{2}-[0-9]{2})$"
        },
        "venue": {
          "type": "string",
          "maxLength": 500
        },
        "intro": {
          "type": "string",
          "maxLength": 6000
        },
        "highlights": {
          "type": "array",
          "maxItems": 200,
          "items": {
            "type": "string",
            "maxLength": 6000
          }
        },
        "speakers": {
          "type": "array",
          "maxItems": 200,
          "items": {
            "$ref": "#/$defs/person"
          }
        },
        "roles": {
          "type": "array",
          "maxItems": 200,
          "items": {
            "$ref": "#/$defs/role"
          }
        },
        "awards": {
          "type": "array",
          "maxItems": 200,
          "items": {
            "$ref": "#/$defs/award"
          }
        },
        "nextMeeting": {
          "type": "object",
          "properties": {
            "date": {
              "type": "string",
              "pattern": "^(|[0-9]{4}-[0-9]{2}-[0-9]{2})$"
            },
            "details": {
              "type": "string",
              "maxLength": 6000
            }
          },
          "additionalProperties": false
        },
        "photos": {
          "type": "array",
          "maxItems": 20,
          "items": {
            "$ref": "#/$defs/photo"
          }
        },
        "caption": {
          "type": "string",
          "maxLength": 30000
        },
        "sourceNotes": {
          "type": "string",
          "maxLength": 30000
        },
        "sections": {
          "type": "array",
          "maxItems": 200,
          "items": {
            "type": "object",
            "properties": {
              "title": {
                "type": "string",
                "maxLength": 500
              },
              "body": {
                "type": "string",
                "maxLength": 6000
              }
            },
            "required": [
              "title",
              "body"
            ],
            "additionalProperties": false
          }
        },
        "reflections": {
          "type": "string",
          "maxLength": 6000
        }
      },
      "additionalProperties": false
    }
  }
}
