{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://data.publicinformation.ie/schemas/public-bodies.schema.json",
  "title": "Public Body",
  "description": "A public sector organization in Ireland",
  "type": "object",
  "properties": {
    "@id": {"type": "string", "format": "uri", "description": "Persistent URI"},
    "@type": {"type": "string", "const": "foi:PublicBody"},
    "@context": {"type": "object"},
    "name": {"type": "string", "description": "Official name"},
    "type": {
      "type": "string",
      "enum": ["department", "local_authority", "public_body"],
      "description": "Type of public body, from the body-type vocabulary"
    },
    "website": {"type": "string", "format": "uri", "description": "Official website URL"},
    "foi_subject": {"type": "boolean", "description": "Whether subject to FOI legislation"},
    "foi_scope": {
      "type": "string",
      "format": "uri",
      "enum": [
        "https://data.publicinformation.ie/ns/foi#FullScope",
        "https://data.publicinformation.ie/ns/foi#NoScope"
      ],
      "description": "FOI scope vocabulary URI"
    },
    "contact_email": {"type": "string", "format": "email", "description": "FOI contact email"},
    "slug": {"type": "string", "description": "Permanent slug component of the @id URI"},
    "parent_id": {"type": "string", "format": "uri", "description": "URI of the body's owning/parent body in the state's corporate hierarchy (e.g. Córas Iompair Éireann for Bus Átha Cliath). This is not the sponsoring department."},
    "parent_name": {"type": "string", "description": "Parent body's name, from CSO data"},
    "government_department_id": {"type": "string", "format": "uri", "description": "URI of the sponsoring government department (the body's aegis). This is not the owning parent. For a local authority or a government department it is the body itself."},
    "government_department": {"type": "string", "description": "Parent government department's name, from CSO data"},
    "sector": {"type": "string", "description": "CSO institutional sector code"},
    "legal_status": {"type": "string", "description": "Legal status, from CSO Register of Public Sector Bodies"},
    "nace_code": {"type": "string", "description": "Full NACE economic activity classification code"},
    "nace_section": {"type": "string", "description": "NACE section letter"},
    "nace_section_name": {"type": "string", "description": "NACE section name"},
    "nace_division": {"type": "string", "description": "NACE division code"},
    "nace_group": {"type": "string", "description": "NACE group code"},
    "nace_class": {"type": "string", "description": "NACE class code"},
    "nace_class_name": {"type": "string", "description": "NACE class name"},
    "cro": {"type": "string", "description": "Companies Registration Office number"},
    "data_vintage": {"type": "integer", "description": "Year the CSO source data was last refreshed"},
    "is_commercial": {"type": "boolean", "description": "Whether classified as commercial by the CSO"},
    "is_financial": {"type": "boolean", "description": "Whether classified as a financial institution by the CSO"},
    "aegis": {"type": "string", "description": "Which government entity the body operates under the aegis of"},
    "legal_entity_type": {"type": "string", "description": "CSO legal entity type classification"},
    "website_url": {
      "type": "object",
      "description": "Website URL crawl-status object, only present where crawled",
      "properties": {
        "url": {"type": "string", "format": "uri"},
        "status": {"type": "string"},
        "verified": {"type": "boolean"}
      }
    },
    "foi_page": {
      "type": "object",
      "description": "FOI page crawl-status object, only present where crawled",
      "properties": {
        "url": {"type": "string", "format": "uri"},
        "status": {"type": "string"},
        "verified": {"type": "boolean"}
      }
    },
    "foi_email": {
      "type": "object",
      "description": "FOI email crawl-status object, only present where crawled",
      "properties": {
        "email": {"type": "string", "format": "email"},
        "status": {"type": "string"},
        "verified": {"type": "boolean"}
      }
    },
    "disclosures_page": {
      "type": "object",
      "description": "Disclosures page crawl-status object, only present where crawled",
      "properties": {
        "url": {"type": "string", "format": "uri"},
        "status": {"type": "string"},
        "verified": {"type": "boolean"}
      }
    },
    "disclosure_files": {
      "type": "object",
      "description": "Disclosure files crawl-status object, only present where crawled",
      "properties": {
        "total": {"type": "integer"},
        "valid": {"type": "integer"},
        "failed": {"type": "integer"},
        "status": {"type": "string"}
      }
    },
    "foi_requests": {
      "type": "object",
      "description": "FOI requests crawl-status object, only present where crawled",
      "properties": {
        "valid": {"type": "integer"},
        "errors": {"type": "integer"},
        "status": {"type": "string"}
      }
    }
  },
  "required": ["@id", "@type", "name", "type", "foi_subject", "foi_scope", "slug"]
}
