{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://capp.uk/schemas/capp.guide-action-progress.v1.schema.json",
  "title": "Guide application action progress",
  "type": "object",
  "required": [
    "protocol",
    "complete"
  ],
  "properties": {
    "protocol": {
      "const": "capp.guide-action-progress.v1"
    },
    "complete": {
      "type": "boolean"
    },
    "title": {
      "type": "string",
      "minLength": 1,
      "maxLength": 120
    },
    "body": {
      "type": "string",
      "minLength": 1,
      "maxLength": 700
    },
    "label": {
      "type": "string",
      "minLength": 1,
      "maxLength": 120
    },
    "checkpoint": {
      "type": "string",
      "minLength": 1,
      "maxLength": 200
    },
    "handoff": {
      "type": "object",
      "description": "Optional app-owned website handoff. Skipped when in-app tabs are unavailable; does not complete the checkpoint.",
      "required": [
        "id",
        "url",
        "title",
        "body",
        "copyLabel",
        "copyText"
      ],
      "properties": {
        "id": {
          "type": "string",
          "minLength": 1,
          "maxLength": 200
        },
        "url": {
          "type": "string",
          "minLength": 1,
          "maxLength": 4096,
          "format": "uri",
          "pattern": "^https://"
        },
        "title": {
          "type": "string",
          "minLength": 1,
          "maxLength": 120
        },
        "body": {
          "type": "string",
          "minLength": 1,
          "maxLength": 700
        },
        "copyLabel": {
          "type": "string",
          "minLength": 1,
          "maxLength": 120
        },
        "copyText": {
          "type": "string",
          "minLength": 1,
          "maxLength": 2000
        }
      },
      "additionalProperties": false
    }
  },
  "allOf": [
    {
      "if": {
        "properties": {
          "complete": {
            "const": false
          }
        }
      },
      "then": {
        "required": [
          "title",
          "body",
          "label",
          "checkpoint"
        ]
      }
    }
  ],
  "additionalProperties": false
}
