{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://welovescreenshots.com/specs/specs.schema.json",
  "title": "Store screenshot placements",
  "description": "The placements our validator covers, with the official source and the date each row was verified. Apple rows are exact; the Google Play phone slot is a range with a 2.3x cap.",
  "type": "object",
  "required": ["generatedAt", "placements", "textLimits"],
  "properties": {
    "generatedAt": { "type": "string", "format": "date" },
    "generatedFrom": { "type": "string" },
    "notice": { "type": "string" },
    "placements": {
      "type": "array",
      "minItems": 17,
      "items": {
        "type": "object",
        "required": ["store", "surface", "name", "mode", "alphaAllowed", "minCount", "maxCount", "verifiedAt", "source"],
        "properties": {
          "store": { "enum": ["apple", "play"] },
          "surface": { "type": "string" },
          "name": { "type": "string" },
          "mode": { "enum": ["exact", "range"] },
          "width": { "type": "integer" },
          "height": { "type": "integer" },
          "reference": {
            "type": "object",
            "required": ["width", "height"],
            "properties": { "width": { "type": "integer" }, "height": { "type": "integer" } }
          },
          "minSide": { "type": "integer" },
          "maxSide": { "type": "integer" },
          "maxSideRatio": { "type": "number" },
          "aspect": { "type": ["string", "null"] },
          "alphaAllowed": { "type": "boolean" },
          "minCount": { "type": "integer" },
          "maxCount": { "type": "integer" },
          "isScreenshot": { "type": "boolean" },
          "placementGroup": { "type": "string" },
          "note": { "type": "string" },
          "verifiedAt": { "type": "string", "format": "date" },
          "source": { "type": "string", "format": "uri" }
        },
        "allOf": [
          {
            "if": { "properties": { "mode": { "const": "exact" } } },
            "then": { "required": ["width", "height"] }
          },
          {
            "if": { "properties": { "mode": { "const": "range" } } },
            "then": { "required": ["reference", "minSide", "maxSide", "maxSideRatio"] }
          }
        ]
      }
    },
    "textLimits": {
      "type": "array",
      "items": {
        "type": "object",
        "required": ["store", "field", "maxLength", "required"],
        "properties": {
          "store": { "enum": ["apple", "play"] },
          "field": { "type": "string" },
          "maxLength": { "type": "integer" },
          "required": { "type": "boolean" }
        }
      }
    }
  }
}
