{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://parentsvaccineguide.org/schemas/vaccine_pipeline.schema.json",
  "title": "Vaccine Development Pipeline Candidates",
  "description": "Candidate-level (not trial-level) vaccine R&D pipeline records. Group ClinicalTrials.gov trials under candidates; distinguish company-reported vs regulator-confirmed dates.",
  "type": "object",
  "required": ["_meta", "candidates"],
  "additionalProperties": false,
  "properties": {
    "_meta": {
      "type": "object",
      "required": ["description", "lastUpdated", "updateCadence"],
      "additionalProperties": true,
      "properties": {
        "description": { "type": "string" },
        "lastUpdated": { "type": "string" },
        "updateCadence": { "type": "string" },
        "schemaVersion": { "type": "string" }
      }
    },
    "candidates": {
      "type": "array",
      "minItems": 1,
      "items": { "$ref": "#/$defs/candidate" }
    }
  },
  "$defs": {
    "citation": {
      "type": "object",
      "required": ["label", "url"],
      "properties": {
        "label": { "type": "string" },
        "url": { "type": "string" },
        "date": { "type": "string" }
      }
    },
    "jurisdictionStatus": {
      "type": "object",
      "required": ["jurisdiction", "status"],
      "properties": {
        "jurisdiction": { "type": "string" },
        "status": { "type": "string" },
        "date": { "type": "string" },
        "dateType": {
          "type": "string",
          "enum": ["company_estimate", "regulator_confirmed", "unknown"],
          "description": "Distinguish company-reported dates from regulator-confirmed ones"
        },
        "notes": { "type": "string" }
      }
    },
    "trialSubEntry": {
      "type": "object",
      "required": ["trialName"],
      "properties": {
        "trialName": { "type": "string" },
        "nctId": { "type": "string" },
        "phase": { "type": "string" },
        "population": { "type": "string" },
        "comparator": { "type": "string" },
        "expectedReadout": { "type": "string" },
        "status": { "type": "string" }
      }
    },
    "candidate": {
      "type": "object",
      "required": [
        "candidateId",
        "name",
        "developer",
        "targetDisease",
        "platform",
        "currentStage",
        "expectedMilestone",
        "sourceType",
        "sourceCitation",
        "lastVerified"
      ],
      "properties": {
        "candidateId": { "type": "string" },
        "name": { "type": "string" },
        "developer": { "type": "string" },
        "targetDisease": { "type": "string" },
        "platform": { "type": "string" },
        "currentStage": {
          "type": "string",
          "enum": [
            "preclinical",
            "phase_1",
            "phase_2",
            "phase_3",
            "regulatory_submission_filed",
            "under_regulatory_review",
            "approved",
            "approved_restricted_or_suspended",
            "discontinued"
          ]
        },
        "jurisdictionStatus": {
          "type": "array",
          "items": { "$ref": "#/$defs/jurisdictionStatus" }
        },
        "linkedTrials": {
          "type": "array",
          "items": { "type": "string" },
          "description": "NCT IDs grouped under this candidate program"
        },
        "trialSubEntries": {
          "type": "array",
          "items": { "$ref": "#/$defs/trialSubEntry" }
        },
        "expectedMilestone": { "type": "string" },
        "sourceType": { "type": "string" },
        "sourceCitation": { "$ref": "#/$defs/citation" },
        "additionalCitations": {
          "type": "array",
          "items": { "$ref": "#/$defs/citation" }
        },
        "lastCompanyUpdate": { "type": "string" },
        "lastVerified": { "type": "string" },
        "note": { "type": "string" },
        "discontinuedReason": { "type": "string" },
        "stageAtDiscontinuation": { "type": "string" },
        "relatedVaccinePage": {
          "type": ["string", "null"],
          "description": "Existing site page slug e.g. influenza-vaccine.html when disease is covered"
        }
      }
    }
  }
}
