{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://data.publicinformation.ie/schemas/active-travel-allocations.schema.json",
  "title": "Active Travel Allocation",
  "description": "One project allocation in one funding stream of one annual National Transport Authority Active Travel Investment Grant allocation document",
  "type": "object",
  "properties": {
    "@id": {"type": "string", "format": "uri", "description": "Persistent URI for this allocation record, https://data.publicinformation.ie/allocation/{recipient}/{year}/{stream}/{key}"},
    "@type": {"type": "string", "const": "Allocation"},
    "@context": {"type": "object"},
    "year": {"type": "integer", "minimum": 2000, "maximum": 2100, "description": "Allocation year, taken from the committed publication list"},
    "public_body": {"type": "string", "format": "uri", "description": "The @id of the recipient local authority in the public-bodies dataset; absent when the recipient is not a local authority"},
    "public_body_id": {"type": "integer", "description": "Internal public_body_id of the recipient local authority, retained as a join key; absent when the recipient is not a local authority"},
    "recipient_name": {"type": "string", "minLength": 1, "description": "Recipient as printed in the source document"},
    "funding_stream": {"type": "string", "enum": ["active_travel", "other_nta_streams"], "description": "Funding stream the allocation sits in: the recipient's active-travel allocation, or an allocation through other NTA funding streams"},
    "project_code": {"type": "string", "minLength": 1, "description": "Project code as printed, which may be a provisional placeholder such as WCC/26/XXXX"},
    "project_code_provisional": {"type": "boolean", "description": "True when the printed project code is a placeholder rather than an assigned code, in which case it does not identify the project"},
    "project_name": {"type": "string", "minLength": 1, "description": "Project name as printed"},
    "allocation_eur": {"type": "integer", "minimum": 0, "description": "Allocation in whole euro"},
    "source_document_url": {"type": "string", "format": "uri", "description": "URL of the source allocation document"},
    "source_document_sha256": {"type": "string", "pattern": "^[0-9a-f]{64}$", "description": "SHA-256 of the source document bytes this record was read from"},
    "source_page": {"type": "integer", "minimum": 1, "description": "1-based page of the source document the record was read from"}
  },
  "required": [
    "@id", "@type", "year", "recipient_name", "funding_stream", "project_code",
    "project_code_provisional", "project_name", "allocation_eur",
    "source_document_url", "source_document_sha256", "source_page"
  ],
  "additionalProperties": false
}
