{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "resolutions.schema.json",
  "type": "object",
  "properties": {
    "notice": {
      "type": "string",
      "minLength": 1
    },
    "generated_at": {
      "type": "string",
      "format": "date"
    },
    "license": {
      "const": "https://creativecommons.org/licenses/by/4.0/"
    },
    "records": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9-]*$"
          },
          "type": {
            "enum": [
              "venue",
              "program"
            ]
          },
          "name": {
            "type": "string",
            "minLength": 1
          },
          "checked_at": {
            "type": "string",
            "format": "date"
          },
          "updated_at": {
            "type": "string",
            "format": "date"
          },
          "review_by": {
            "type": "string",
            "format": "date"
          },
          "stale": {
            "type": "boolean"
          },
          "record": {
            "type": "string",
            "pattern": "^/data/v1/(venues|programs)/[a-z0-9-]+\\.json$"
          },
          "html": {
            "type": "string",
            "pattern": "^/en/(venues|programs)/[a-z0-9-]+$"
          },
          "tasks": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "task": {
                  "enum": [
                    "costs",
                    "funding",
                    "automation",
                    "eligibility",
                    "participation",
                    "timing",
                    "rewards"
                  ]
                },
                "status": {
                  "enum": [
                    "refresh",
                    "incomplete",
                    "conditional",
                    "review"
                  ],
                  "description": "Conservative human-review state, not permission or eligibility. refresh requires a new source review; incomplete keeps unresolved data; conditional keeps researched unknown conditions; review still requires a human decision."
                },
                "paths": {
                  "type": "array",
                  "items": {
                    "type": "string",
                    "minLength": 1
                  },
                  "uniqueItems": true
                }
              },
              "required": [
                "task",
                "status",
                "paths"
              ],
              "additionalProperties": false
            },
            "minItems": 4
          },
          "facts": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "path": {
                  "type": "string",
                  "minLength": 1
                },
                "state": {
                  "enum": [
                    "recorded",
                    "condition",
                    "missing"
                  ],
                  "description": "recorded retains the original known Fact; condition retains a researched unknown; missing remains unresolved. None establishes account eligibility or a reward."
                },
                "fact": {
                  "$ref": "common.schema.json#/$defs/Fact"
                }
              },
              "required": [
                "path",
                "state",
                "fact"
              ],
              "additionalProperties": false
            }
          },
          "sources": {
            "type": "array",
            "items": {
              "$ref": "common.schema.json#/$defs/source"
            }
          }
        },
        "required": [
          "id",
          "type",
          "name",
          "checked_at",
          "updated_at",
          "review_by",
          "stale",
          "record",
          "html",
          "tasks",
          "facts",
          "sources"
        ],
        "additionalProperties": false
      }
    }
  },
  "required": [
    "notice",
    "generated_at",
    "license",
    "records"
  ],
  "additionalProperties": false
}
