{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://www.gynaehub.com/schemas/charter-manifest.json",
  "title": "GynaeHub Charter Manifest Schema",
  "description": "JSON Schema describing the clinical charts, posters, and standardized performa forms available on GynaeHub aligned with Punjab Healthcare Commission (PHC) Minimum Service Delivery Standards (MSDS) and WHO guidelines.",
  "type": "object",
  "required": ["$schema", "name", "organization", "standards", "charters"],
  "properties": {
    "$schema": {
      "type": "string"
    },
    "name": {
      "type": "string",
      "example": "GynaeHub Clinical Charters and Performa Toolkit"
    },
    "organization": {
      "type": "object",
      "required": ["name", "url", "country"],
      "properties": {
        "name": { "type": "string" },
        "url": { "type": "string", "format": "uri" },
        "country": { "type": "string" }
      }
    },
    "standards": {
      "type": "array",
      "items": { "type": "string" },
      "example": [
        "Punjab Healthcare Commission (PHC) MSDS for Category I/II/III Facilities",
        "WHO Safe Motherhood & Intrapartum Care Guidelines",
        "Pakistan Nursing and Midwifery Council (PN&MC) Scope of Practice"
      ]
    },
    "charters": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/charterItem"
      }
    }
  },
  "$defs": {
    "charterItem": {
      "type": "object",
      "required": ["id", "code", "title", "titleUrdu", "category", "clinicalPurpose", "targetUsers", "schemaUrl"],
      "properties": {
        "id": {
          "type": "string",
          "example": "partograph"
        },
        "code": {
          "type": "string",
          "example": "FORM-PART-01"
        },
        "title": {
          "type": "string",
          "example": "WHO Modified Partograph (Labor Progress Chart)"
        },
        "titleUrdu": {
          "type": "string",
          "example": "ڈبلیو ایچ او موڈیفائیڈ پارٹوگراف فارم"
        },
        "category": {
          "type": "string",
          "enum": ["chart", "form"]
        },
        "msdsReference": {
          "type": "string",
          "example": "PHC MSDS Indicator 26 (Intrapartum Monitoring)"
        },
        "clinicalPurpose": {
          "type": "string"
        },
        "targetUsers": {
          "type": "array",
          "items": { "type": "string" }
        },
        "schemaUrl": {
          "type": "string",
          "format": "uri"
        }
      }
    }
  }
}
