{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://civitasconnect.digital/core-dataset/v1",
  "title": "CORE DataSet",
  "description": "A CORE DataSet manifest: the envelope of a dataset and its member artifacts referenced by versioned CORE URN (data structures, mappings, pipelines, data sources, data sinks). The backend composes it from the DataSet entity and its relations; the members themselves are separate CORE artifacts. This is the stored manifest form — member content is not inlined here.",
  "type": "object",
  "required": ["$schema", "id"],
  "additionalProperties": false,
  "properties": {
    "$schema": {
      "type": "string",
      "const": "https://civitasconnect.digital/core-dataset/v1"
    },
    "id": {
      "type": "string",
      "description": "CORE URN of this DataSet (logical, or with a trailing :version).",
      "pattern": "^urn:core:[^:]+:[^:]+:dataset:[^:]+:[^:]+:[^:]+(:[^:]+)?$"
    },
    "title": { "type": "string" },
    "description": { "type": "string" },
    "version": { "type": "string" },
    "datastructureRefs": {
      "description": "Versioned CORE URNs of the DataStructures used in this dataset.",
      "type": "array",
      "items": {
        "type": "string",
        "pattern": "^urn:core:[^:]+:[^:]+:datastructure:[^:]+:[^:]+:[^:]+(:[^:]+)?$",
        "x-core-ref": { "type": "urn:core:type:DataStructure" }
      }
    },
    "mappingRefs": {
      "description": "Versioned CORE URNs of the Mappings used in this dataset.",
      "type": "array",
      "items": {
        "type": "string",
        "pattern": "^urn:core:[^:]+:[^:]+:mapping:[^:]+:[^:]+:[^:]+(:[^:]+)?$",
        "x-core-ref": { "type": "urn:core:type:Mapping" }
      }
    },
    "pipelineRefs": {
      "description": "Versioned CORE URNs of the Pipelines in this dataset.",
      "type": "array",
      "items": {
        "type": "string",
        "pattern": "^urn:core:[^:]+:[^:]+:pipeline:[^:]+:[^:]+:[^:]+(:[^:]+)?$",
        "x-core-ref": { "type": "urn:core:type:Pipeline" }
      }
    },
    "dataSourceRefs": {
      "description": "Versioned CORE URNs of the DataSource configurations in this dataset.",
      "type": "array",
      "items": {
        "type": "string",
        "pattern": "^urn:core:[^:]+:[^:]+:datasource:[^:]+:[^:]+:[^:]+(:[^:]+)?$",
        "x-core-ref": { "type": "urn:core:type:DataSource" }
      }
    },
    "dataSinkRefs": {
      "description": "Versioned CORE URNs of the DataSink configurations in this dataset.",
      "type": "array",
      "items": {
        "type": "string",
        "pattern": "^urn:core:[^:]+:[^:]+:datasink:[^:]+:[^:]+:[^:]+(:[^:]+)?$",
        "x-core-ref": { "type": "urn:core:type:DataSink" }
      }
    }
  }
}
