{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://andronix.app/changelog.schema.json",
  "title": "Andronix changelog",
  "description": "Every Andronix release that reached users: the app on Google Play, the andronix installer on dl.andronix.app and Modded OS. Used by andronix.app/changelog and the Andronix app. Entries are sorted newest first.",
  "type": "object",
  "required": [
    "schemaVersion",
    "entries"
  ],
  "additionalProperties": false,
  "properties": {
    "schemaVersion": {
      "description": "Changes only when the format changes in a way that breaks readers. New optional fields don't change it.",
      "const": 1
    },
    "entries": {
      "type": "array",
      "description": "Newest first: by date, descending. Entries on the same day keep the order in the file.",
      "items": {
        "$ref": "#/$defs/entry"
      }
    },
    "$schema": {
      "type": "string"
    }
  },
  "$defs": {
    "entry": {
      "type": "object",
      "required": [
        "id",
        "product",
        "channel",
        "version",
        "date",
        "title",
        "items"
      ],
      "additionalProperties": false,
      "properties": {
        "id": {
          "description": "Unique and stable, used as the anchor on andronix.app/changelog (#<id>): <product>-<version>, for example app-10.0.5, installer-2.0.6, app-10.1.0-beta10.",
          "type": "string",
          "pattern": "^[a-z0-9][a-z0-9._-]*$"
        },
        "product": {
          "enum": [
            "app",
            "installer",
            "modded_os"
          ]
        },
        "channel": {
          "description": "stable: Google Play production for the app, bin/latest for the installer. beta: Google Play open testing for the app, the installer's beta channel.",
          "enum": [
            "stable",
            "beta"
          ]
        },
        "version": {
          "description": "As users see it: the app's versionName (10.0.5, 10.1.0-beta10), the installer version (2.0.6), or the Modded OS release (2.0).",
          "type": "string",
          "minLength": 1
        },
        "versionCode": {
          "description": "The app's Android versionCode. Required for the app, not allowed for other products.",
          "type": "integer",
          "minimum": 1
        },
        "date": {
          "description": "The day it reached users (UTC): the Google Play rollout start for the app, the dl.andronix.app publish date for the installer.",
          "type": "string",
          "format": "date",
          "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}$"
        },
        "title": {
          "description": "A short plain headline for the release in English, for example \"Clearer problem reports\". Not the version: readers show product and version separately.",
          "type": "string",
          "minLength": 1,
          "maxLength": 60
        },
        "items": {
          "type": "array",
          "minItems": 1,
          "items": {
            "type": "object",
            "required": [
              "type",
              "text"
            ],
            "additionalProperties": false,
            "properties": {
              "type": {
                "enum": [
                  "new",
                  "improved",
                  "fixed"
                ]
              },
              "text": {
                "description": "English. One plain-text sentence, no Markdown or HTML. Commands are written as they are typed, for example andronix report.",
                "type": "string",
                "minLength": 1
              },
              "text_i18n": {
                "$ref": "#/$defs/i18n",
                "description": "Translations of text, plain text like it."
              }
            }
          }
        },
        "links": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "label",
              "url"
            ],
            "additionalProperties": false,
            "properties": {
              "label": {
                "type": "string",
                "minLength": 1
              },
              "url": {
                "type": "string",
                "format": "uri",
                "pattern": "^https://"
              }
            }
          }
        },
        "title_i18n": {
          "$ref": "#/$defs/i18n"
        }
      },
      "if": {
        "properties": {
          "product": {
            "const": "app"
          }
        }
      },
      "then": {
        "required": [
          "versionCode"
        ]
      },
      "else": {
        "not": {
          "required": [
            "versionCode"
          ]
        }
      }
    },
    "i18n": {
      "description": "Optional translations, keyed by BCP-47 tag: de, es, fr, id (Indonesian; not Android's old \"in\"), pt-BR, tr. English is the required base field and isn't repeated here. Readers try the exact tag (pt-BR), then the language alone (pt), then the English text.",
      "type": "object",
      "patternProperties": {
        "^[a-z]{2,3}(-[A-Z]{2})?$": {
          "type": "string",
          "minLength": 1
        }
      },
      "propertyNames": {
        "not": {
          "enum": [
            "en",
            "in"
          ]
        }
      },
      "additionalProperties": false
    }
  }
}
