{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://data.publicinformation.ie/schemas/public-body-actions.schema.json",
  "title": "Public Body Actions",
  "description": "Published commitments of Irish public bodies: each action a plan declares, the status observations progress reports make about it, how actions relate to one another, and each action's dated interim milestones.",
  "type": "object",
  "properties": {
    "@context": {
      "type": "object"
    },
    "@graph": {
      "type": "array",
      "items": {
        "oneOf": [
          {
            "$ref": "#/$defs/Action"
          },
          {
            "$ref": "#/$defs/ActionStatusObservation"
          },
          {
            "$ref": "#/$defs/ActionRelationship"
          },
          {
            "$ref": "#/$defs/ActionMilestone"
          }
        ]
      }
    }
  },
  "required": [
    "@context",
    "@graph"
  ],
  "$defs": {
    "Action": {
      "type": "object",
      "properties": {
        "@id": {
          "type": "string",
          "format": "uri"
        },
        "@type": {
          "type": "string",
          "const": "act:Action"
        },
        "action_id": {
          "type": "string"
        },
        "public_body": {
          "type": "string",
          "format": "uri"
        },
        "plan_slug": {
          "type": "string"
        },
        "plan_title": {
          "type": "string"
        },
        "source_url": {
          "type": "string",
          "format": "uri"
        },
        "action_number": {
          "type": "string",
          "pattern": "^([0-9]{1,3}|[A-Z0-9]+(/[A-Za-z0-9]+)*)$",
          "description": "The reference the plan itself gives the action, flags removed: an ordinal (`12`) or a coded reference (`EL/23/6/A`). Unique only within a plan. Text, not a number."
        },
        "action_reference_printed": {
          "type": "string",
          "description": "The reference exactly as printed in the source, flags included (`EL/23/6**`)."
        },
        "action_flags": {
          "type": "array",
          "items": {
            "type": "string",
            "enum": [
              "non_reportable",
              "duplicate",
              "taskforce"
            ]
          },
          "description": "Flags printed against the reference and stripped from identity: `*` and `**` (non_reportable, duplicate) and `(TF)` (taskforce)."
        },
        "action_text": {
          "type": "string"
        },
        "original_deadline_raw": {
          "type": "string"
        },
        "original_deadline_start": {
          "type": [
            "string",
            "null"
          ],
          "format": "date"
        },
        "original_deadline_end": {
          "type": [
            "string",
            "null"
          ],
          "format": "date"
        },
        "original_deadline_precision": {
          "type": [
            "string",
            "null"
          ],
          "enum": [
            "day",
            "month",
            "quarter",
            "year",
            "range",
            "annual",
            "ongoing",
            null
          ]
        },
        "original_deadline_confidence": {
          "type": [
            "string",
            "null"
          ],
          "enum": [
            "stated",
            "interpreted",
            null
          ],
          "description": "stated (a single unambiguous deadline, transcribed, including Annual/Ongoing) or interpreted (derived by the latest-milestone rule); null exactly when no precision was resolved."
        },
        "original_timeline_raw": {
          "type": "string"
        },
        "lead": {
          "type": "string"
        },
        "support": {
          "type": "string"
        },
        "output": {
          "type": "string"
        },
        "source_page": {
          "type": [
            "integer",
            "null"
          ]
        },
        "source_ref": {
          "type": [
            "string",
            "null"
          ]
        },
        "action_text_clean": {
          "type": "string",
          "description": "Action text with confirmed PDF-extraction artefacts repaired; the display field. `action_text` remains the untouched extraction."
        },
        "original_deadline_label": {
          "type": [
            "string",
            "null"
          ],
          "description": "Short, display-ready final deadline (`2023`, `Q4 2027`, `Annual`, `Ongoing`). Use this as the heading. Where no date can be parsed it is the Timeline text as printed (`Q1 and Q3`, `Q4`). Null where the plan prints no deadline (a `-` or empty Timeline)."
        },
        "original_deadline_milestones": {
          "type": "string",
          "description": "Milestone prose preserved from the plan's timeline or interim-milestones cell; empty for a single-date action."
        }
      },
      "required": [
        "@id",
        "@type",
        "action_id",
        "public_body",
        "plan_slug",
        "action_number",
        "action_reference_printed",
        "action_flags",
        "action_text"
      ],
      "description": "A commitment declared by a plan. Status is carried by ActionStatusObservation nodes, not on the action itself; the absence of an observation means \"not yet reported\", not \"unknown\"."
    },
    "ActionStatusObservation": {
      "type": "object",
      "properties": {
        "@id": {
          "type": "string",
          "format": "uri"
        },
        "@type": {
          "type": "string",
          "const": "act:ActionStatusObservation"
        },
        "action": {
          "type": "string",
          "format": "uri"
        },
        "action_id": {
          "type": "string"
        },
        "report_slug": {
          "type": "string"
        },
        "report_title": {
          "type": "string"
        },
        "as_of": {
          "type": "string",
          "format": "date"
        },
        "status": {
          "type": "string",
          "enum": [
            "Complete",
            "OnSchedule",
            "Delayed",
            "Ongoing",
            "Modified"
          ]
        },
        "reported_deadline_raw": {
          "type": "string"
        },
        "reported_deadline_start": {
          "type": [
            "string",
            "null"
          ],
          "format": "date"
        },
        "reported_deadline_end": {
          "type": [
            "string",
            "null"
          ],
          "format": "date"
        },
        "reported_deadline_precision": {
          "type": [
            "string",
            "null"
          ],
          "enum": [
            "day",
            "month",
            "quarter",
            "year",
            "range",
            "annual",
            "ongoing",
            null
          ]
        },
        "progress_text": {
          "type": "string"
        },
        "asi": {
          "type": [
            "string",
            "null"
          ]
        },
        "source_page": {
          "type": [
            "integer",
            "null"
          ]
        },
        "source_ref": {
          "type": [
            "string",
            "null"
          ]
        },
        "progress_text_clean": {
          "type": "string",
          "description": "Progress narrative with confirmed PDF-extraction artefacts repaired; the display field."
        }
      },
      "required": [
        "@id",
        "@type",
        "action",
        "action_id",
        "report_slug",
        "as_of",
        "status"
      ]
    },
    "ActionRelationship": {
      "type": "object",
      "properties": {
        "@id": {
          "type": "string",
          "format": "uri"
        },
        "@type": {
          "type": "string",
          "const": "act:ActionRelationship"
        },
        "from_action": {
          "type": "string",
          "format": "uri"
        },
        "from_action_id": {
          "type": "string"
        },
        "to_action_id": {
          "type": [
            "string",
            "null"
          ]
        },
        "to_plan_hint": {
          "type": "string"
        },
        "to_action_number": {
          "type": [
            "string",
            "null"
          ]
        },
        "relationship": {
          "type": "string",
          "enum": [
            "renumbered_as",
            "supersedes",
            "split_into",
            "merged_into",
            "carried_forward_to",
            "complements",
            "references",
            "part_of"
          ]
        },
        "family": {
          "type": "string",
          "enum": [
            "lineage",
            "reference",
            "structure"
          ]
        },
        "method": {
          "type": "string",
          "enum": [
            "extracted",
            "declared",
            "curated"
          ]
        },
        "asserted_in": {
          "type": [
            "string",
            "null"
          ]
        },
        "evidence": {
          "type": "string"
        }
      },
      "required": [
        "@id",
        "@type",
        "from_action",
        "from_action_id",
        "to_plan_hint",
        "relationship",
        "family",
        "method"
      ]
    },
    "ActionMilestone": {
      "type": "object",
      "properties": {
        "@id": {
          "type": "string",
          "format": "uri"
        },
        "@type": {
          "type": "string",
          "const": "act:ActionMilestone"
        },
        "action": {
          "type": "string",
          "format": "uri"
        },
        "milestone_id": {
          "type": "string"
        },
        "action_id": {
          "type": "string"
        },
        "ordinal": {
          "type": "integer"
        },
        "due_label": {
          "type": [
            "string",
            "null"
          ]
        },
        "due_start": {
          "type": [
            "string",
            "null"
          ]
        },
        "due_end": {
          "type": [
            "string",
            "null"
          ]
        },
        "due_precision": {
          "type": [
            "string",
            "null"
          ],
          "enum": [
            "quarter",
            "year",
            null
          ]
        },
        "milestone_text": {
          "type": "string"
        }
      },
      "required": [
        "@id",
        "@type",
        "action",
        "milestone_id",
        "action_id",
        "ordinal"
      ]
    }
  }
}
