{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://api.itch.io/schemas/upload.json",
  "title": "Upload",
  "description": "A downloadable file associated with a game. May be wharf-enabled (versioned channel-based distribution via butler).",
  "type": "object",
  "properties": {
    "id": {
      "type": "integer",
      "description": "Site-wide unique identifier generated by itch.io"
    },
    "storage": {
      "type": "string",
      "enum": ["hosted", "build", "external"],
      "description": "Storage backend: hosted (classic web upload), build (wharf/butler), or external"
    },
    "host": {
      "type": "string",
      "description": "Hostname if storage is external"
    },
    "filename": {
      "type": "string",
      "description": "Original file name (e.g. Overland_x64.zip)"
    },
    "displayName": {
      "type": "string",
      "description": "Human-friendly name set by the developer (e.g. Overland for Windows 64-bit)"
    },
    "size": {
      "type": "integer",
      "description": "Size in bytes; for wharf uploads this is the archive size"
    },
    "channelName": {
      "type": "string",
      "description": "Name of the wharf channel for this upload; only set for wharf-enabled uploads"
    },
    "build": {
      "$ref": "build.json",
      "description": "Latest build for this upload; only set for wharf-enabled uploads"
    },
    "buildId": {
      "type": "integer",
      "description": "ID of the latest build; only set for wharf-enabled uploads"
    },
    "type": {
      "type": "string",
      "enum": [
        "default", "flash", "unity", "java", "html",
        "soundtrack", "book", "video", "documentation",
        "mod", "audio_assets", "graphical_assets", "sourcecode", "other"
      ],
      "description": "Upload type describing the content"
    },
    "preorder": {
      "type": "boolean",
      "description": "Whether this upload is a pre-order placeholder"
    },
    "demo": {
      "type": "boolean",
      "description": "Whether this upload is a free demo"
    },
    "platforms": {
      "type": "object",
      "description": "Platforms this upload is compatible with",
      "properties": {
        "windows": { "type": "string", "enum": ["all", "386", "amd64"] },
        "linux":   { "type": "string", "enum": ["all", "386", "amd64"] },
        "osx":     { "type": "string", "enum": ["all", "386", "amd64"] }
      }
    },
    "createdAt": {
      "type": "string",
      "format": "date-time",
      "description": "RFC 3339 timestamp when this upload was created"
    },
    "updatedAt": {
      "type": "string",
      "format": "date-time",
      "description": "RFC 3339 timestamp when this upload was last updated"
    }
  },
  "required": ["id", "filename"]
}
