{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://api.itch.io/schemas/game.json",
  "title": "Game",
  "description": "Represents a page on itch.io — a game, tool, comic, book, soundtrack, or other creative work published by a developer.",
  "type": "object",
  "properties": {
    "id": {
      "type": "integer",
      "description": "Site-wide unique identifier generated by itch.io"
    },
    "url": {
      "type": "string",
      "format": "uri",
      "description": "Canonical address of the game's page on itch.io"
    },
    "title": {
      "type": "string",
      "description": "Human-friendly title; may contain any character"
    },
    "shortText": {
      "type": "string",
      "description": "Human-friendly short description"
    },
    "type": {
      "type": "string",
      "enum": ["default", "flash", "unity", "java", "html"],
      "description": "Type of the game page: downloadable or embedded"
    },
    "classification": {
      "type": "string",
      "enum": ["game", "tool", "assets", "game_mod", "physical_game", "soundtrack", "other", "comic", "book"],
      "description": "Creator-picked classification for the page"
    },
    "embed": {
      "type": "object",
      "description": "Configuration for embedded (HTML5) games",
      "properties": {
        "gameId": { "type": "integer" },
        "width": { "type": "integer", "description": "Width of the initial viewport in pixels" },
        "height": { "type": "integer", "description": "Height of the initial viewport in pixels" },
        "fullscreen": { "type": "boolean", "description": "Whether a fullscreen button should be shown" }
      }
    },
    "coverUrl": {
      "type": "string",
      "format": "uri",
      "description": "Cover URL; might be a GIF"
    },
    "stillCoverUrl": {
      "type": "string",
      "format": "uri",
      "description": "Non-animated cover URL; only set when coverUrl is a GIF"
    },
    "createdAt": {
      "type": "string",
      "format": "date-time",
      "description": "RFC 3339 timestamp when the game page was created"
    },
    "publishedAt": {
      "type": ["string", "null"],
      "format": "date-time",
      "description": "RFC 3339 timestamp when the game was published; null if not published"
    },
    "minPrice": {
      "type": "integer",
      "description": "Minimum price in cents of a dollar (0 = free)"
    },
    "canBeBought": {
      "type": "boolean",
      "description": "Whether payments are accepted for this game"
    },
    "hasDemo": {
      "type": "boolean",
      "description": "Whether a free demo is available"
    },
    "inPressSystem": {
      "type": "boolean",
      "description": "Whether this game is part of the itch.io press system"
    },
    "platforms": {
      "type": "object",
      "description": "Platforms this game is available for",
      "properties": {
        "windows": { "type": "string", "enum": ["all", "386", "amd64"] },
        "linux":   { "type": "string", "enum": ["all", "386", "amd64"] },
        "osx":     { "type": "string", "enum": ["all", "386", "amd64"] }
      }
    },
    "user": {
      "$ref": "user.json",
      "description": "The user account this game is associated to"
    },
    "userId": {
      "type": "integer",
      "description": "ID of the user account this game is associated to"
    },
    "sale": {
      "type": ["object", "null"],
      "description": "The best current sale for this game",
      "properties": {
        "id": { "type": "integer" },
        "gameId": { "type": "integer" },
        "rate": { "type": "number", "description": "Discount rate in percent; may be negative (reverse sale)" },
        "startDate": { "type": "string", "format": "date-time" },
        "endDate": { "type": "string", "format": "date-time" }
      }
    },
    "viewsCount": {
      "type": "integer",
      "description": "Owner-only: total view count"
    },
    "downloadsCount": {
      "type": "integer",
      "description": "Owner-only: total download count"
    },
    "purchasesCount": {
      "type": "integer",
      "description": "Owner-only: total purchase count"
    },
    "published": {
      "type": "boolean",
      "description": "Owner-only: whether the game is currently published"
    }
  },
  "required": ["id"]
}
