{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://apx-standard.org/schemas/registry.schema.json",
  "title": "APX code-list registry document",
  "description": "An APX registry file is an APDS UserDefinedCodeList instance (PkCommon/CodeLists) published with the standard.",
  "type": "object",
  "required": ["id", "version", "creator", "locator", "userDefinedCodeListEntries"],
  "properties": {
    "id": { "type": "string", "format": "uuid" },
    "version": { "type": "integer", "minimum": 1 },
    "name": { "type": "string", "pattern": "^apx-[a-z0-9-]+$" },
    "creator": {
      "type": "object",
      "required": ["id", "className"],
      "properties": {
        "id": { "type": "string" },
        "version": { "type": "integer", "minimum": 1 },
        "className": { "type": "string" }
      }
    },
    "locator": { "type": "string", "format": "uri" },
    "includeNilReasonType": { "type": "boolean" },
    "userDefinedCodeListEntries": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "object",
        "required": ["definedValue", "entryDescription", "entryIndex"],
        "properties": {
          "id": { "type": "string", "format": "uuid" },
          "definedValue": { "type": "string", "minLength": 1 },
          "entryDescription": { "type": "string", "minLength": 1 },
          "entryIndex": { "type": "integer", "minimum": 0 }
        },
        "additionalProperties": false
      }
    }
  },
  "additionalProperties": false
}
