{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "schema_version": {
      "type": "string",
      "const": "1.0.0"
    },
    "asset_id": {
      "type": "string",
      "pattern": "^(?:[a-z0-9]+(?:-[a-z0-9]+)*\\/){3}[a-z0-9]+(?:-[a-z0-9]+)*$"
    },
    "ontology_pins": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "artifact_id": {
            "type": "string",
            "minLength": 1
          },
          "version": {
            "type": "string",
            "pattern": "^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)$"
          }
        },
        "required": [
          "artifact_id",
          "version"
        ],
        "additionalProperties": false
      }
    },
    "columns": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1
          },
          "role": {
            "type": "string",
            "enum": [
              "dimension",
              "measure",
              "attribute",
              "time",
              "geography"
            ]
          },
          "binding": {
            "type": "object",
            "properties": {
              "represented_variable_id": {
                "type": "string",
                "minLength": 1
              },
              "value_scheme_id": {
                "type": "string",
                "minLength": 1
              },
              "value_scheme_version": {
                "type": "string",
                "pattern": "^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)$"
              }
            },
            "required": [
              "represented_variable_id",
              "value_scheme_id",
              "value_scheme_version"
            ],
            "additionalProperties": false
          },
          "join_key": {
            "type": "boolean"
          },
          "detection": {
            "type": "object",
            "properties": {
              "method": {
                "type": "string",
                "enum": [
                  "deterministic",
                  "curated"
                ]
              },
              "confidence": {
                "type": "number",
                "minimum": 0,
                "maximum": 1
              }
            },
            "required": [
              "method"
            ],
            "additionalProperties": false
          },
          "raw_detection": {
            "type": "object",
            "properties": {
              "name": {
                "type": "string",
                "minLength": 1
              },
              "role": {
                "type": "string",
                "enum": [
                  "dimension",
                  "measure",
                  "attribute",
                  "time",
                  "geography"
                ]
              },
              "kind_evidence": {
                "type": "array",
                "items": {
                  "type": "string",
                  "minLength": 1
                }
              },
              "confidence": {
                "type": "number",
                "minimum": 0,
                "maximum": 1
              },
              "sample_values": {
                "maxItems": 5,
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "join_key": {
                "type": "boolean"
              }
            },
            "required": [
              "name",
              "role",
              "kind_evidence",
              "confidence",
              "sample_values",
              "join_key"
            ],
            "additionalProperties": false
          },
          "override": {
            "type": "object",
            "properties": {
              "label": {
                "type": "string",
                "minLength": 1
              },
              "kind": {
                "type": "string",
                "enum": [
                  "time",
                  "geography",
                  "category",
                  "measure",
                  "attribute"
                ]
              },
              "rejected": {
                "type": "boolean"
              },
              "join_key": {
                "type": "boolean"
              }
            },
            "additionalProperties": false
          }
        },
        "required": [
          "name",
          "role",
          "join_key"
        ],
        "additionalProperties": false
      }
    }
  },
  "required": [
    "schema_version",
    "asset_id",
    "ontology_pins",
    "columns"
  ],
  "additionalProperties": false
}
