{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://agilink.io/contracts/native-links/v1/resolution.schema.json",
  "title": "Agilink resolution v1",
  "type": "object",
  "required": [
    "version",
    "link"
  ],
  "additionalProperties": false,
  "properties": {
    "version": {
      "const": 1
    },
    "link": {
      "type": "object",
      "required": [
        "id",
        "appId",
        "domain",
        "prefix",
        "slug",
        "appPath",
        "title",
        "description",
        "imageUrl",
        "webUrl",
        "webOnly",
        "parameters"
      ],
      "additionalProperties": false,
      "properties": {
        "id": {
          "type": "string"
        },
        "appId": {
          "type": "string"
        },
        "domain": {
          "type": "string"
        },
        "prefix": {
          "type": "string"
        },
        "slug": {
          "type": "string"
        },
        "appPath": {
          "type": [
            "string",
            "null"
          ],
          "maxLength": 2048
        },
        "title": {
          "type": [
            "string",
            "null"
          ],
          "maxLength": 1000
        },
        "description": {
          "type": [
            "string",
            "null"
          ],
          "maxLength": 4000
        },
        "imageUrl": {
          "type": [
            "string",
            "null"
          ],
          "maxLength": 4096
        },
        "webUrl": {
          "type": [
            "string",
            "null"
          ],
          "maxLength": 4096
        },
        "webOnly": {
          "type": "boolean"
        },
        "parameters": {
          "type": "object"
        }
      },
      "allOf": [
        {
          "if": {
            "properties": {
              "webOnly": {
                "const": true
              }
            }
          },
          "then": {
            "properties": {
              "webUrl": {
                "type": "string",
                "minLength": 1
              }
            }
          }
        }
      ]
    }
  }
}
