{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://storylibrary.torahlearningtools.com/schemas/recording-1.json",
  "title": "Goldstein Story Archive: one public recording record",
  "type": "object",
  "required": [
    "id",
    "title",
    "summary_short",
    "duration_sec",
    "media",
    "classification",
    "audience",
    "subjects",
    "segments",
    "relations",
    "language",
    "transcript"
  ],
  "properties": {
    "id": {
      "type": "string",
      "pattern": "^[0-9a-f]{10}$",
      "description": "Stable id; never reused"
    },
    "slug": {
      "type": "string"
    },
    "title": {
      "type": "string"
    },
    "title_he": {
      "type": "string"
    },
    "title_translit": {
      "type": "string"
    },
    "summary_short": {
      "type": "string",
      "description": "AI-written from the recording"
    },
    "summary_long": {
      "type": "string",
      "description": "AI-written from the recording"
    },
    "lesson": {
      "type": [
        "string",
        "null"
      ]
    },
    "keywords": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "duration_sec": {
      "type": "number"
    },
    "content_start_sec": {
      "type": "number",
      "description": "Where the content starts in the file (the audio is never edited)"
    },
    "content_end_sec": {
      "type": "number",
      "description": "Where the content ends; later is blank tape"
    },
    "media": {
      "type": "object",
      "properties": {
        "url": {
          "type": "string",
          "format": "uri"
        },
        "size_bytes": {
          "type": "integer"
        },
        "mime_type": {
          "const": "audio/mpeg"
        }
      }
    },
    "classification": {
      "type": "object",
      "properties": {
        "content_type": {
          "type": "string"
        },
        "story_type": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "series": {
          "type": [
            "string",
            "null"
          ]
        },
        "speakers": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "standalone": {
          "enum": [
            "standalone",
            "needs_context",
            "cliffhanger",
            "teaser",
            "fragment"
          ]
        },
        "episode": {
          "type": "object",
          "properties": {
            "number": {
              "type": "integer"
            },
            "is_clip": {
              "type": "boolean"
            }
          }
        },
        "date": {
          "type": "object",
          "properties": {
            "gregorian": {
              "type": [
                "string",
                "null"
              ]
            },
            "hebrew": {
              "type": [
                "string",
                "null"
              ]
            },
            "hebrew_year": {
              "type": [
                "integer",
                "null"
              ]
            },
            "precision": {
              "enum": [
                "day",
                "week",
                "month",
                "year",
                "decade",
                "unknown"
              ]
            },
            "basis": {
              "type": "string"
            },
            "note": {
              "type": "string"
            }
          }
        },
        "serial": {
          "type": "object"
        },
        "part": {
          "type": "object"
        },
        "study_text": {
          "type": "array"
        },
        "collections": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      }
    },
    "audience": {
      "type": "object",
      "properties": {
        "level": {
          "type": "string"
        },
        "age_min": {
          "type": "integer"
        },
        "advisories": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "flag": {
                "type": "string"
              },
              "severity": {
                "enum": [
                  "mild",
                  "moderate",
                  "strong"
                ]
              },
              "note": {
                "type": "string"
              },
              "at_sec": {
                "type": "number"
              }
            }
          }
        }
      }
    },
    "subjects": {
      "type": "object",
      "properties": {
        "people": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "role": {
                "enum": [
                  "central",
                  "appears",
                  "mentioned",
                  "teaching_cited"
                ]
              }
            }
          }
        },
        "characters": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "topics": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "midos": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "mitzvos": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "calendar": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "parshiyos": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "places": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "sources_cited": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "work": {
                "type": "string"
              },
              "ref": {
                "type": "string"
              },
              "note": {
                "type": "string"
              }
            }
          }
        }
      }
    },
    "segments": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "start_sec": {
            "type": "number"
          },
          "end_sec": {
            "type": "number"
          },
          "type": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "summary": {
            "type": "string"
          }
        }
      }
    },
    "relations": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string"
          },
          "target_id": {
            "type": "string"
          },
          "confidence": {
            "type": "number"
          },
          "offset_sec": {
            "type": "number"
          }
        }
      }
    },
    "language": {
      "type": "object",
      "properties": {
        "primary": {
          "enum": [
            "en",
            "yi",
            "he"
          ]
        },
        "spoken": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "transcript_language": {
          "enum": [
            "en",
            "yi"
          ]
        }
      }
    },
    "transcript": {
      "type": "object",
      "properties": {
        "display": {
          "enum": [
            "show_with_label",
            "search_only",
            "none"
          ]
        },
        "masked_lines": {
          "type": "integer"
        }
      }
    },
    "derived": {
      "type": "object"
    }
  }
}