{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "ringstack.json",
  "type": "object",
  "required": [
    "slug",
    "title",
    "version"
  ],
  "properties": {
    "$schema": {
      "type": "string"
    },
    "slug": {
      "type": "string",
      "pattern": "^[a-z0-9](?:[a-z0-9-]{0,38}[a-z0-9])?$",
      "description": "Permanent id and URL of the game"
    },
    "title": {
      "type": "string",
      "minLength": 2,
      "maxLength": 60
    },
    "version": {
      "type": "string",
      "description": "Semver; bump it for every publish"
    },
    "tagline": {
      "type": "string",
      "maxLength": 120
    },
    "description": {
      "type": "string",
      "maxLength": 5000
    },
    "tags": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "maxItems": 8
    },
    "aspect": {
      "enum": [
        "16:9",
        "4:3",
        "1:1",
        "3:4",
        "9:16",
        "21:9"
      ]
    },
    "dir": {
      "type": "string",
      "description": "Folder to upload (default public)"
    },
    "build": {
      "type": [
        "string",
        "null"
      ],
      "description": "Command to run before uploading"
    },
    "spa": {
      "type": "boolean",
      "description": "Serve index.html for unknown paths"
    },
    "thumbnail": {
      "type": [
        "string",
        "null"
      ],
      "description": "PNG/JPEG/WebP, 1280x720, outside dir"
    },
    "portal": {
      "type": "string"
    },
    "achievements": {
      "type": "array",
      "maxItems": 100,
      "items": {
        "type": "object",
        "required": [
          "key",
          "name"
        ],
        "properties": {
          "key": {
            "type": "string",
            "pattern": "^[a-z0-9_]{1,32}$"
          },
          "name": {
            "type": "string",
            "maxLength": 60
          },
          "description": {
            "type": "string",
            "maxLength": 200
          },
          "points": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100
          },
          "icon": {
            "enum": [
              "star",
              "trophy",
              "bolt",
              "heart",
              "flag",
              "crown",
              "gem",
              "rocket",
              "shield",
              "target"
            ]
          },
          "hidden": {
            "type": "boolean"
          }
        }
      }
    },
    "leaderboards": {
      "type": "array",
      "maxItems": 25,
      "items": {
        "type": "object",
        "required": [
          "key"
        ],
        "properties": {
          "key": {
            "type": "string",
            "pattern": "^[a-z0-9_]{1,32}$"
          },
          "name": {
            "type": "string",
            "maxLength": 40
          },
          "aggregate": {
            "enum": [
              "max",
              "min",
              "sum",
              "latest"
            ]
          },
          "sort": {
            "enum": [
              "desc",
              "asc"
            ]
          },
          "leaderboard": {
            "type": "boolean"
          }
        }
      }
    },
    "items": {
      "type": "array",
      "maxItems": 100,
      "items": {
        "type": "object",
        "required": [
          "sku",
          "name",
          "price"
        ],
        "properties": {
          "sku": {
            "type": "string",
            "pattern": "^[a-z0-9_]{1,32}$"
          },
          "name": {
            "type": "string",
            "maxLength": 60
          },
          "description": {
            "type": "string",
            "maxLength": 200
          },
          "price": {
            "type": "integer",
            "minimum": 1
          },
          "consumable": {
            "type": "boolean"
          },
          "active": {
            "type": "boolean"
          }
        }
      }
    }
  }
}