{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://status.bluecurrent.nl/messages.schema.json",
  "title": "Blue Current platform status messages",
  "description": "A list of announcement messages. Clients filter by audience and validity window and display at most one message.",
  "type": "array",
  "items": { "$ref": "#/$defs/message" },

  "$defs": {
    "language": {
      "type": "string",
      "enum": ["en", "nl"]
    },

    "localizedText": {
      "type": "object",
      "properties": {
        "en": { "type": "string", "minLength": 1, "maxLength": 250 },
        "nl": { "type": "string", "minLength": 1, "maxLength": 250 }
      },
      "required": ["en", "nl"],
      "additionalProperties": false
    },

    "localizedUrl": {
      "type": "object",
      "properties": {
        "en": { "type": "string", "format": "uri", "pattern": "^https://" },
        "nl": { "type": "string", "format": "uri", "pattern": "^https://" }
      },
      "required": ["en", "nl"],
      "additionalProperties": false
    },

    "message": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "description": "Unique, stable identifier. May be used by clients to remember dismissals.",
          "pattern": "^[a-z0-9][a-z0-9-]{2,63}$"
        },
        "audience": {
          "type": "string",
          "enum": [
            "app:beta",
            "app:release",
            "website",
            "customer-dashboard",
            "all"
          ]
        },
        "message": { "$ref": "#/$defs/localizedText" },
        "url": { "$ref": "#/$defs/localizedUrl" },
        "valid_from": {
          "type": "string",
          "format": "date-time",
          "description": "ISO-8601 with timezone, e.g. 2026-09-09T22:00:00Z"
        },
        "valid_to": {
          "type": "string",
          "format": "date-time",
          "description": "ISO-8601 with timezone. Must be after valid_from."
        }
      },
      "required": ["id", "audience", "message", "valid_from", "valid_to"],
      "additionalProperties": false
    }
  }
}
