{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://data.publicinformation.ie/schemas/spc-meetings.schema.json",
  "title": "SPC meetings dataset record",
  "description": "One published record of the SPC meetings dataset: a meeting, person, attendance row, agenda item or decision.",
  "oneOf": [
    {
      "$ref": "#/$defs/meeting"
    },
    {
      "$ref": "#/$defs/person"
    },
    {
      "$ref": "#/$defs/attendance"
    },
    {
      "$ref": "#/$defs/item"
    },
    {
      "$ref": "#/$defs/decision"
    }
  ],
  "$defs": {
    "meeting": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "@id",
        "@type",
        "meeting_id",
        "committee_id",
        "committee_name",
        "public_body",
        "public_body_id",
        "meeting_date",
        "minutes_path",
        "attendance_published",
        "source_url",
        "source_sha256"
      ],
      "properties": {
        "@id": {
          "type": "string",
          "format": "uri"
        },
        "@type": {
          "const": "spc:Meeting"
        },
        "meeting_id": {
          "type": "string",
          "pattern": "^[a-z-]+/[a-z-]+/\\d{4}-\\d{2}-\\d{2}$"
        },
        "committee_id": {
          "type": "string",
          "pattern": "^[a-z-]+/[a-z-]+$"
        },
        "committee_name": {
          "type": "string"
        },
        "public_body": {
          "type": "string",
          "format": "uri"
        },
        "public_body_id": {
          "type": "integer"
        },
        "meeting_date": {
          "type": "string",
          "format": "date"
        },
        "venue": {
          "type": [
            "string",
            "null"
          ]
        },
        "start_time": {
          "type": [
            "string",
            "null"
          ]
        },
        "end_time": {
          "type": [
            "string",
            "null"
          ]
        },
        "source_url": {
          "type": "string",
          "format": "uri"
        },
        "source_sha256": {
          "type": "string",
          "pattern": "^[0-9a-f]{64}$"
        },
        "minutes_path": {
          "type": "string"
        },
        "attendance_published": {
          "type": "boolean"
        }
      }
    },
    "person": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "@id",
        "@type",
        "person_id",
        "canonical_name",
        "kind",
        "public_body",
        "public_body_id"
      ],
      "properties": {
        "@id": {
          "type": "string",
          "format": "uri"
        },
        "@type": {
          "const": "spc:Person"
        },
        "person_id": {
          "type": "string"
        },
        "canonical_name": {
          "type": "string"
        },
        "kind": {
          "enum": [
            "councillor",
            "sectoral_representative",
            "official",
            "guest"
          ]
        },
        "councillor_id": {
          "type": [
            "string",
            "null"
          ]
        },
        "public_body": {
          "type": "string",
          "format": "uri"
        },
        "public_body_id": {
          "type": "integer"
        }
      }
    },
    "attendance": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "@id",
        "@type",
        "meeting_id",
        "meeting_date",
        "person_id",
        "category",
        "status",
        "mode",
        "presented"
      ],
      "properties": {
        "@id": {
          "type": "string",
          "format": "uri"
        },
        "@type": {
          "const": "spc:Attendance"
        },
        "meeting_id": {
          "type": "string"
        },
        "meeting_date": {
          "type": "string",
          "format": "date"
        },
        "person_id": {
          "type": "string"
        },
        "category": {
          "enum": [
            "councillors",
            "sectoral_representatives",
            "apologies",
            "officials",
            "presenters"
          ]
        },
        "role": {
          "type": [
            "string",
            "null"
          ]
        },
        "status": {
          "enum": [
            "present",
            "apologies"
          ]
        },
        "mode": {
          "enum": [
            "remote",
            "in_person",
            "not_stated"
          ]
        },
        "presented": {
          "type": "boolean",
          "description": "true when the person's name also appears in the presenters block"
        }
      }
    },
    "item": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "@id",
        "@type",
        "meeting_id",
        "item_number",
        "item_key",
        "title",
        "text",
        "is_minutes_approval",
        "topics_published"
      ],
      "properties": {
        "@id": {
          "type": "string",
          "format": "uri"
        },
        "@type": {
          "const": "spc:Item"
        },
        "item_id": {
          "type": "string",
          "description": "Dataset-relative item identifier, <meeting_id>/<item_key>"
        },
        "meeting_id": {
          "type": "string"
        },
        "item_number": {
          "type": "string"
        },
        "item_key": {
          "type": "string"
        },
        "title": {
          "type": "string"
        },
        "text": {
          "type": "string"
        },
        "is_minutes_approval": {
          "type": "boolean"
        },
        "topics_published": {
          "type": "boolean"
        },
        "cofog": {
          "type": [
            "array",
            "null"
          ],
          "items": {
            "enum": [
              "01",
              "01.1",
              "01.1.1",
              "01.1.2",
              "01.1.3",
              "01.2",
              "01.2.1",
              "01.2.2",
              "01.3",
              "01.3.1",
              "01.3.2",
              "01.3.3",
              "01.4",
              "01.4.0",
              "01.5",
              "01.5.0",
              "01.6",
              "01.6.0",
              "01.7",
              "01.7.0",
              "01.8",
              "01.8.0",
              "02",
              "02.1",
              "02.1.0",
              "02.2",
              "02.2.0",
              "02.3",
              "02.3.0",
              "02.4",
              "02.4.0",
              "02.5",
              "02.5.0",
              "03",
              "03.1",
              "03.1.0",
              "03.2",
              "03.2.0",
              "03.3",
              "03.3.0",
              "03.4",
              "03.4.0",
              "03.5",
              "03.5.0",
              "03.6",
              "03.6.0",
              "04",
              "04.1",
              "04.1.1",
              "04.1.2",
              "04.2",
              "04.2.1",
              "04.2.2",
              "04.2.3",
              "04.3",
              "04.3.1",
              "04.3.2",
              "04.3.3",
              "04.3.4",
              "04.3.5",
              "04.3.6",
              "04.4",
              "04.4.1",
              "04.4.2",
              "04.4.3",
              "04.5",
              "04.5.1",
              "04.5.2",
              "04.5.3",
              "04.5.4",
              "04.5.5",
              "04.6",
              "04.6.0",
              "04.7",
              "04.7.1",
              "04.7.2",
              "04.7.3",
              "04.7.4",
              "04.8",
              "04.8.1",
              "04.8.2",
              "04.8.3",
              "04.8.4",
              "04.8.5",
              "04.8.6",
              "04.8.7",
              "04.9",
              "04.9.0",
              "05",
              "05.1",
              "05.1.0",
              "05.2",
              "05.2.0",
              "05.3",
              "05.3.0",
              "05.4",
              "05.4.0",
              "05.5",
              "05.5.0",
              "05.6",
              "05.6.0",
              "06",
              "06.1",
              "06.1.0",
              "06.2",
              "06.2.0",
              "06.3",
              "06.3.0",
              "06.4",
              "06.4.0",
              "06.5",
              "06.5.0",
              "06.6",
              "06.6.0",
              "07",
              "07.1",
              "07.1.1",
              "07.1.2",
              "07.1.3",
              "07.2",
              "07.2.1",
              "07.2.2",
              "07.2.3",
              "07.2.4",
              "07.3",
              "07.3.1",
              "07.3.2",
              "07.3.3",
              "07.3.4",
              "07.4",
              "07.4.0",
              "07.5",
              "07.5.0",
              "07.6",
              "07.6.0",
              "08",
              "08.1",
              "08.1.0",
              "08.2",
              "08.2.0",
              "08.3",
              "08.3.0",
              "08.4",
              "08.4.0",
              "08.5",
              "08.5.0",
              "08.6",
              "08.6.0",
              "09",
              "09.1",
              "09.1.1",
              "09.1.2",
              "09.2",
              "09.2.1",
              "09.2.2",
              "09.3",
              "09.3.0",
              "09.4",
              "09.4.1",
              "09.4.2",
              "09.5",
              "09.5.0",
              "09.6",
              "09.6.0",
              "09.7",
              "09.7.0",
              "09.8",
              "09.8.0",
              "10",
              "10.1",
              "10.1.1",
              "10.1.2",
              "10.2",
              "10.2.0",
              "10.3",
              "10.3.0",
              "10.4",
              "10.4.0",
              "10.5",
              "10.5.0",
              "10.6",
              "10.6.0",
              "10.7",
              "10.7.0",
              "10.8",
              "10.8.0",
              "10.9",
              "10.9.0"
            ]
          }
        },
        "subdomains": {
          "type": [
            "array",
            "null"
          ],
          "items": {
            "enum": [
              "infra/national-roads",
              "infra/regional-local-roads",
              "infra/active-travel",
              "infra/bus",
              "infra/heavy-rail",
              "infra/light-rail",
              "infra/kerbside",
              "infra/ports-airfields",
              "svc/pso-bus",
              "svc/commercial-bus",
              "svc/rail",
              "svc/light-rail",
              "svc/spsv",
              "svc/school-transport",
              "svc/shared-mobility",
              "users/vehicles-drivers",
              "users/traffic-law"
            ]
          }
        },
        "procedural": {
          "type": [
            "boolean",
            "null"
          ]
        }
      }
    },
    "decision": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "@id",
        "@type",
        "decision_id",
        "meeting_id",
        "meeting_date",
        "item_number",
        "decision_text",
        "decision_type"
      ],
      "properties": {
        "@id": {
          "type": "string",
          "format": "uri"
        },
        "@type": {
          "const": "spc:Decision"
        },
        "decision_id": {
          "type": "string"
        },
        "meeting_id": {
          "type": "string"
        },
        "meeting_date": {
          "type": "string",
          "format": "date"
        },
        "item_number": {
          "type": "string"
        },
        "item_key": {
          "type": "string",
          "description": "Stable item key, so a decision joins its item even when two items share a number"
        },
        "decision_text": {
          "type": "string"
        },
        "decision_type": {
          "enum": [
            "agreed",
            "adopted",
            "recommended_to_council",
            "referred",
            "deferred",
            "appointment"
          ]
        },
        "proposer": {
          "type": [
            "string",
            "null"
          ]
        },
        "seconder": {
          "type": [
            "string",
            "null"
          ]
        },
        "proposer_unresolved": {
          "type": "boolean",
          "description": "true when a named proposer could not be resolved, grounded in the item text or found present"
        },
        "seconder_unresolved": {
          "type": "boolean",
          "description": "true when a named seconder could not be resolved, grounded in the item text or found present"
        }
      }
    }
  }
}
