{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://www.delta-sierra.com/data/budget-accountability-alert-schema.json",
  "title": "Budget accountability alert",
  "type": "object",
  "required": [
    "id",
    "date",
    "status",
    "amount_at_risk_eur",
    "competent_authority",
    "source"
  ],
  "properties": {
    "id": {
      "type": "string",
      "pattern": "^BR-[0-9]{4}-[0-9]{4,}$"
    },
    "date": {
      "type": "string",
      "format": "date"
    },
    "status": {
      "enum": [
        "GREEN",
        "YELLOW",
        "ORANGE",
        "RED",
        "RED_EXCEPTION",
        "CLOSED"
      ]
    },
    "amount_at_risk_eur": {
      "type": "number"
    },
    "deficit_risk_pct_gdp": {
      "type": [
        "number",
        "null"
      ]
    },
    "competent_authority": {
      "type": "string"
    },
    "persons_or_offices_notified": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "source": {
      "type": "string"
    },
    "source_url": {
      "type": [
        "string",
        "null"
      ],
      "format": "uri"
    },
    "decision": {
      "type": [
        "string",
        "null"
      ]
    },
    "reasoning": {
      "type": [
        "string",
        "null"
      ]
    },
    "correction": {
      "type": [
        "string",
        "null"
      ]
    },
    "hcfp_certificate": {
      "type": [
        "string",
        "null"
      ]
    },
    "constitutional_review": {
      "type": [
        "string",
        "null"
      ]
    },
    "audit_outcome": {
      "type": [
        "string",
        "null"
      ]
    },
    "updated_at": {
      "type": "string",
      "format": "date-time"
    }
  }
}