{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://unpkg.com/@shipdot/core/schema/v1.json",
  "title": "shipdot feed (v1)",
  "description": "The shipdot.json file produced by `shipdot build` and consumed by the <ship-dot> widget.",
  "type": "object",
  "required": ["version", "generatedAt", "defaultLocale", "entries"],
  "additionalProperties": false,
  "properties": {
    "$schema": { "type": "string" },
    "version": { "const": 1 },
    "generatedAt": { "type": "string", "format": "date-time" },
    "defaultLocale": { "$ref": "#/$defs/locale" },
    "entries": {
      "type": "array",
      "description": "Newest first.",
      "items": { "$ref": "#/$defs/entry" }
    }
  },
  "$defs": {
    "locale": {
      "type": "string",
      "pattern": "^[A-Za-z]{2,3}(-[A-Za-z0-9]{2,8})*$"
    },
    "entry": {
      "type": "object",
      "required": ["id", "date", "type", "title", "html"],
      "additionalProperties": false,
      "properties": {
        "id": { "type": "string", "pattern": "^[A-Za-z0-9][A-Za-z0-9._-]*$" },
        "date": { "type": "string", "format": "date", "pattern": "^\\d{4}-\\d{2}-\\d{2}$" },
        "type": { "enum": ["new", "improved", "fixed"] },
        "title": { "type": "string", "minLength": 1 },
        "html": {
          "type": "string",
          "description": "Sanitized at build time. Allowed tags: p, a, strong, em, code, pre, ul, ol, li, br, h3, h4, img."
        },
        "target": {
          "type": "string",
          "minLength": 1,
          "description": "CSS selector of the element that gets a hotspot."
        },
        "link": { "type": "string", "format": "uri", "pattern": "^https?://" },
        "image": {
          "type": "string",
          "description": "https URL or a path relative to shipdot.json."
        },
        "i18n": {
          "type": "object",
          "propertyNames": { "$ref": "#/$defs/locale" },
          "additionalProperties": { "$ref": "#/$defs/translation" }
        }
      }
    },
    "translation": {
      "type": "object",
      "required": ["title", "html"],
      "additionalProperties": false,
      "properties": {
        "title": { "type": "string", "minLength": 1 },
        "html": { "type": "string" }
      }
    }
  }
}
