{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://agrodt.github.io/agrotool-knowledge-portal/schemas/v1/metrics.schema.json",
  "title": "PublicMetrics",
  "type": "array",
  "items": {
    "type": "object",
    "allOf": [
      { "$ref": "common.schema.json#/$defs/recordMetadata" },
      {
        "type": "object",
        "required": [
          "metric_id",
          "entity_id",
          "metric_type",
          "value",
          "graph_projection_id",
          "definition",
          "filters",
          "source_ids"
        ],
        "properties": {
          "metric_id": { "type": "string", "pattern": "^K[A-Z0-9_-]{3,63}$" },
          "entity_id": { "$ref": "common.schema.json#/$defs/stableId" },
          "metric_type": {
            "enum": [
              "publication_count",
              "joint_work_count",
              "fractional_weighted_degree",
              "component_count",
              "betweenness",
              "supporting_layer_count"
            ]
          },
          "value": { "type": "number" },
          "graph_projection_id": {
            "type": "string",
            "pattern": "^GP[A-Z0-9_-]{2,62}$"
          },
          "definition": { "$ref": "common.schema.json#/$defs/localizedText" },
          "filters": { "type": "object" },
          "source_ids": { "$ref": "common.schema.json#/$defs/sourceIds" }
        }
      }
    ],
    "unevaluatedProperties": false
  }
}
