{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://hunterterrell.dev/record/schema.json",
  "title": "Provenance record entry",
  "description": "Front matter contract for one claim in record/entries/*.md",
  "type": "object",
  "required": ["id", "date", "project", "claim", "state", "visibility", "evidence", "tags"],
  "additionalProperties": false,
  "properties": {
    "id": {
      "type": "string",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}-[a-z0-9]+(-[a-z0-9]+)*$",
      "description": "Filename without .md: ISO date, then a kebab-case slug."
    },
    "date": {
      "type": "string",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
      "description": "The date the claim became true, not the date it was written."
    },
    "project": {
      "type": "string",
      "minLength": 1,
      "description": "Human name of the project or engagement."
    },
    "claim": {
      "type": "string",
      "minLength": 20,
      "maxLength": 240,
      "description": "One sentence, past tense, no adjectives that the evidence does not carry."
    },
    "state": {
      "type": "string",
      "enum": ["verified", "inferred", "proposed"]
    },
    "visibility": {
      "type": "string",
      "enum": ["public", "private"]
    },
    "evidence": {
      "type": "array",
      "items": {
        "type": "object",
        "required": ["type", "ref"],
        "additionalProperties": false,
        "properties": {
          "type": {
            "type": "string",
            "enum": ["pull-request", "commit", "release", "url", "document", "measurement", "screenshot"]
          },
          "ref": {
            "type": "string",
            "minLength": 3,
            "description": "A URL, an owner/repo#number, an owner/repo@sha, a repo path, or a measured value with its unit."
          },
          "note": {
            "type": "string",
            "maxLength": 200
          }
        }
      }
    },
    "tags": {
      "type": "array",
      "items": { "type": "string", "pattern": "^[a-z0-9]+(-[a-z0-9]+)*$" },
      "uniqueItems": true
    },
    "hours": {
      "type": "number",
      "minimum": 0,
      "description": "Hunter's own time, when measured. Omit when unknown."
    }
  }
}
