{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/gajo-io/json-schema/gajo-io-app-link-request-schema.json",
  "title": "AppLinkRequest",
  "description": "Create an app link (`iosUrl`, `androidUrl`, and `otherwise` required) or change one (only the fields given change; `customCode` is ignored).",
  "x-generated": "2026-11-09",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/gajo-io-openapi.json#/components/schemas/AppLinkRequest",
  "type": "object",
  "properties": {
    "iosUrl": {
      "type": "string",
      "description": "The app's App Store page (`https://apps.apple.com/.../id...`) or, for a beta, its TestFlight link (`https://testflight.apple.com/join/...`)."
    },
    "androidUrl": {
      "type": "string",
      "description": "The app's Google Play page (`https://play.google.com/store/apps/details?id=...`) or a Google Play test link (`https://play.google.com/apps/internaltest/...` or `/apps/testing/...`)."
    },
    "otherwise": {
      "$ref": "#/$defs/AppLinkStyle"
    },
    "appName": {
      "type": "string",
      "maxLength": 100,
      "description": "Optional; looked up from the App Store when omitted. Required for `store_badges` when the lookup can't find the app."
    },
    "customCode": {
      "type": "string",
      "description": "Create only: a custom code (3-50 letters, digits, or hyphens) for a `https://gajo.io/c/{code}` link."
    }
  },
  "$defs": {
    "AppLinkStyle": {
      "type": "string",
      "enum": [
        "mobile_only",
        "store_links",
        "store_badges"
      ],
      "description": "The page every device that isn't iOS or Android (desktops, link previews) sees, always with a QR code of the short link to scan with a phone: `mobile_only` says the link must be opened in a mobile browser; `store_links` lists both store URLs in full; `store_badges` shows the official App Store and Google Play badges under \"Click below to download {appName}\", so it needs both apps published: TestFlight and Google Play test links use `store_links` (which says they are test builds) or `mobile_only`."
    }
  }
}