{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://mifogram.com/downloads/manifest.schema.json",
  "title": "Mifogram downloads manifest",
  "type": "object",
  "additionalProperties": false,
  "required": ["schema_version", "product", "channel", "generated_at", "manifest_schema", "platforms"],
  "properties": {
    "schema_version": {
      "type": "integer",
      "const": 1
    },
    "product": {
      "type": "string",
      "const": "Mifogram"
    },
    "channel": {
      "type": "string",
      "enum": ["staging", "stable"]
    },
    "generated_at": {
      "type": "string",
      "format": "date-time"
    },
    "manifest_schema": {
      "type": "string",
      "format": "uri-reference"
    },
    "platforms": {
      "type": "object",
      "additionalProperties": false,
      "required": ["windows-x64", "android-apk", "google-play", "app-store"],
      "properties": {
        "windows-x64": {
          "$ref": "#/$defs/binary_channel"
        },
        "android-apk": {
          "$ref": "#/$defs/binary_channel"
        },
        "google-play": {
          "$ref": "#/$defs/store_channel"
        },
        "app-store": {
          "$ref": "#/$defs/store_channel"
        }
      }
    }
  },
  "$defs": {
    "status": {
      "type": "string",
      "enum": ["planned", "available", "disabled"]
    },
    "binary_channel": {
      "type": "object",
      "additionalProperties": false,
      "required": ["status", "version", "artifact", "sha256", "notes"],
      "properties": {
        "status": {
          "$ref": "#/$defs/status"
        },
        "version": {
          "type": ["string", "null"]
        },
        "artifact": {
          "type": ["string", "null"],
          "format": "uri-reference"
        },
        "sha256": {
          "type": ["string", "null"],
          "pattern": "^[a-fA-F0-9]{64}$"
        },
        "notes": {
          "type": "string"
        }
      }
    },
    "store_channel": {
      "type": "object",
      "additionalProperties": false,
      "required": ["status", "store_url", "notes"],
      "properties": {
        "status": {
          "$ref": "#/$defs/status"
        },
        "store_url": {
          "type": ["string", "null"],
          "format": "uri"
        },
        "notes": {
          "type": "string"
        }
      }
    }
  }
}
