{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://openworkplacehealth.org/profiles/profile-envelope.schema.json",
  "title": "OWHS profile envelope v0.2",
  "description": "A profile is a JSON Schema applied to the whole instance after the core schema. The envelope names the profile, its version and the exact core schemas it targets. A profile may narrow core requirements; it cannot make a core-invalid record valid, weaken P1-P5 or introduce top-level fields outside ext.",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "profile_id",
    "version",
    "core_schema_ids",
    "schema"
  ],
  "properties": {
    "profile_id": {
      "type": "string",
      "pattern": "^owhs-[a-z][a-z0-9]*(?:-[a-z0-9]+)*$",
      "maxLength": 64,
      "description": "The namespace key this profile owns under ext."
    },
    "version": {
      "type": "string",
      "pattern": "^\\d+\\.\\d+\\.\\d+$",
      "description": "Semantic version of the profile."
    },
    "core_schema_ids": {
      "type": "array",
      "minItems": 1,
      "uniqueItems": true,
      "items": {
        "type": "string",
        "format": "uri"
      },
      "description": "Exact $id values of the core schemas this profile applies to."
    },
    "schema": {
      "type": "object",
      "description": "A Draft 2020-12 schema applied to the whole instance."
    },
    "description": {
      "type": "string",
      "maxLength": 2000
    }
  }
}
