{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://mianzhang.org/community/community-metrics-schema.json",
  "title": "Open Research Community Metrics Ledger Row",
  "description": "A privacy-bounded public record for aggregate community activity and public contributions.",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "date",
    "channel",
    "object",
    "event_type",
    "quantity",
    "public_url",
    "participant_ref",
    "returning",
    "response_minutes",
    "notes"
  ],
  "properties": {
    "date": {
      "type": "string",
      "format": "date"
    },
    "channel": {
      "type": "string",
      "enum": ["github", "hugging_face", "website", "private_aggregate"]
    },
    "object": {
      "type": "string",
      "description": "Public repository, artifact, route, or aggregate cohort name."
    },
    "event_type": {
      "type": "string",
      "enum": [
        "baseline_stars",
        "baseline_forks",
        "baseline_open_issues",
        "baseline_likes",
        "baseline_downloads",
        "meaningful_question",
        "public_use_case",
        "artifact_improvement",
        "public_experiment",
        "pull_request",
        "returning_participant",
        "qualified_design_partner_count",
        "maintainer_response"
      ]
    },
    "quantity": {
      "type": ["integer", "null"],
      "minimum": 0
    },
    "public_url": {
      "type": "string",
      "description": "Public receipt URL; blank only for a privacy-protected aggregate."
    },
    "participant_ref": {
      "type": "string",
      "description": "Optional public handle or non-identifying aggregate reference. Never store private contact data."
    },
    "returning": {
      "type": ["boolean", "null"]
    },
    "response_minutes": {
      "type": ["integer", "null"],
      "minimum": 0
    },
    "notes": {
      "type": "string"
    }
  }
}
