{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://agilink.io/contracts/platform-api/v1/schemas.json",
  "title": "Agilink Platform API v1 — contratos A3b",
  "$defs": {
    "OpaqueId": {
      "type": "string",
      "maxLength": 500,
      "minLength": 1,
      "pattern": "^[^/\\u0000-\\u001f\\u007f]+$"
    },
    "Revision": {
      "type": "string",
      "format": "uuid"
    },
    "RequestId": {
      "type": "string",
      "maxLength": 36,
      "pattern": "^req_[a-f0-9]{32}$"
    },
    "IdempotencyKey": {
      "type": "string",
      "maxLength": 36,
      "pattern": "^[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}$"
    },
    "IfMatch": {
      "type": "string",
      "maxLength": 38,
      "pattern": "^\"[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}\"$"
    },
    "Domain": {
      "type": "string",
      "maxLength": 253,
      "pattern": "^(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$"
    },
    "LinkId": {
      "type": "string",
      "maxLength": 500,
      "pattern": "^[a-z0-9.-]+~-(?:(?!~-)[A-Za-z0-9._~-])*~-(?:(?!~-)[A-Za-z0-9._~-])+$"
    },
    "HttpsUrl": {
      "type": "string",
      "maxLength": 4096,
      "format": "uri",
      "pattern": "^https://[^/@?#\\s]+(?:[/?#]|$)"
    },
    "Permission": {
      "enum": [
        "analytics:read",
        "api_keys:create",
        "api_keys:delete",
        "api_keys:read",
        "api_keys:rotate",
        "api_keys:update",
        "apps:create",
        "apps:delete",
        "apps:read",
        "apps:update",
        "assets:create",
        "assets:delete",
        "assets:read",
        "audit_events:read",
        "batches:create",
        "batches:read",
        "campaigns:create",
        "campaigns:delete",
        "campaigns:read",
        "campaigns:update",
        "capabilities:read",
        "dns:create",
        "dns:delete",
        "dns:read",
        "dns:update",
        "domains:create",
        "domains:delete",
        "domains:read",
        "domains:verify",
        "exports:create",
        "exports:read",
        "folders:create",
        "folders:delete",
        "folders:read",
        "folders:update",
        "identity:read",
        "imports:commit",
        "imports:create",
        "imports:read",
        "imports:validate",
        "link_history:read",
        "links:create",
        "links:delete",
        "links:preview",
        "links:read",
        "links:resync",
        "links:update",
        "links:validate",
        "native_config:read",
        "native_config:update",
        "operations:cancel",
        "operations:read",
        "preferences:read",
        "preferences:update",
        "profile:update",
        "qr_codes:create",
        "qr_codes:delete",
        "qr_codes:read",
        "qr_codes:update",
        "recovery_config:read",
        "recovery_config:update",
        "requests:read",
        "routing_rules:read",
        "routing_rules:update",
        "tags:create",
        "tags:delete",
        "tags:read",
        "tags:update",
        "template_bindings:read",
        "template_bindings:update",
        "templates:create",
        "templates:preview",
        "templates:publish",
        "templates:read",
        "templates:retry",
        "templates:snapshot",
        "templates:update",
        "templates:validate",
        "usage:read",
        "web_config:read",
        "web_config:update",
        "webhooks:create",
        "webhooks:delete",
        "webhooks:read",
        "webhooks:retry",
        "webhooks:rotate_secret",
        "webhooks:test",
        "webhooks:update"
      ]
    },
    "Cursor": {
      "type": "string",
      "maxLength": 2048,
      "pattern": "^c1\\.[A-Za-z0-9_-]+\\.[A-Za-z0-9_-]+$"
    },
    "JsonValue": {
      "anyOf": [
        {
          "type": [
            "string",
            "number",
            "boolean",
            "null"
          ]
        },
        {
          "type": "array",
          "items": {
            "$ref": "#/$defs/JsonValue"
          }
        },
        {
          "type": "object",
          "additionalProperties": {
            "$ref": "#/$defs/JsonValue"
          }
        }
      ]
    },
    "Parameters": {
      "type": "object",
      "additionalProperties": {
        "$ref": "#/$defs/JsonValue"
      },
      "$comment": "Validar profundidade <= 5 e JSON UTF-8 <= 16 KiB no validador semântico."
    },
    "Meta": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "requestId": {
          "$ref": "#/$defs/RequestId"
        }
      },
      "required": [
        "requestId"
      ]
    },
    "Error": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "code": {
          "enum": [
            "invalid_request",
            "validation_failed",
            "unauthenticated",
            "insufficient_permission",
            "not_found",
            "resource_conflict",
            "idempotency_conflict",
            "operation_in_progress",
            "secret_not_replayable",
            "invalid_cursor",
            "revision_conflict",
            "precondition_required",
            "payload_too_large",
            "unsupported_media_type",
            "rate_limited",
            "feature_disabled",
            "resource_expired",
            "dependency_unavailable",
            "internal_error"
          ]
        },
        "message": {
          "type": "string",
          "maxLength": 1000,
          "minLength": 1
        },
        "details": {
          "type": "array",
          "items": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "field": {
                "type": "string",
                "maxLength": 200
              },
              "reason": {
                "type": "string",
                "maxLength": 100
              },
              "permission": {
                "type": "string",
                "maxLength": 100
              }
            },
            "required": []
          },
          "maxItems": 50
        },
        "requestId": {
          "$ref": "#/$defs/RequestId"
        },
        "documentationUrl": {
          "type": "string",
          "maxLength": 4096,
          "format": "uri",
          "pattern": "^https://[^/@?#\\s]+(?:[/?#]|$)"
        },
        "resource": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "type": {
              "type": "string",
              "maxLength": 100,
              "minLength": 1
            },
            "id": {
              "type": "string",
              "maxLength": 500,
              "minLength": 1,
              "pattern": "^[^/\\u0000-\\u001f\\u007f]+$"
            }
          },
          "required": [
            "type",
            "id"
          ]
        }
      },
      "required": [
        "code",
        "message",
        "requestId",
        "documentationUrl"
      ]
    },
    "ErrorEnvelope": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "error": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "code": {
              "enum": [
                "invalid_request",
                "validation_failed",
                "unauthenticated",
                "insufficient_permission",
                "not_found",
                "resource_conflict",
                "idempotency_conflict",
                "operation_in_progress",
                "secret_not_replayable",
                "invalid_cursor",
                "revision_conflict",
                "precondition_required",
                "payload_too_large",
                "unsupported_media_type",
                "rate_limited",
                "feature_disabled",
                "resource_expired",
                "dependency_unavailable",
                "internal_error"
              ]
            },
            "message": {
              "type": "string",
              "maxLength": 1000,
              "minLength": 1
            },
            "details": {
              "type": "array",
              "items": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "field": {
                    "type": "string",
                    "maxLength": 200
                  },
                  "reason": {
                    "type": "string",
                    "maxLength": 100
                  },
                  "permission": {
                    "type": "string",
                    "maxLength": 100
                  }
                },
                "required": []
              },
              "maxItems": 50
            },
            "requestId": {
              "$ref": "#/$defs/RequestId"
            },
            "documentationUrl": {
              "type": "string",
              "maxLength": 4096,
              "format": "uri",
              "pattern": "^https://[^/@?#\\s]+(?:[/?#]|$)"
            },
            "resource": {
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "type": {
                  "type": "string",
                  "maxLength": 100,
                  "minLength": 1
                },
                "id": {
                  "type": "string",
                  "maxLength": 500,
                  "minLength": 1,
                  "pattern": "^[^/\\u0000-\\u001f\\u007f]+$"
                }
              },
              "required": [
                "type",
                "id"
              ]
            }
          },
          "required": [
            "code",
            "message",
            "requestId",
            "documentationUrl"
          ]
        }
      },
      "required": [
        "error"
      ]
    },
    "LinkCreate": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "appId": {
          "type": "string",
          "maxLength": 500,
          "minLength": 1,
          "pattern": "^[^/\\u0000-\\u001f\\u007f]+$"
        },
        "domain": {
          "$ref": "#/$defs/Domain"
        },
        "prefix": {
          "type": "string",
          "maxLength": 200,
          "pattern": "^(?!.*~-)(?!\\.{1,2}$)[A-Za-z0-9._~-]*$"
        },
        "slug": {
          "type": "string",
          "maxLength": 200,
          "pattern": "^(?!.*~-)(?!\\.{1,2}$)[A-Za-z0-9._~-]*$",
          "minLength": 1
        },
        "folderId": {
          "anyOf": [
            {
              "type": "string",
              "format": "uuid"
            },
            {
              "type": "null"
            }
          ]
        },
        "campaignId": {
          "anyOf": [
            {
              "type": "string",
              "format": "uuid"
            },
            {
              "type": "null"
            }
          ]
        },
        "lifecycle": {
          "$ref": "#/$defs/LinkLifecycle"
        },
        "utm": {
          "$ref": "#/$defs/UtmParameters"
        },
        "title": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 1000,
              "pattern": "^[^\\u0000-\\u001f\\u007f]*$"
            },
            {
              "type": "null"
            }
          ]
        },
        "description": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 4000,
              "pattern": "^[^\\u0000-\\u001f\\u007f]*$"
            },
            {
              "type": "null"
            }
          ]
        },
        "imageUrl": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 4096,
              "format": "uri",
              "pattern": "^https://[^/@?#\\s]+(?:[/?#]|$)"
            },
            {
              "type": "null"
            }
          ]
        },
        "desktopUrl": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 4096,
              "format": "uri",
              "pattern": "^https://[^/@?#\\s]+(?:[/?#]|$)"
            },
            {
              "type": "null"
            }
          ]
        },
        "playStoreUrl": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 4096,
              "format": "uri",
              "pattern": "^https://[^/@?#\\s]+(?:[/?#]|$)"
            },
            {
              "type": "null"
            }
          ]
        },
        "appStoreUrl": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 4096,
              "format": "uri",
              "pattern": "^https://[^/@?#\\s]+(?:[/?#]|$)"
            },
            {
              "type": "null"
            }
          ]
        },
        "appPath": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 2048,
              "minLength": 1,
              "pattern": "^(?!/)(?!.*[?#\\\\])(?!.*(?:^|/)\\.{1,2}(?:/|$))[^/]+(?:/[^/]+)*$"
            },
            {
              "type": "null"
            }
          ]
        },
        "parameters": {
          "$ref": "#/$defs/Parameters"
        },
        "webOnly": {
          "type": "boolean"
        },
        "behavior": {
          "enum": [
            "manual",
            "automatic",
            "intelligent"
          ]
        },
        "group": {
          "enum": [
            "main",
            "operational"
          ]
        },
        "templateData": {
          "type": "object",
          "additionalProperties": {
            "type": [
              "string",
              "number",
              "boolean"
            ]
          }
        },
        "templateSelection": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "android": {
              "oneOf": [
                {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "mode": {
                      "const": "inherit"
                    }
                  },
                  "required": [
                    "mode"
                  ]
                },
                {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "mode": {
                      "const": "official"
                    }
                  },
                  "required": [
                    "mode"
                  ]
                },
                {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "mode": {
                      "const": "custom"
                    },
                    "templateId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "version": {
                      "type": "integer",
                      "minimum": 1
                    }
                  },
                  "required": [
                    "mode",
                    "templateId",
                    "version"
                  ]
                }
              ]
            },
            "ios": {
              "oneOf": [
                {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "mode": {
                      "const": "inherit"
                    }
                  },
                  "required": [
                    "mode"
                  ]
                },
                {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "mode": {
                      "const": "official"
                    }
                  },
                  "required": [
                    "mode"
                  ]
                },
                {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "mode": {
                      "const": "custom"
                    },
                    "templateId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "version": {
                      "type": "integer",
                      "minimum": 1
                    }
                  },
                  "required": [
                    "mode",
                    "templateId",
                    "version"
                  ]
                }
              ]
            },
            "recovery": {
              "oneOf": [
                {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "mode": {
                      "const": "inherit"
                    }
                  },
                  "required": [
                    "mode"
                  ]
                },
                {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "mode": {
                      "const": "official"
                    }
                  },
                  "required": [
                    "mode"
                  ]
                },
                {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "mode": {
                      "const": "custom"
                    },
                    "templateId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "version": {
                      "type": "integer",
                      "minimum": 1
                    }
                  },
                  "required": [
                    "mode",
                    "templateId",
                    "version"
                  ]
                }
              ]
            }
          },
          "required": []
        }
      },
      "required": [
        "appId",
        "domain",
        "slug"
      ]
    },
    "LinkPatch": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "folderId": {
          "anyOf": [
            {
              "type": "string",
              "format": "uuid"
            },
            {
              "type": "null"
            }
          ]
        },
        "campaignId": {
          "anyOf": [
            {
              "type": "string",
              "format": "uuid"
            },
            {
              "type": "null"
            }
          ]
        },
        "lifecycle": {
          "$ref": "#/$defs/LinkLifecycle"
        },
        "utm": {
          "$ref": "#/$defs/UtmParameters"
        },
        "title": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 1000,
              "pattern": "^[^\\u0000-\\u001f\\u007f]*$"
            },
            {
              "type": "null"
            }
          ]
        },
        "description": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 4000,
              "pattern": "^[^\\u0000-\\u001f\\u007f]*$"
            },
            {
              "type": "null"
            }
          ]
        },
        "imageUrl": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 4096,
              "format": "uri",
              "pattern": "^https://[^/@?#\\s]+(?:[/?#]|$)"
            },
            {
              "type": "null"
            }
          ]
        },
        "desktopUrl": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 4096,
              "format": "uri",
              "pattern": "^https://[^/@?#\\s]+(?:[/?#]|$)"
            },
            {
              "type": "null"
            }
          ]
        },
        "playStoreUrl": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 4096,
              "format": "uri",
              "pattern": "^https://[^/@?#\\s]+(?:[/?#]|$)"
            },
            {
              "type": "null"
            }
          ]
        },
        "appStoreUrl": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 4096,
              "format": "uri",
              "pattern": "^https://[^/@?#\\s]+(?:[/?#]|$)"
            },
            {
              "type": "null"
            }
          ]
        },
        "appPath": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 2048,
              "minLength": 1,
              "pattern": "^(?!/)(?!.*[?#\\\\])(?!.*(?:^|/)\\.{1,2}(?:/|$))[^/]+(?:/[^/]+)*$"
            },
            {
              "type": "null"
            }
          ]
        },
        "parameters": {
          "$ref": "#/$defs/Parameters"
        },
        "webOnly": {
          "type": "boolean"
        },
        "behavior": {
          "enum": [
            "manual",
            "automatic",
            "intelligent"
          ]
        },
        "group": {
          "enum": [
            "main",
            "operational"
          ]
        },
        "templateData": {
          "type": "object",
          "additionalProperties": {
            "type": [
              "string",
              "number",
              "boolean"
            ]
          }
        },
        "templateSelection": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "android": {
              "oneOf": [
                {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "mode": {
                      "const": "inherit"
                    }
                  },
                  "required": [
                    "mode"
                  ]
                },
                {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "mode": {
                      "const": "official"
                    }
                  },
                  "required": [
                    "mode"
                  ]
                },
                {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "mode": {
                      "const": "custom"
                    },
                    "templateId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "version": {
                      "type": "integer",
                      "minimum": 1
                    }
                  },
                  "required": [
                    "mode",
                    "templateId",
                    "version"
                  ]
                }
              ]
            },
            "ios": {
              "oneOf": [
                {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "mode": {
                      "const": "inherit"
                    }
                  },
                  "required": [
                    "mode"
                  ]
                },
                {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "mode": {
                      "const": "official"
                    }
                  },
                  "required": [
                    "mode"
                  ]
                },
                {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "mode": {
                      "const": "custom"
                    },
                    "templateId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "version": {
                      "type": "integer",
                      "minimum": 1
                    }
                  },
                  "required": [
                    "mode",
                    "templateId",
                    "version"
                  ]
                }
              ]
            },
            "recovery": {
              "oneOf": [
                {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "mode": {
                      "const": "inherit"
                    }
                  },
                  "required": [
                    "mode"
                  ]
                },
                {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "mode": {
                      "const": "official"
                    }
                  },
                  "required": [
                    "mode"
                  ]
                },
                {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "mode": {
                      "const": "custom"
                    },
                    "templateId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "version": {
                      "type": "integer",
                      "minimum": 1
                    }
                  },
                  "required": [
                    "mode",
                    "templateId",
                    "version"
                  ]
                }
              ]
            }
          },
          "required": []
        }
      },
      "required": [],
      "minProperties": 1
    },
    "Link": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "id": {
          "$ref": "#/$defs/LinkId"
        },
        "appId": {
          "type": "string",
          "maxLength": 500,
          "minLength": 1,
          "pattern": "^[^/\\u0000-\\u001f\\u007f]+$"
        },
        "domain": {
          "$ref": "#/$defs/Domain"
        },
        "prefix": {
          "type": "string",
          "maxLength": 200,
          "pattern": "^(?!.*~-)(?!\\.{1,2}$)[A-Za-z0-9._~-]*$"
        },
        "slug": {
          "type": "string",
          "maxLength": 200,
          "pattern": "^(?!.*~-)(?!\\.{1,2}$)[A-Za-z0-9._~-]*$",
          "minLength": 1
        },
        "url": {
          "type": "string",
          "maxLength": 4096,
          "format": "uri",
          "pattern": "^https://[^/@?#\\s]+(?:[/?#]|$)"
        },
        "folderId": {
          "anyOf": [
            {
              "type": "string",
              "format": "uuid"
            },
            {
              "type": "null"
            }
          ]
        },
        "campaignId": {
          "anyOf": [
            {
              "type": "string",
              "format": "uuid"
            },
            {
              "type": "null"
            }
          ]
        },
        "lifecycle": {
          "$ref": "#/$defs/LinkLifecycle"
        },
        "utm": {
          "$ref": "#/$defs/UtmParameters"
        },
        "title": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 1000,
              "pattern": "^[^\\u0000-\\u001f\\u007f]*$"
            },
            {
              "type": "null"
            }
          ]
        },
        "description": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 4000,
              "pattern": "^[^\\u0000-\\u001f\\u007f]*$"
            },
            {
              "type": "null"
            }
          ]
        },
        "imageUrl": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 4096,
              "format": "uri",
              "pattern": "^https://[^/@?#\\s]+(?:[/?#]|$)"
            },
            {
              "type": "null"
            }
          ]
        },
        "desktopUrl": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 4096,
              "format": "uri",
              "pattern": "^https://[^/@?#\\s]+(?:[/?#]|$)"
            },
            {
              "type": "null"
            }
          ]
        },
        "playStoreUrl": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 4096,
              "format": "uri",
              "pattern": "^https://[^/@?#\\s]+(?:[/?#]|$)"
            },
            {
              "type": "null"
            }
          ]
        },
        "appStoreUrl": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 4096,
              "format": "uri",
              "pattern": "^https://[^/@?#\\s]+(?:[/?#]|$)"
            },
            {
              "type": "null"
            }
          ]
        },
        "appPath": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 2048,
              "minLength": 1,
              "pattern": "^(?!/)(?!.*[?#\\\\])(?!.*(?:^|/)\\.{1,2}(?:/|$))[^/]+(?:/[^/]+)*$"
            },
            {
              "type": "null"
            }
          ]
        },
        "parameters": {
          "$ref": "#/$defs/Parameters"
        },
        "webOnly": {
          "type": "boolean"
        },
        "behavior": {
          "enum": [
            "manual",
            "automatic",
            "intelligent"
          ]
        },
        "group": {
          "enum": [
            "main",
            "operational"
          ]
        },
        "templateData": {
          "type": "object",
          "additionalProperties": {
            "type": [
              "string",
              "number",
              "boolean"
            ]
          }
        },
        "templateSelection": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "android": {
              "oneOf": [
                {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "mode": {
                      "const": "inherit"
                    }
                  },
                  "required": [
                    "mode"
                  ]
                },
                {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "mode": {
                      "const": "official"
                    }
                  },
                  "required": [
                    "mode"
                  ]
                },
                {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "mode": {
                      "const": "custom"
                    },
                    "templateId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "version": {
                      "type": "integer",
                      "minimum": 1
                    }
                  },
                  "required": [
                    "mode",
                    "templateId",
                    "version"
                  ]
                }
              ]
            },
            "ios": {
              "oneOf": [
                {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "mode": {
                      "const": "inherit"
                    }
                  },
                  "required": [
                    "mode"
                  ]
                },
                {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "mode": {
                      "const": "official"
                    }
                  },
                  "required": [
                    "mode"
                  ]
                },
                {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "mode": {
                      "const": "custom"
                    },
                    "templateId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "version": {
                      "type": "integer",
                      "minimum": 1
                    }
                  },
                  "required": [
                    "mode",
                    "templateId",
                    "version"
                  ]
                }
              ]
            },
            "recovery": {
              "oneOf": [
                {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "mode": {
                      "const": "inherit"
                    }
                  },
                  "required": [
                    "mode"
                  ]
                },
                {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "mode": {
                      "const": "official"
                    }
                  },
                  "required": [
                    "mode"
                  ]
                },
                {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "mode": {
                      "const": "custom"
                    },
                    "templateId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "version": {
                      "type": "integer",
                      "minimum": 1
                    }
                  },
                  "required": [
                    "mode",
                    "templateId",
                    "version"
                  ]
                }
              ]
            }
          },
          "required": []
        },
        "origin": {
          "enum": [
            "dashboard",
            "api"
          ]
        },
        "revision": {
          "type": "string",
          "format": "uuid"
        },
        "createdAt": {
          "type": "string",
          "format": "date-time"
        },
        "updatedAt": {
          "type": "string",
          "format": "date-time"
        },
        "publication": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "status": {
              "enum": [
                "pending",
                "synced",
                "failed"
              ]
            },
            "desiredRevision": {
              "type": "string",
              "format": "uuid"
            },
            "confirmedRevision": {
              "anyOf": [
                {
                  "type": "string",
                  "format": "uuid"
                },
                {
                  "type": "null"
                }
              ]
            },
            "updatedAt": {
              "type": "string",
              "format": "date-time"
            }
          },
          "required": [
            "status",
            "desiredRevision",
            "confirmedRevision",
            "updatedAt"
          ]
        },
        "tagIds": {
          "type": "array",
          "items": {
            "type": "string",
            "format": "uuid"
          },
          "maxItems": 20,
          "uniqueItems": true
        },
        "state": {
          "enum": [
            "active",
            "paused",
            "scheduled",
            "expired"
          ]
        }
      },
      "required": [
        "id",
        "appId",
        "domain",
        "prefix",
        "slug",
        "url",
        "title",
        "desktopUrl",
        "group",
        "origin",
        "revision",
        "createdAt",
        "updatedAt",
        "publication"
      ]
    },
    "LinkEnvelope": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "data": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "id": {
              "$ref": "#/$defs/LinkId"
            },
            "appId": {
              "type": "string",
              "maxLength": 500,
              "minLength": 1,
              "pattern": "^[^/\\u0000-\\u001f\\u007f]+$"
            },
            "domain": {
              "$ref": "#/$defs/Domain"
            },
            "prefix": {
              "type": "string",
              "maxLength": 200,
              "pattern": "^(?!.*~-)(?!\\.{1,2}$)[A-Za-z0-9._~-]*$"
            },
            "slug": {
              "type": "string",
              "maxLength": 200,
              "pattern": "^(?!.*~-)(?!\\.{1,2}$)[A-Za-z0-9._~-]*$",
              "minLength": 1
            },
            "url": {
              "type": "string",
              "maxLength": 4096,
              "format": "uri",
              "pattern": "^https://[^/@?#\\s]+(?:[/?#]|$)"
            },
            "folderId": {
              "anyOf": [
                {
                  "type": "string",
                  "format": "uuid"
                },
                {
                  "type": "null"
                }
              ]
            },
            "campaignId": {
              "anyOf": [
                {
                  "type": "string",
                  "format": "uuid"
                },
                {
                  "type": "null"
                }
              ]
            },
            "lifecycle": {
              "$ref": "#/$defs/LinkLifecycle"
            },
            "utm": {
              "$ref": "#/$defs/UtmParameters"
            },
            "title": {
              "anyOf": [
                {
                  "type": "string",
                  "maxLength": 1000,
                  "pattern": "^[^\\u0000-\\u001f\\u007f]*$"
                },
                {
                  "type": "null"
                }
              ]
            },
            "description": {
              "anyOf": [
                {
                  "type": "string",
                  "maxLength": 4000,
                  "pattern": "^[^\\u0000-\\u001f\\u007f]*$"
                },
                {
                  "type": "null"
                }
              ]
            },
            "imageUrl": {
              "anyOf": [
                {
                  "type": "string",
                  "maxLength": 4096,
                  "format": "uri",
                  "pattern": "^https://[^/@?#\\s]+(?:[/?#]|$)"
                },
                {
                  "type": "null"
                }
              ]
            },
            "desktopUrl": {
              "anyOf": [
                {
                  "type": "string",
                  "maxLength": 4096,
                  "format": "uri",
                  "pattern": "^https://[^/@?#\\s]+(?:[/?#]|$)"
                },
                {
                  "type": "null"
                }
              ]
            },
            "playStoreUrl": {
              "anyOf": [
                {
                  "type": "string",
                  "maxLength": 4096,
                  "format": "uri",
                  "pattern": "^https://[^/@?#\\s]+(?:[/?#]|$)"
                },
                {
                  "type": "null"
                }
              ]
            },
            "appStoreUrl": {
              "anyOf": [
                {
                  "type": "string",
                  "maxLength": 4096,
                  "format": "uri",
                  "pattern": "^https://[^/@?#\\s]+(?:[/?#]|$)"
                },
                {
                  "type": "null"
                }
              ]
            },
            "appPath": {
              "anyOf": [
                {
                  "type": "string",
                  "maxLength": 2048,
                  "minLength": 1,
                  "pattern": "^(?!/)(?!.*[?#\\\\])(?!.*(?:^|/)\\.{1,2}(?:/|$))[^/]+(?:/[^/]+)*$"
                },
                {
                  "type": "null"
                }
              ]
            },
            "parameters": {
              "$ref": "#/$defs/Parameters"
            },
            "webOnly": {
              "type": "boolean"
            },
            "behavior": {
              "enum": [
                "manual",
                "automatic",
                "intelligent"
              ]
            },
            "group": {
              "enum": [
                "main",
                "operational"
              ]
            },
            "templateData": {
              "type": "object",
              "additionalProperties": {
                "type": [
                  "string",
                  "number",
                  "boolean"
                ]
              }
            },
            "templateSelection": {
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "android": {
                  "oneOf": [
                    {
                      "type": "object",
                      "additionalProperties": false,
                      "properties": {
                        "mode": {
                          "const": "inherit"
                        }
                      },
                      "required": [
                        "mode"
                      ]
                    },
                    {
                      "type": "object",
                      "additionalProperties": false,
                      "properties": {
                        "mode": {
                          "const": "official"
                        }
                      },
                      "required": [
                        "mode"
                      ]
                    },
                    {
                      "type": "object",
                      "additionalProperties": false,
                      "properties": {
                        "mode": {
                          "const": "custom"
                        },
                        "templateId": {
                          "type": "string",
                          "format": "uuid"
                        },
                        "version": {
                          "type": "integer",
                          "minimum": 1
                        }
                      },
                      "required": [
                        "mode",
                        "templateId",
                        "version"
                      ]
                    }
                  ]
                },
                "ios": {
                  "oneOf": [
                    {
                      "type": "object",
                      "additionalProperties": false,
                      "properties": {
                        "mode": {
                          "const": "inherit"
                        }
                      },
                      "required": [
                        "mode"
                      ]
                    },
                    {
                      "type": "object",
                      "additionalProperties": false,
                      "properties": {
                        "mode": {
                          "const": "official"
                        }
                      },
                      "required": [
                        "mode"
                      ]
                    },
                    {
                      "type": "object",
                      "additionalProperties": false,
                      "properties": {
                        "mode": {
                          "const": "custom"
                        },
                        "templateId": {
                          "type": "string",
                          "format": "uuid"
                        },
                        "version": {
                          "type": "integer",
                          "minimum": 1
                        }
                      },
                      "required": [
                        "mode",
                        "templateId",
                        "version"
                      ]
                    }
                  ]
                },
                "recovery": {
                  "oneOf": [
                    {
                      "type": "object",
                      "additionalProperties": false,
                      "properties": {
                        "mode": {
                          "const": "inherit"
                        }
                      },
                      "required": [
                        "mode"
                      ]
                    },
                    {
                      "type": "object",
                      "additionalProperties": false,
                      "properties": {
                        "mode": {
                          "const": "official"
                        }
                      },
                      "required": [
                        "mode"
                      ]
                    },
                    {
                      "type": "object",
                      "additionalProperties": false,
                      "properties": {
                        "mode": {
                          "const": "custom"
                        },
                        "templateId": {
                          "type": "string",
                          "format": "uuid"
                        },
                        "version": {
                          "type": "integer",
                          "minimum": 1
                        }
                      },
                      "required": [
                        "mode",
                        "templateId",
                        "version"
                      ]
                    }
                  ]
                }
              },
              "required": []
            },
            "origin": {
              "enum": [
                "dashboard",
                "api"
              ]
            },
            "revision": {
              "type": "string",
              "format": "uuid"
            },
            "createdAt": {
              "type": "string",
              "format": "date-time"
            },
            "updatedAt": {
              "type": "string",
              "format": "date-time"
            },
            "publication": {
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "status": {
                  "enum": [
                    "pending",
                    "synced",
                    "failed"
                  ]
                },
                "desiredRevision": {
                  "type": "string",
                  "format": "uuid"
                },
                "confirmedRevision": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "uuid"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "updatedAt": {
                  "type": "string",
                  "format": "date-time"
                }
              },
              "required": [
                "status",
                "desiredRevision",
                "confirmedRevision",
                "updatedAt"
              ]
            },
            "tagIds": {
              "type": "array",
              "items": {
                "type": "string",
                "format": "uuid"
              },
              "maxItems": 20,
              "uniqueItems": true
            },
            "state": {
              "enum": [
                "active",
                "paused",
                "scheduled",
                "expired"
              ]
            }
          },
          "required": [
            "id",
            "appId",
            "domain",
            "prefix",
            "slug",
            "url",
            "title",
            "desktopUrl",
            "group",
            "origin",
            "revision",
            "createdAt",
            "updatedAt",
            "publication"
          ]
        },
        "meta": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "requestId": {
              "$ref": "#/$defs/RequestId"
            }
          },
          "required": [
            "requestId"
          ]
        }
      },
      "required": [
        "data",
        "meta"
      ]
    },
    "LinkListEnvelope": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "data": {
          "type": "array",
          "items": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "id": {
                "$ref": "#/$defs/LinkId"
              },
              "appId": {
                "type": "string",
                "maxLength": 500,
                "minLength": 1,
                "pattern": "^[^/\\u0000-\\u001f\\u007f]+$"
              },
              "domain": {
                "$ref": "#/$defs/Domain"
              },
              "prefix": {
                "type": "string",
                "maxLength": 200,
                "pattern": "^(?!.*~-)(?!\\.{1,2}$)[A-Za-z0-9._~-]*$"
              },
              "slug": {
                "type": "string",
                "maxLength": 200,
                "pattern": "^(?!.*~-)(?!\\.{1,2}$)[A-Za-z0-9._~-]*$",
                "minLength": 1
              },
              "url": {
                "type": "string",
                "maxLength": 4096,
                "format": "uri",
                "pattern": "^https://[^/@?#\\s]+(?:[/?#]|$)"
              },
              "folderId": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "uuid"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "campaignId": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "uuid"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "lifecycle": {
                "$ref": "#/$defs/LinkLifecycle"
              },
              "utm": {
                "$ref": "#/$defs/UtmParameters"
              },
              "title": {
                "anyOf": [
                  {
                    "type": "string",
                    "maxLength": 1000,
                    "pattern": "^[^\\u0000-\\u001f\\u007f]*$"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "description": {
                "anyOf": [
                  {
                    "type": "string",
                    "maxLength": 4000,
                    "pattern": "^[^\\u0000-\\u001f\\u007f]*$"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "imageUrl": {
                "anyOf": [
                  {
                    "type": "string",
                    "maxLength": 4096,
                    "format": "uri",
                    "pattern": "^https://[^/@?#\\s]+(?:[/?#]|$)"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "desktopUrl": {
                "anyOf": [
                  {
                    "type": "string",
                    "maxLength": 4096,
                    "format": "uri",
                    "pattern": "^https://[^/@?#\\s]+(?:[/?#]|$)"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "playStoreUrl": {
                "anyOf": [
                  {
                    "type": "string",
                    "maxLength": 4096,
                    "format": "uri",
                    "pattern": "^https://[^/@?#\\s]+(?:[/?#]|$)"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "appStoreUrl": {
                "anyOf": [
                  {
                    "type": "string",
                    "maxLength": 4096,
                    "format": "uri",
                    "pattern": "^https://[^/@?#\\s]+(?:[/?#]|$)"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "appPath": {
                "anyOf": [
                  {
                    "type": "string",
                    "maxLength": 2048,
                    "minLength": 1,
                    "pattern": "^(?!/)(?!.*[?#\\\\])(?!.*(?:^|/)\\.{1,2}(?:/|$))[^/]+(?:/[^/]+)*$"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "parameters": {
                "$ref": "#/$defs/Parameters"
              },
              "webOnly": {
                "type": "boolean"
              },
              "behavior": {
                "enum": [
                  "manual",
                  "automatic",
                  "intelligent"
                ]
              },
              "group": {
                "enum": [
                  "main",
                  "operational"
                ]
              },
              "templateData": {
                "type": "object",
                "additionalProperties": {
                  "type": [
                    "string",
                    "number",
                    "boolean"
                  ]
                }
              },
              "templateSelection": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "android": {
                    "oneOf": [
                      {
                        "type": "object",
                        "additionalProperties": false,
                        "properties": {
                          "mode": {
                            "const": "inherit"
                          }
                        },
                        "required": [
                          "mode"
                        ]
                      },
                      {
                        "type": "object",
                        "additionalProperties": false,
                        "properties": {
                          "mode": {
                            "const": "official"
                          }
                        },
                        "required": [
                          "mode"
                        ]
                      },
                      {
                        "type": "object",
                        "additionalProperties": false,
                        "properties": {
                          "mode": {
                            "const": "custom"
                          },
                          "templateId": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "version": {
                            "type": "integer",
                            "minimum": 1
                          }
                        },
                        "required": [
                          "mode",
                          "templateId",
                          "version"
                        ]
                      }
                    ]
                  },
                  "ios": {
                    "oneOf": [
                      {
                        "type": "object",
                        "additionalProperties": false,
                        "properties": {
                          "mode": {
                            "const": "inherit"
                          }
                        },
                        "required": [
                          "mode"
                        ]
                      },
                      {
                        "type": "object",
                        "additionalProperties": false,
                        "properties": {
                          "mode": {
                            "const": "official"
                          }
                        },
                        "required": [
                          "mode"
                        ]
                      },
                      {
                        "type": "object",
                        "additionalProperties": false,
                        "properties": {
                          "mode": {
                            "const": "custom"
                          },
                          "templateId": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "version": {
                            "type": "integer",
                            "minimum": 1
                          }
                        },
                        "required": [
                          "mode",
                          "templateId",
                          "version"
                        ]
                      }
                    ]
                  },
                  "recovery": {
                    "oneOf": [
                      {
                        "type": "object",
                        "additionalProperties": false,
                        "properties": {
                          "mode": {
                            "const": "inherit"
                          }
                        },
                        "required": [
                          "mode"
                        ]
                      },
                      {
                        "type": "object",
                        "additionalProperties": false,
                        "properties": {
                          "mode": {
                            "const": "official"
                          }
                        },
                        "required": [
                          "mode"
                        ]
                      },
                      {
                        "type": "object",
                        "additionalProperties": false,
                        "properties": {
                          "mode": {
                            "const": "custom"
                          },
                          "templateId": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "version": {
                            "type": "integer",
                            "minimum": 1
                          }
                        },
                        "required": [
                          "mode",
                          "templateId",
                          "version"
                        ]
                      }
                    ]
                  }
                },
                "required": []
              },
              "origin": {
                "enum": [
                  "dashboard",
                  "api"
                ]
              },
              "revision": {
                "type": "string",
                "format": "uuid"
              },
              "createdAt": {
                "type": "string",
                "format": "date-time"
              },
              "updatedAt": {
                "type": "string",
                "format": "date-time"
              },
              "publication": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "status": {
                    "enum": [
                      "pending",
                      "synced",
                      "failed"
                    ]
                  },
                  "desiredRevision": {
                    "type": "string",
                    "format": "uuid"
                  },
                  "confirmedRevision": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "uuid"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "updatedAt": {
                    "type": "string",
                    "format": "date-time"
                  }
                },
                "required": [
                  "status",
                  "desiredRevision",
                  "confirmedRevision",
                  "updatedAt"
                ]
              },
              "tagIds": {
                "type": "array",
                "items": {
                  "type": "string",
                  "format": "uuid"
                },
                "maxItems": 20,
                "uniqueItems": true
              },
              "state": {
                "enum": [
                  "active",
                  "paused",
                  "scheduled",
                  "expired"
                ]
              }
            },
            "required": [
              "id",
              "appId",
              "domain",
              "prefix",
              "slug",
              "url",
              "title",
              "desktopUrl",
              "group",
              "origin",
              "revision",
              "createdAt",
              "updatedAt",
              "publication"
            ]
          },
          "maxItems": 100
        },
        "pagination": {
          "$ref": "#/$defs/Pagination"
        },
        "meta": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "requestId": {
              "$ref": "#/$defs/RequestId"
            }
          },
          "required": [
            "requestId"
          ]
        }
      },
      "required": [
        "data",
        "pagination",
        "meta"
      ]
    },
    "Pagination": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "nextCursor": {
          "anyOf": [
            {
              "$ref": "#/$defs/Cursor"
            },
            {
              "type": "null"
            }
          ]
        },
        "hasMore": {
          "type": "boolean"
        }
      },
      "required": [
        "nextCursor",
        "hasMore"
      ]
    },
    "AppId": {
      "type": "string",
      "maxLength": 200,
      "minLength": 1,
      "pattern": "^[A-Za-z0-9][A-Za-z0-9._~-]*$"
    },
    "SearchText": {
      "type": "string",
      "maxLength": 200,
      "pattern": "^[^\\u0000-\\u001f\\u007f]*$"
    },
    "AppCreate": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "name": {
          "type": "string",
          "maxLength": 100,
          "minLength": 1,
          "pattern": "^(?=.*\\S)[^\\u0000-\\u001f\\u007f]+$"
        },
        "defaultDomain": {
          "anyOf": [
            {
              "$ref": "#/$defs/Domain"
            },
            {
              "type": "null"
            }
          ]
        },
        "desktopUrl": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 4096,
              "format": "uri",
              "pattern": "^https://[^/@?#\\s]+(?:[/?#]|$)"
            },
            {
              "type": "null"
            }
          ]
        },
        "playStoreUrl": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 4096,
              "format": "uri",
              "pattern": "^https://[^/@?#\\s]+(?:[/?#]|$)"
            },
            {
              "type": "null"
            }
          ]
        },
        "appStoreUrl": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 4096,
              "format": "uri",
              "pattern": "^https://[^/@?#\\s]+(?:[/?#]|$)"
            },
            {
              "type": "null"
            }
          ]
        },
        "scheme": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 100,
              "pattern": "^[a-z][a-z0-9+.-]*$",
              "not": {
                "enum": [
                  "http",
                  "https",
                  "javascript",
                  "data",
                  "file"
                ]
              }
            },
            {
              "type": "null"
            }
          ]
        },
        "androidPackage": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 255,
              "pattern": "^[A-Za-z][A-Za-z0-9_]*(?:\\.[A-Za-z][A-Za-z0-9_]*)+$"
            },
            {
              "type": "null"
            }
          ]
        },
        "iosBundleId": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 255,
              "pattern": "^[A-Za-z0-9-]+(?:\\.[A-Za-z0-9-]+)+$"
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "required": [
        "name"
      ]
    },
    "App": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "id": {
          "$ref": "#/$defs/AppId"
        },
        "name": {
          "type": "string",
          "maxLength": 4096,
          "pattern": "^[^\\u0000-\\u001f\\u007f]*$"
        },
        "defaultDomain": {
          "anyOf": [
            {
              "$ref": "#/$defs/Domain"
            },
            {
              "type": "null"
            }
          ]
        },
        "desktopUrl": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 4096,
              "format": "uri",
              "pattern": "^https://[^/@?#\\s]+(?:[/?#]|$)"
            },
            {
              "type": "null"
            }
          ]
        },
        "playStoreUrl": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 4096,
              "format": "uri",
              "pattern": "^https://[^/@?#\\s]+(?:[/?#]|$)"
            },
            {
              "type": "null"
            }
          ]
        },
        "appStoreUrl": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 4096,
              "format": "uri",
              "pattern": "^https://[^/@?#\\s]+(?:[/?#]|$)"
            },
            {
              "type": "null"
            }
          ]
        },
        "scheme": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 100,
              "pattern": "^[^\\u0000-\\u001f\\u007f]*$"
            },
            {
              "type": "null"
            }
          ]
        },
        "androidPackage": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 255,
              "pattern": "^[^\\u0000-\\u001f\\u007f]*$"
            },
            {
              "type": "null"
            }
          ]
        },
        "iosBundleId": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 255,
              "pattern": "^[^\\u0000-\\u001f\\u007f]*$"
            },
            {
              "type": "null"
            }
          ]
        },
        "revision": {
          "type": "string",
          "format": "uuid"
        },
        "createdAt": {
          "type": "string",
          "format": "date-time"
        },
        "updatedAt": {
          "type": "string",
          "format": "date-time"
        }
      },
      "required": [
        "id",
        "name",
        "defaultDomain",
        "desktopUrl",
        "playStoreUrl",
        "appStoreUrl",
        "scheme",
        "androidPackage",
        "iosBundleId",
        "revision",
        "createdAt",
        "updatedAt"
      ]
    },
    "AppDefaultsPut": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "domain": {
          "anyOf": [
            {
              "$ref": "#/$defs/Domain"
            },
            {
              "type": "null"
            }
          ]
        },
        "desktopUrl": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 4096,
              "format": "uri",
              "pattern": "^https://[^/@?#\\s]+(?:[/?#]|$)"
            },
            {
              "type": "null"
            }
          ]
        },
        "playStoreUrl": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 4096,
              "format": "uri",
              "pattern": "^https://[^/@?#\\s]+(?:[/?#]|$)"
            },
            {
              "type": "null"
            }
          ]
        },
        "appStoreUrl": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 4096,
              "format": "uri",
              "pattern": "^https://[^/@?#\\s]+(?:[/?#]|$)"
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "required": [
        "domain",
        "desktopUrl",
        "playStoreUrl",
        "appStoreUrl"
      ]
    },
    "AppDefaults": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "appId": {
          "$ref": "#/$defs/AppId"
        },
        "domain": {
          "anyOf": [
            {
              "$ref": "#/$defs/Domain"
            },
            {
              "type": "null"
            }
          ]
        },
        "desktopUrl": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 4096,
              "format": "uri",
              "pattern": "^https://[^/@?#\\s]+(?:[/?#]|$)"
            },
            {
              "type": "null"
            }
          ]
        },
        "playStoreUrl": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 4096,
              "format": "uri",
              "pattern": "^https://[^/@?#\\s]+(?:[/?#]|$)"
            },
            {
              "type": "null"
            }
          ]
        },
        "appStoreUrl": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 4096,
              "format": "uri",
              "pattern": "^https://[^/@?#\\s]+(?:[/?#]|$)"
            },
            {
              "type": "null"
            }
          ]
        },
        "revision": {
          "type": "string",
          "format": "uuid"
        }
      },
      "required": [
        "appId",
        "domain",
        "desktopUrl",
        "playStoreUrl",
        "appStoreUrl",
        "revision"
      ]
    },
    "AppLogoPut": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "assetId": {
          "type": "string",
          "format": "uuid"
        }
      },
      "required": [
        "assetId"
      ]
    },
    "AppLogo": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "appId": {
          "$ref": "#/$defs/AppId"
        },
        "asset": {
          "anyOf": [
            {
              "$ref": "#/$defs/Asset"
            },
            {
              "type": "null"
            }
          ]
        },
        "revision": {
          "type": "string",
          "format": "uuid"
        }
      },
      "required": [
        "appId",
        "asset",
        "revision"
      ]
    },
    "AssetStateFilter": {
      "enum": [
        "active",
        "deleting"
      ]
    },
    "Asset": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "id": {
          "type": "string",
          "format": "uuid"
        },
        "appId": {
          "$ref": "#/$defs/AppId"
        },
        "url": {
          "type": "string",
          "maxLength": 4096,
          "format": "uri",
          "pattern": "^https://[^/@?#\\s]+(?:[/?#]|$)"
        },
        "state": {
          "enum": [
            "active",
            "deleting",
            "deleted"
          ]
        },
        "revision": {
          "type": "string",
          "format": "uuid"
        },
        "contentType": {
          "anyOf": [
            {
              "enum": [
                "image/png",
                "image/jpeg"
              ]
            },
            {
              "type": "null"
            }
          ]
        },
        "byteSize": {
          "anyOf": [
            {
              "type": "integer",
              "minimum": 1,
              "maximum": 1048576
            },
            {
              "type": "null"
            }
          ]
        },
        "sha256": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 64,
              "pattern": "^[a-f0-9]{64}$"
            },
            {
              "type": "null"
            }
          ]
        },
        "createdAt": {
          "type": "string",
          "format": "date-time"
        },
        "updatedAt": {
          "type": "string",
          "format": "date-time"
        }
      },
      "required": [
        "id",
        "appId",
        "url",
        "state",
        "revision",
        "contentType",
        "byteSize",
        "sha256",
        "createdAt",
        "updatedAt"
      ]
    },
    "AssetUploadMeta": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "appId": {
          "$ref": "#/$defs/AppId"
        },
        "contentType": {
          "enum": [
            "image/png",
            "image/jpeg"
          ]
        },
        "byteSize": {
          "type": "integer",
          "minimum": 1,
          "maximum": 1048576
        },
        "sha256": {
          "type": "string",
          "maxLength": 64,
          "pattern": "^[a-f0-9]{64}$"
        }
      },
      "required": [
        "appId",
        "contentType",
        "byteSize",
        "sha256"
      ]
    },
    "AssetUploadForm": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "appId": {
          "$ref": "#/$defs/AppId"
        },
        "file": {
          "type": "string",
          "contentMediaType": "application/octet-stream"
        }
      },
      "required": [
        "appId",
        "file"
      ]
    },
    "LinkIdentity": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "appId": {
          "$ref": "#/$defs/AppId"
        },
        "domain": {
          "$ref": "#/$defs/Domain"
        },
        "prefix": {
          "type": "string",
          "maxLength": 200,
          "pattern": "^(?!.*~-)(?!\\.{1,2}$)[A-Za-z0-9._~-]*$"
        },
        "slug": {
          "type": "string",
          "maxLength": 200,
          "pattern": "^(?!.*~-)(?!\\.{1,2}$)[A-Za-z0-9._~-]*$",
          "minLength": 1
        }
      },
      "required": [
        "appId",
        "domain",
        "prefix",
        "slug"
      ]
    },
    "LinkAvailability": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "appId": {
          "$ref": "#/$defs/AppId"
        },
        "domain": {
          "$ref": "#/$defs/Domain"
        },
        "prefix": {
          "type": "string",
          "maxLength": 200,
          "pattern": "^(?!.*~-)(?!\\.{1,2}$)[A-Za-z0-9._~-]*$"
        },
        "slug": {
          "type": "string",
          "maxLength": 200,
          "pattern": "^(?!.*~-)(?!\\.{1,2}$)[A-Za-z0-9._~-]*$",
          "minLength": 1
        },
        "available": {
          "type": "boolean"
        }
      },
      "required": [
        "appId",
        "domain",
        "prefix",
        "slug",
        "available"
      ]
    },
    "LinkValidation": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "valid": {
          "const": true
        },
        "available": {
          "type": "boolean"
        },
        "normalized": {
          "$ref": "#/$defs/LinkCreate"
        }
      },
      "required": [
        "valid",
        "available",
        "normalized"
      ]
    },
    "LinkDuplicate": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "slug": {
          "type": "string",
          "maxLength": 200,
          "pattern": "^(?!.*~-)(?!\\.{1,2}$)[A-Za-z0-9._~-]*$",
          "minLength": 1
        },
        "prefix": {
          "type": "string",
          "maxLength": 200,
          "pattern": "^(?!.*~-)(?!\\.{1,2}$)[A-Za-z0-9._~-]*$"
        },
        "domain": {
          "$ref": "#/$defs/Domain"
        },
        "title": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 1000,
              "pattern": "^[^\\u0000-\\u001f\\u007f]*$"
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "required": [
        "slug"
      ]
    },
    "LinkPreview": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "at": {
          "$ref": "#/$defs/AnalyticsInstant"
        },
        "country": {
          "type": "string",
          "pattern": "^[A-Z]{2}$"
        },
        "platform": {
          "enum": [
            "desktop",
            "android",
            "ios"
          ]
        },
        "source": {
          "enum": [
            "browser",
            "social"
          ]
        }
      },
      "required": [
        "platform"
      ]
    },
    "LinkPreviewResult": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "state": {
          "enum": [
            "active",
            "paused",
            "scheduled",
            "expired"
          ]
        },
        "allowed": {
          "type": "boolean"
        },
        "matchedRuleId": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 50
            },
            {
              "type": "null"
            }
          ]
        },
        "evaluatedAt": {
          "type": "string",
          "format": "date-time"
        },
        "linkId": {
          "$ref": "#/$defs/LinkId"
        },
        "appId": {
          "$ref": "#/$defs/AppId"
        },
        "platform": {
          "enum": [
            "desktop",
            "android",
            "ios"
          ]
        },
        "mode": {
          "enum": [
            "web",
            "android",
            "ios",
            "recovery"
          ]
        },
        "nativeUrl": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 8192,
              "format": "uri"
            },
            {
              "type": "null"
            }
          ]
        },
        "fallbackUrl": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 16384,
              "format": "uri",
              "pattern": "^https://"
            },
            {
              "type": "null"
            }
          ]
        },
        "opening": {
          "enum": [
            "manual",
            "automatic"
          ]
        },
        "publication": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "status": {
              "enum": [
                "pending",
                "synced",
                "failed"
              ]
            },
            "desiredRevision": {
              "type": "string",
              "format": "uuid"
            },
            "confirmedRevision": {
              "anyOf": [
                {
                  "type": "string",
                  "format": "uuid"
                },
                {
                  "type": "null"
                }
              ]
            },
            "updatedAt": {
              "type": "string",
              "format": "date-time"
            }
          },
          "required": [
            "status",
            "desiredRevision",
            "confirmedRevision",
            "updatedAt"
          ]
        },
        "sideEffects": {
          "const": false
        }
      },
      "required": [
        "state",
        "allowed",
        "matchedRuleId",
        "evaluatedAt",
        "linkId",
        "appId",
        "platform",
        "mode",
        "nativeUrl",
        "fallbackUrl",
        "opening",
        "publication",
        "sideEffects"
      ]
    },
    "LinkPublication": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "linkId": {
          "$ref": "#/$defs/LinkId"
        },
        "appId": {
          "$ref": "#/$defs/AppId"
        },
        "revision": {
          "type": "string",
          "format": "uuid"
        },
        "status": {
          "enum": [
            "pending",
            "synced",
            "failed"
          ]
        },
        "desiredRevision": {
          "type": "string",
          "format": "uuid"
        },
        "confirmedRevision": {
          "anyOf": [
            {
              "type": "string",
              "format": "uuid"
            },
            {
              "type": "null"
            }
          ]
        },
        "updatedAt": {
          "type": "string",
          "format": "date-time"
        }
      },
      "required": [
        "linkId",
        "appId",
        "revision",
        "status",
        "desiredRevision",
        "confirmedRevision",
        "updatedAt"
      ]
    },
    "LinkFilters": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "appId": {
          "$ref": "#/$defs/AppId"
        },
        "domain": {
          "anyOf": [
            {
              "$ref": "#/$defs/Domain"
            },
            {
              "type": "null"
            }
          ]
        },
        "prefix": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 200,
              "pattern": "^(?!.*~-)(?!\\.{1,2}$)[A-Za-z0-9._~-]*$"
            },
            {
              "type": "null"
            }
          ]
        },
        "group": {
          "anyOf": [
            {
              "enum": [
                "main",
                "operational"
              ]
            },
            {
              "type": "null"
            }
          ]
        },
        "origin": {
          "anyOf": [
            {
              "enum": [
                "api",
                "dashboard"
              ]
            },
            {
              "type": "null"
            }
          ]
        },
        "q": {
          "type": "string",
          "maxLength": 200,
          "pattern": "^[^\\u0000-\\u001f\\u007f]*$"
        },
        "order": {
          "enum": [
            "createdAt:asc",
            "createdAt:desc"
          ]
        },
        "createdFrom": {
          "anyOf": [
            {
              "type": "string",
              "format": "date-time"
            },
            {
              "type": "null"
            }
          ]
        },
        "createdTo": {
          "anyOf": [
            {
              "type": "string",
              "format": "date-time"
            },
            {
              "type": "null"
            }
          ]
        },
        "folderId": {
          "anyOf": [
            {
              "type": "string",
              "format": "uuid"
            },
            {
              "type": "null"
            }
          ]
        },
        "campaignId": {
          "anyOf": [
            {
              "type": "string",
              "format": "uuid"
            },
            {
              "type": "null"
            }
          ]
        },
        "tagId": {
          "anyOf": [
            {
              "type": "string",
              "format": "uuid"
            },
            {
              "type": "null"
            }
          ]
        },
        "state": {
          "anyOf": [
            {
              "enum": [
                "active",
                "paused",
                "scheduled",
                "expired"
              ]
            },
            {
              "type": "null"
            }
          ]
        },
        "archived": {
          "anyOf": [
            {
              "enum": [
                "true",
                "false"
              ]
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "required": [
        "appId",
        "domain",
        "prefix",
        "group",
        "origin",
        "q",
        "order",
        "createdFrom",
        "createdTo"
      ]
    },
    "ApiKeyCreate": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "name": {
          "type": "string",
          "maxLength": 100,
          "minLength": 1
        },
        "appIds": {
          "type": "array",
          "items": {
            "type": "string",
            "maxLength": 500,
            "minLength": 1,
            "pattern": "^[^/\\u0000-\\u001f\\u007f]+$"
          },
          "maxItems": 100,
          "minItems": 1,
          "uniqueItems": true
        },
        "permissions": {
          "type": "array",
          "items": {
            "enum": [
              "analytics:read",
              "apps:delete",
              "apps:read",
              "apps:update",
              "assets:create",
              "assets:delete",
              "assets:read",
              "batches:create",
              "batches:read",
              "campaigns:create",
              "campaigns:delete",
              "campaigns:read",
              "campaigns:update",
              "capabilities:read",
              "dns:create",
              "dns:delete",
              "dns:read",
              "dns:update",
              "domains:create",
              "domains:delete",
              "domains:read",
              "domains:verify",
              "exports:create",
              "exports:read",
              "folders:create",
              "folders:delete",
              "folders:read",
              "folders:update",
              "identity:read",
              "imports:commit",
              "imports:create",
              "imports:read",
              "imports:validate",
              "link_history:read",
              "links:create",
              "links:delete",
              "links:preview",
              "links:read",
              "links:resync",
              "links:update",
              "links:validate",
              "native_config:read",
              "native_config:update",
              "operations:cancel",
              "operations:read",
              "qr_codes:create",
              "qr_codes:delete",
              "qr_codes:read",
              "qr_codes:update",
              "recovery_config:read",
              "recovery_config:update",
              "routing_rules:read",
              "routing_rules:update",
              "tags:create",
              "tags:delete",
              "tags:read",
              "tags:update",
              "template_bindings:read",
              "template_bindings:update",
              "templates:create",
              "templates:preview",
              "templates:publish",
              "templates:read",
              "templates:retry",
              "templates:snapshot",
              "templates:update",
              "templates:validate",
              "usage:read",
              "web_config:read",
              "web_config:update",
              "webhooks:create",
              "webhooks:delete",
              "webhooks:read",
              "webhooks:retry",
              "webhooks:rotate_secret",
              "webhooks:test",
              "webhooks:update"
            ]
          },
          "maxItems": 100,
          "minItems": 1,
          "uniqueItems": true
        },
        "expiresAt": {
          "type": "string",
          "format": "date-time"
        }
      },
      "required": [
        "name",
        "appIds",
        "permissions"
      ]
    },
    "ApiKey": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "id": {
          "type": "string",
          "format": "uuid"
        },
        "name": {
          "type": "string",
          "maxLength": 100,
          "minLength": 1
        },
        "prefix": {
          "type": "string",
          "maxLength": 30,
          "pattern": "^agl_(live|test)_[A-Za-z0-9_-]{4,12}$"
        },
        "appIds": {
          "type": "array",
          "items": {
            "type": "string",
            "maxLength": 500,
            "minLength": 1,
            "pattern": "^[^/\\u0000-\\u001f\\u007f]+$"
          },
          "maxItems": 100,
          "minItems": 1,
          "uniqueItems": true
        },
        "permissions": {
          "type": "array",
          "items": {
            "enum": [
              "analytics:read",
              "apps:delete",
              "apps:read",
              "apps:update",
              "assets:create",
              "assets:delete",
              "assets:read",
              "batches:create",
              "batches:read",
              "campaigns:create",
              "campaigns:delete",
              "campaigns:read",
              "campaigns:update",
              "capabilities:read",
              "dns:create",
              "dns:delete",
              "dns:read",
              "dns:update",
              "domains:create",
              "domains:delete",
              "domains:read",
              "domains:verify",
              "exports:create",
              "exports:read",
              "folders:create",
              "folders:delete",
              "folders:read",
              "folders:update",
              "identity:read",
              "imports:commit",
              "imports:create",
              "imports:read",
              "imports:validate",
              "link_history:read",
              "links:create",
              "links:delete",
              "links:preview",
              "links:read",
              "links:resync",
              "links:update",
              "links:validate",
              "native_config:read",
              "native_config:update",
              "operations:cancel",
              "operations:read",
              "qr_codes:create",
              "qr_codes:delete",
              "qr_codes:read",
              "qr_codes:update",
              "recovery_config:read",
              "recovery_config:update",
              "routing_rules:read",
              "routing_rules:update",
              "tags:create",
              "tags:delete",
              "tags:read",
              "tags:update",
              "template_bindings:read",
              "template_bindings:update",
              "templates:create",
              "templates:preview",
              "templates:publish",
              "templates:read",
              "templates:retry",
              "templates:snapshot",
              "templates:update",
              "templates:validate",
              "usage:read",
              "web_config:read",
              "web_config:update",
              "webhooks:create",
              "webhooks:delete",
              "webhooks:read",
              "webhooks:retry",
              "webhooks:rotate_secret",
              "webhooks:test",
              "webhooks:update"
            ]
          },
          "maxItems": 100,
          "minItems": 1,
          "uniqueItems": true
        },
        "expiresAt": {
          "type": "string",
          "format": "date-time"
        },
        "createdAt": {
          "type": "string",
          "format": "date-time"
        },
        "lastUsedAt": {
          "anyOf": [
            {
              "type": "string",
              "format": "date-time"
            },
            {
              "type": "null"
            }
          ]
        },
        "revokedAt": {
          "anyOf": [
            {
              "type": "string",
              "format": "date-time"
            },
            {
              "type": "null"
            }
          ]
        },
        "revision": {
          "type": "string",
          "format": "uuid"
        }
      },
      "required": [
        "id",
        "name",
        "prefix",
        "appIds",
        "permissions",
        "expiresAt",
        "createdAt",
        "lastUsedAt",
        "revokedAt",
        "revision"
      ]
    },
    "ApiKeyEnvelope": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "data": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "id": {
              "type": "string",
              "format": "uuid"
            },
            "name": {
              "type": "string",
              "maxLength": 100,
              "minLength": 1
            },
            "prefix": {
              "type": "string",
              "maxLength": 30,
              "pattern": "^agl_(live|test)_[A-Za-z0-9_-]{4,12}$"
            },
            "appIds": {
              "type": "array",
              "items": {
                "type": "string",
                "maxLength": 500,
                "minLength": 1,
                "pattern": "^[^/\\u0000-\\u001f\\u007f]+$"
              },
              "maxItems": 100,
              "minItems": 1,
              "uniqueItems": true
            },
            "permissions": {
              "type": "array",
              "items": {
                "enum": [
                  "analytics:read",
                  "apps:delete",
                  "apps:read",
                  "apps:update",
                  "assets:create",
                  "assets:delete",
                  "assets:read",
                  "batches:create",
                  "batches:read",
                  "campaigns:create",
                  "campaigns:delete",
                  "campaigns:read",
                  "campaigns:update",
                  "capabilities:read",
                  "dns:create",
                  "dns:delete",
                  "dns:read",
                  "dns:update",
                  "domains:create",
                  "domains:delete",
                  "domains:read",
                  "domains:verify",
                  "exports:create",
                  "exports:read",
                  "folders:create",
                  "folders:delete",
                  "folders:read",
                  "folders:update",
                  "identity:read",
                  "imports:commit",
                  "imports:create",
                  "imports:read",
                  "imports:validate",
                  "link_history:read",
                  "links:create",
                  "links:delete",
                  "links:preview",
                  "links:read",
                  "links:resync",
                  "links:update",
                  "links:validate",
                  "native_config:read",
                  "native_config:update",
                  "operations:cancel",
                  "operations:read",
                  "qr_codes:create",
                  "qr_codes:delete",
                  "qr_codes:read",
                  "qr_codes:update",
                  "recovery_config:read",
                  "recovery_config:update",
                  "routing_rules:read",
                  "routing_rules:update",
                  "tags:create",
                  "tags:delete",
                  "tags:read",
                  "tags:update",
                  "template_bindings:read",
                  "template_bindings:update",
                  "templates:create",
                  "templates:preview",
                  "templates:publish",
                  "templates:read",
                  "templates:retry",
                  "templates:snapshot",
                  "templates:update",
                  "templates:validate",
                  "usage:read",
                  "web_config:read",
                  "web_config:update",
                  "webhooks:create",
                  "webhooks:delete",
                  "webhooks:read",
                  "webhooks:retry",
                  "webhooks:rotate_secret",
                  "webhooks:test",
                  "webhooks:update"
                ]
              },
              "maxItems": 100,
              "minItems": 1,
              "uniqueItems": true
            },
            "expiresAt": {
              "type": "string",
              "format": "date-time"
            },
            "createdAt": {
              "type": "string",
              "format": "date-time"
            },
            "lastUsedAt": {
              "anyOf": [
                {
                  "type": "string",
                  "format": "date-time"
                },
                {
                  "type": "null"
                }
              ]
            },
            "revokedAt": {
              "anyOf": [
                {
                  "type": "string",
                  "format": "date-time"
                },
                {
                  "type": "null"
                }
              ]
            },
            "revision": {
              "type": "string",
              "format": "uuid"
            }
          },
          "required": [
            "id",
            "name",
            "prefix",
            "appIds",
            "permissions",
            "expiresAt",
            "createdAt",
            "lastUsedAt",
            "revokedAt",
            "revision"
          ]
        },
        "meta": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "requestId": {
              "$ref": "#/$defs/RequestId"
            }
          },
          "required": [
            "requestId"
          ]
        }
      },
      "required": [
        "data",
        "meta"
      ]
    },
    "ApiKeyPatch": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "name": {
          "type": "string",
          "maxLength": 100,
          "minLength": 1
        },
        "appIds": {
          "type": "array",
          "items": {
            "type": "string",
            "maxLength": 500,
            "minLength": 1,
            "pattern": "^[^/\\u0000-\\u001f\\u007f]+$"
          },
          "maxItems": 100,
          "minItems": 1,
          "uniqueItems": true
        },
        "permissions": {
          "type": "array",
          "items": {
            "enum": [
              "analytics:read",
              "apps:delete",
              "apps:read",
              "apps:update",
              "assets:create",
              "assets:delete",
              "assets:read",
              "batches:create",
              "batches:read",
              "campaigns:create",
              "campaigns:delete",
              "campaigns:read",
              "campaigns:update",
              "capabilities:read",
              "dns:create",
              "dns:delete",
              "dns:read",
              "dns:update",
              "domains:create",
              "domains:delete",
              "domains:read",
              "domains:verify",
              "exports:create",
              "exports:read",
              "folders:create",
              "folders:delete",
              "folders:read",
              "folders:update",
              "identity:read",
              "imports:commit",
              "imports:create",
              "imports:read",
              "imports:validate",
              "link_history:read",
              "links:create",
              "links:delete",
              "links:preview",
              "links:read",
              "links:resync",
              "links:update",
              "links:validate",
              "native_config:read",
              "native_config:update",
              "operations:cancel",
              "operations:read",
              "qr_codes:create",
              "qr_codes:delete",
              "qr_codes:read",
              "qr_codes:update",
              "recovery_config:read",
              "recovery_config:update",
              "routing_rules:read",
              "routing_rules:update",
              "tags:create",
              "tags:delete",
              "tags:read",
              "tags:update",
              "template_bindings:read",
              "template_bindings:update",
              "templates:create",
              "templates:preview",
              "templates:publish",
              "templates:read",
              "templates:retry",
              "templates:snapshot",
              "templates:update",
              "templates:validate",
              "usage:read",
              "web_config:read",
              "web_config:update",
              "webhooks:create",
              "webhooks:delete",
              "webhooks:read",
              "webhooks:retry",
              "webhooks:rotate_secret",
              "webhooks:test",
              "webhooks:update"
            ]
          },
          "maxItems": 100,
          "minItems": 1,
          "uniqueItems": true
        },
        "expiresAt": {
          "type": "string",
          "format": "date-time"
        }
      },
      "required": [],
      "minProperties": 1
    },
    "ApiKeyRotate": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "overlapSeconds": {
          "type": "integer",
          "minimum": 0,
          "maximum": 86400,
          "default": 0
        }
      },
      "required": []
    },
    "EmptyObject": {
      "type": "object",
      "additionalProperties": false,
      "properties": {},
      "required": []
    },
    "ApiKeyListEnvelope": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "data": {
          "type": "array",
          "items": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "id": {
                "type": "string",
                "format": "uuid"
              },
              "name": {
                "type": "string",
                "maxLength": 100,
                "minLength": 1
              },
              "prefix": {
                "type": "string",
                "maxLength": 30,
                "pattern": "^agl_(live|test)_[A-Za-z0-9_-]{4,12}$"
              },
              "appIds": {
                "type": "array",
                "items": {
                  "type": "string",
                  "maxLength": 500,
                  "minLength": 1,
                  "pattern": "^[^/\\u0000-\\u001f\\u007f]+$"
                },
                "maxItems": 100,
                "minItems": 1,
                "uniqueItems": true
              },
              "permissions": {
                "type": "array",
                "items": {
                  "enum": [
                    "analytics:read",
                    "apps:delete",
                    "apps:read",
                    "apps:update",
                    "assets:create",
                    "assets:delete",
                    "assets:read",
                    "batches:create",
                    "batches:read",
                    "campaigns:create",
                    "campaigns:delete",
                    "campaigns:read",
                    "campaigns:update",
                    "capabilities:read",
                    "dns:create",
                    "dns:delete",
                    "dns:read",
                    "dns:update",
                    "domains:create",
                    "domains:delete",
                    "domains:read",
                    "domains:verify",
                    "exports:create",
                    "exports:read",
                    "folders:create",
                    "folders:delete",
                    "folders:read",
                    "folders:update",
                    "identity:read",
                    "imports:commit",
                    "imports:create",
                    "imports:read",
                    "imports:validate",
                    "link_history:read",
                    "links:create",
                    "links:delete",
                    "links:preview",
                    "links:read",
                    "links:resync",
                    "links:update",
                    "links:validate",
                    "native_config:read",
                    "native_config:update",
                    "operations:cancel",
                    "operations:read",
                    "qr_codes:create",
                    "qr_codes:delete",
                    "qr_codes:read",
                    "qr_codes:update",
                    "recovery_config:read",
                    "recovery_config:update",
                    "routing_rules:read",
                    "routing_rules:update",
                    "tags:create",
                    "tags:delete",
                    "tags:read",
                    "tags:update",
                    "template_bindings:read",
                    "template_bindings:update",
                    "templates:create",
                    "templates:preview",
                    "templates:publish",
                    "templates:read",
                    "templates:retry",
                    "templates:snapshot",
                    "templates:update",
                    "templates:validate",
                    "usage:read",
                    "web_config:read",
                    "web_config:update",
                    "webhooks:create",
                    "webhooks:delete",
                    "webhooks:read",
                    "webhooks:retry",
                    "webhooks:rotate_secret",
                    "webhooks:test",
                    "webhooks:update"
                  ]
                },
                "maxItems": 100,
                "minItems": 1,
                "uniqueItems": true
              },
              "expiresAt": {
                "type": "string",
                "format": "date-time"
              },
              "createdAt": {
                "type": "string",
                "format": "date-time"
              },
              "lastUsedAt": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date-time"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "revokedAt": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date-time"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "revision": {
                "type": "string",
                "format": "uuid"
              }
            },
            "required": [
              "id",
              "name",
              "prefix",
              "appIds",
              "permissions",
              "expiresAt",
              "createdAt",
              "lastUsedAt",
              "revokedAt",
              "revision"
            ]
          },
          "maxItems": 100
        },
        "pagination": {
          "$ref": "#/$defs/Pagination"
        },
        "meta": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "requestId": {
              "$ref": "#/$defs/RequestId"
            }
          },
          "required": [
            "requestId"
          ]
        }
      },
      "required": [
        "data",
        "pagination",
        "meta"
      ]
    },
    "AuditEvent": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "id": {
          "type": "string",
          "format": "uuid"
        },
        "at": {
          "type": "string",
          "format": "date-time"
        },
        "requestId": {
          "$ref": "#/$defs/RequestId"
        },
        "actorType": {
          "enum": [
            "human",
            "api_key"
          ]
        },
        "credentialId": {
          "type": "string",
          "maxLength": 500,
          "minLength": 1,
          "pattern": "^[^/\\u0000-\\u001f\\u007f]+$"
        },
        "operationId": {
          "type": "string",
          "maxLength": 100
        },
        "resourceId": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 500,
              "minLength": 1,
              "pattern": "^[^/\\u0000-\\u001f\\u007f]+$"
            },
            {
              "type": "null"
            }
          ]
        },
        "appId": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 500,
              "minLength": 1,
              "pattern": "^[^/\\u0000-\\u001f\\u007f]+$"
            },
            {
              "type": "null"
            }
          ]
        },
        "revision": {
          "anyOf": [
            {
              "type": "string",
              "format": "uuid"
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "required": [
        "id",
        "at",
        "requestId",
        "actorType",
        "credentialId",
        "operationId",
        "resourceId",
        "appId",
        "revision"
      ]
    },
    "AuditEventListEnvelope": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "data": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/AuditEvent"
          },
          "maxItems": 100
        },
        "pagination": {
          "$ref": "#/$defs/Pagination"
        },
        "meta": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "requestId": {
              "$ref": "#/$defs/RequestId"
            }
          },
          "required": [
            "requestId"
          ]
        }
      },
      "required": [
        "data",
        "pagination",
        "meta"
      ]
    },
    "RequestRecord": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "id": {
          "type": "string",
          "format": "uuid"
        },
        "at": {
          "type": "string",
          "format": "date-time"
        },
        "requestId": {
          "$ref": "#/$defs/RequestId"
        },
        "actorType": {
          "enum": [
            "human",
            "api_key"
          ]
        },
        "credentialId": {
          "type": "string",
          "maxLength": 500,
          "minLength": 1,
          "pattern": "^[^/\\u0000-\\u001f\\u007f]+$"
        },
        "operationId": {
          "type": "string",
          "maxLength": 100
        },
        "status": {
          "type": "integer",
          "minimum": 100,
          "maximum": 599
        },
        "durationMs": {
          "type": "integer",
          "minimum": 0
        },
        "errorCode": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 100
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "required": [
        "id",
        "at",
        "requestId",
        "actorType",
        "credentialId",
        "operationId",
        "status",
        "durationMs",
        "errorCode"
      ]
    },
    "RequestListEnvelope": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "data": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/RequestRecord"
          },
          "maxItems": 100
        },
        "pagination": {
          "$ref": "#/$defs/Pagination"
        },
        "meta": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "requestId": {
              "$ref": "#/$defs/RequestId"
            }
          },
          "required": [
            "requestId"
          ]
        }
      },
      "required": [
        "data",
        "pagination",
        "meta"
      ]
    },
    "CapabilitiesEnvelope": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "data": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "environment": {
              "enum": [
                "local",
                "staging",
                "production"
              ]
            },
            "operations": {
              "type": "array",
              "items": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "operationId": {
                    "type": "string",
                    "maxLength": 100
                  },
                  "permission": {
                    "$ref": "#/$defs/Permission"
                  }
                },
                "required": [
                  "operationId",
                  "permission"
                ]
              },
              "maxItems": 143
            },
            "oauth": {
              "const": false
            },
            "mcp": {
              "const": false
            }
          },
          "required": [
            "environment",
            "operations",
            "oauth",
            "mcp"
          ]
        },
        "meta": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "requestId": {
              "$ref": "#/$defs/RequestId"
            }
          },
          "required": [
            "requestId"
          ]
        }
      },
      "required": [
        "data",
        "meta"
      ]
    },
    "UsageEnvelope": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "data": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "appId": {
              "type": "string",
              "maxLength": 500,
              "minLength": 1,
              "pattern": "^[^/\\u0000-\\u001f\\u007f]+$"
            },
            "scope": {
              "const": "credential"
            },
            "windowSeconds": {
              "const": 60
            },
            "limits": {
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "ingress": {
                  "type": "integer"
                },
                "read": {
                  "type": "integer"
                },
                "write": {
                  "type": "integer"
                }
              },
              "required": [
                "ingress",
                "read",
                "write"
              ]
            },
            "usage": {
              "type": "object",
              "additionalProperties": {
                "type": "integer",
                "minimum": 0
              }
            },
            "sharedLimits": {
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "owner": {
                  "type": "object",
                  "additionalProperties": {
                    "type": "integer",
                    "minimum": 1
                  }
                },
                "app": {
                  "type": "object",
                  "additionalProperties": {
                    "type": "integer",
                    "minimum": 1
                  }
                }
              },
              "required": [
                "owner",
                "app"
              ]
            },
            "sharedUsage": {
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "owner": {
                  "type": "object",
                  "additionalProperties": {
                    "type": "integer",
                    "minimum": 0
                  }
                },
                "app": {
                  "type": "object",
                  "additionalProperties": {
                    "type": "integer",
                    "minimum": 0
                  }
                }
              },
              "required": [
                "owner",
                "app"
              ]
            }
          },
          "required": [
            "appId",
            "scope",
            "windowSeconds",
            "limits",
            "usage",
            "sharedLimits",
            "sharedUsage"
          ]
        },
        "meta": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "requestId": {
              "$ref": "#/$defs/RequestId"
            }
          },
          "required": [
            "requestId"
          ]
        }
      },
      "required": [
        "data",
        "meta"
      ]
    },
    "ApiKeyIssuedEnvelope": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "data": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "key": {
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "id": {
                  "type": "string",
                  "format": "uuid"
                },
                "name": {
                  "type": "string",
                  "maxLength": 100,
                  "minLength": 1
                },
                "prefix": {
                  "type": "string",
                  "maxLength": 30,
                  "pattern": "^agl_(live|test)_[A-Za-z0-9_-]{4,12}$"
                },
                "appIds": {
                  "type": "array",
                  "items": {
                    "type": "string",
                    "maxLength": 500,
                    "minLength": 1,
                    "pattern": "^[^/\\u0000-\\u001f\\u007f]+$"
                  },
                  "maxItems": 100,
                  "minItems": 1,
                  "uniqueItems": true
                },
                "permissions": {
                  "type": "array",
                  "items": {
                    "enum": [
                      "analytics:read",
                      "apps:delete",
                      "apps:read",
                      "apps:update",
                      "assets:create",
                      "assets:delete",
                      "assets:read",
                      "batches:create",
                      "batches:read",
                      "campaigns:create",
                      "campaigns:delete",
                      "campaigns:read",
                      "campaigns:update",
                      "capabilities:read",
                      "dns:create",
                      "dns:delete",
                      "dns:read",
                      "dns:update",
                      "domains:create",
                      "domains:delete",
                      "domains:read",
                      "domains:verify",
                      "exports:create",
                      "exports:read",
                      "folders:create",
                      "folders:delete",
                      "folders:read",
                      "folders:update",
                      "identity:read",
                      "imports:commit",
                      "imports:create",
                      "imports:read",
                      "imports:validate",
                      "link_history:read",
                      "links:create",
                      "links:delete",
                      "links:preview",
                      "links:read",
                      "links:resync",
                      "links:update",
                      "links:validate",
                      "native_config:read",
                      "native_config:update",
                      "operations:cancel",
                      "operations:read",
                      "qr_codes:create",
                      "qr_codes:delete",
                      "qr_codes:read",
                      "qr_codes:update",
                      "recovery_config:read",
                      "recovery_config:update",
                      "routing_rules:read",
                      "routing_rules:update",
                      "tags:create",
                      "tags:delete",
                      "tags:read",
                      "tags:update",
                      "template_bindings:read",
                      "template_bindings:update",
                      "templates:create",
                      "templates:preview",
                      "templates:publish",
                      "templates:read",
                      "templates:retry",
                      "templates:snapshot",
                      "templates:update",
                      "templates:validate",
                      "usage:read",
                      "web_config:read",
                      "web_config:update",
                      "webhooks:create",
                      "webhooks:delete",
                      "webhooks:read",
                      "webhooks:retry",
                      "webhooks:rotate_secret",
                      "webhooks:test",
                      "webhooks:update"
                    ]
                  },
                  "maxItems": 100,
                  "minItems": 1,
                  "uniqueItems": true
                },
                "expiresAt": {
                  "type": "string",
                  "format": "date-time"
                },
                "createdAt": {
                  "type": "string",
                  "format": "date-time"
                },
                "lastUsedAt": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date-time"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "revokedAt": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date-time"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "revision": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "required": [
                "id",
                "name",
                "prefix",
                "appIds",
                "permissions",
                "expiresAt",
                "createdAt",
                "lastUsedAt",
                "revokedAt",
                "revision"
              ]
            },
            "secret": {
              "type": "string",
              "maxLength": 52,
              "pattern": "^agl_(live|test)_[A-Za-z0-9_-]{43}$"
            }
          },
          "required": [
            "key",
            "secret"
          ]
        },
        "meta": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "requestId": {
              "$ref": "#/$defs/RequestId"
            }
          },
          "required": [
            "requestId"
          ]
        }
      },
      "required": [
        "data",
        "meta"
      ]
    },
    "MePatch": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "displayName": {
          "type": "string",
          "maxLength": 100,
          "minLength": 1
        },
        "photoUrl": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 4096,
              "format": "uri",
              "pattern": "^https://[^/@?#\\s]+(?:[/?#]|$)"
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "required": [],
      "minProperties": 1
    },
    "Me": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "userId": {
          "type": "string",
          "format": "uuid"
        },
        "displayName": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 100,
              "pattern": "^[^\\u0000-\\u001f\\u007f]*$"
            },
            {
              "type": "null"
            }
          ]
        },
        "photoUrl": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 4096,
              "format": "uri",
              "pattern": "^https://[^/@?#\\s]+(?:[/?#]|$)"
            },
            {
              "type": "null"
            }
          ]
        },
        "actorType": {
          "enum": [
            "human",
            "api_key",
            "oauth"
          ]
        },
        "revision": {
          "type": "string",
          "format": "uuid"
        }
      },
      "required": [
        "userId",
        "displayName",
        "photoUrl",
        "actorType",
        "revision"
      ]
    },
    "PreferencesPatch": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "selectedAppId": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 500,
              "minLength": 1,
              "pattern": "^[^/\\u0000-\\u001f\\u007f]+$"
            },
            {
              "type": "null"
            }
          ]
        },
        "theme": {
          "enum": [
            "light",
            "dark",
            "system"
          ]
        }
      },
      "required": [],
      "minProperties": 1
    },
    "Preferences": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "selectedAppId": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 500,
              "minLength": 1,
              "pattern": "^[^/\\u0000-\\u001f\\u007f]+$"
            },
            {
              "type": "null"
            }
          ]
        },
        "theme": {
          "enum": [
            "light",
            "dark",
            "system"
          ]
        },
        "revision": {
          "type": "string",
          "format": "uuid"
        }
      },
      "required": [
        "selectedAppId",
        "theme",
        "revision"
      ]
    },
    "Operation": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "id": {
          "type": "string",
          "maxLength": 500,
          "minLength": 1,
          "pattern": "^[^/\\u0000-\\u001f\\u007f]+$"
        },
        "appId": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 500,
              "minLength": 1,
              "pattern": "^[^/\\u0000-\\u001f\\u007f]+$"
            },
            {
              "type": "null"
            }
          ]
        },
        "type": {
          "type": "string",
          "maxLength": 100,
          "minLength": 1
        },
        "status": {
          "enum": [
            "queued",
            "running",
            "succeeded",
            "partially_succeeded",
            "failed",
            "cancel_requested",
            "cancelled"
          ]
        },
        "createdAt": {
          "type": "string",
          "format": "date-time"
        },
        "updatedAt": {
          "type": "string",
          "format": "date-time"
        },
        "revision": {
          "type": "string",
          "format": "uuid"
        },
        "result": {
          "type": [
            "object",
            "null"
          ],
          "additionalProperties": {
            "$ref": "#/$defs/JsonValue"
          }
        },
        "error": {
          "anyOf": [
            {
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "code": {
                  "enum": [
                    "invalid_request",
                    "validation_failed",
                    "unauthenticated",
                    "insufficient_permission",
                    "not_found",
                    "resource_conflict",
                    "idempotency_conflict",
                    "operation_in_progress",
                    "secret_not_replayable",
                    "invalid_cursor",
                    "revision_conflict",
                    "precondition_required",
                    "payload_too_large",
                    "unsupported_media_type",
                    "rate_limited",
                    "feature_disabled",
                    "resource_expired",
                    "dependency_unavailable",
                    "internal_error"
                  ]
                },
                "message": {
                  "type": "string",
                  "maxLength": 1000,
                  "minLength": 1
                },
                "details": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "additionalProperties": false,
                    "properties": {
                      "field": {
                        "type": "string",
                        "maxLength": 200
                      },
                      "reason": {
                        "type": "string",
                        "maxLength": 100
                      },
                      "permission": {
                        "type": "string",
                        "maxLength": 100
                      }
                    },
                    "required": []
                  },
                  "maxItems": 50
                },
                "requestId": {
                  "$ref": "#/$defs/RequestId"
                },
                "documentationUrl": {
                  "type": "string",
                  "maxLength": 4096,
                  "format": "uri",
                  "pattern": "^https://[^/@?#\\s]+(?:[/?#]|$)"
                },
                "resource": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "type": {
                      "type": "string",
                      "maxLength": 100,
                      "minLength": 1
                    },
                    "id": {
                      "type": "string",
                      "maxLength": 500,
                      "minLength": 1,
                      "pattern": "^[^/\\u0000-\\u001f\\u007f]+$"
                    }
                  },
                  "required": [
                    "type",
                    "id"
                  ]
                }
              },
              "required": [
                "code",
                "message",
                "requestId",
                "documentationUrl"
              ]
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "required": [
        "id",
        "appId",
        "type",
        "status",
        "createdAt",
        "updatedAt",
        "revision",
        "result",
        "error"
      ]
    },
    "DateTime": {
      "type": "string",
      "format": "date-time"
    },
    "TemplateChoice": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "mode": {
          "enum": [
            "inherit",
            "official",
            "custom"
          ]
        },
        "templateId": {
          "$ref": "#/$defs/Revision"
        },
        "version": {
          "type": "integer",
          "minimum": 1
        }
      },
      "required": [
        "mode"
      ]
    },
    "Publication": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "status": {
          "enum": [
            "pending",
            "synced",
            "failed"
          ]
        },
        "desiredRevision": {
          "$ref": "#/$defs/Revision"
        },
        "confirmedRevision": {
          "anyOf": [
            {
              "$ref": "#/$defs/Revision"
            },
            {
              "type": "null"
            }
          ]
        },
        "updatedAt": {
          "$ref": "#/$defs/DateTime"
        }
      },
      "required": [
        "status",
        "desiredRevision",
        "confirmedRevision",
        "updatedAt"
      ]
    },
    "BaseId": {
      "enum": [
        "android",
        "ios",
        "recovery"
      ]
    },
    "TemplateConfig": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "schemaVersion": {
          "const": 1
        },
        "kind": {
          "const": "preset"
        },
        "baseTemplateId": {
          "enum": [
            "android",
            "ios",
            "recovery"
          ]
        },
        "rendererContractVersion": {
          "const": 1
        },
        "appearance": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "light": {
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "background": {
                  "type": "string",
                  "pattern": "^#[0-9a-fA-F]{6}$"
                },
                "surface": {
                  "type": "string",
                  "pattern": "^#[0-9a-fA-F]{6}$"
                },
                "border": {
                  "type": "string",
                  "pattern": "^#[0-9a-fA-F]{6}$"
                },
                "text": {
                  "type": "string",
                  "pattern": "^#[0-9a-fA-F]{6}$"
                },
                "muted": {
                  "type": "string",
                  "pattern": "^#[0-9a-fA-F]{6}$"
                },
                "accent": {
                  "type": "string",
                  "pattern": "^#[0-9a-fA-F]{6}$"
                },
                "secondary": {
                  "type": "string",
                  "pattern": "^#[0-9a-fA-F]{6}$"
                },
                "tertiary": {
                  "type": "string",
                  "pattern": "^#[0-9a-fA-F]{6}$"
                }
              },
              "required": []
            },
            "dark": {
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "background": {
                  "type": "string",
                  "pattern": "^#[0-9a-fA-F]{6}$"
                },
                "surface": {
                  "type": "string",
                  "pattern": "^#[0-9a-fA-F]{6}$"
                },
                "border": {
                  "type": "string",
                  "pattern": "^#[0-9a-fA-F]{6}$"
                },
                "text": {
                  "type": "string",
                  "pattern": "^#[0-9a-fA-F]{6}$"
                },
                "muted": {
                  "type": "string",
                  "pattern": "^#[0-9a-fA-F]{6}$"
                },
                "accent": {
                  "type": "string",
                  "pattern": "^#[0-9a-fA-F]{6}$"
                },
                "secondary": {
                  "type": "string",
                  "pattern": "^#[0-9a-fA-F]{6}$"
                },
                "tertiary": {
                  "type": "string",
                  "pattern": "^#[0-9a-fA-F]{6}$"
                }
              },
              "required": []
            },
            "fontFamily": {
              "enum": [
                "system",
                "sans",
                "serif"
              ]
            },
            "radius": {
              "enum": [
                "small",
                "medium",
                "large"
              ]
            },
            "spacing": {
              "enum": [
                "compact",
                "comfortable"
              ]
            },
            "logoAssetId": {
              "type": "string",
              "maxLength": 100
            }
          },
          "required": []
        },
        "content": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "heading": {
              "type": "string",
              "maxLength": 120
            },
            "supportingText": {
              "type": "string",
              "maxLength": 1000
            },
            "actionLabels": {
              "type": "object",
              "additionalProperties": {
                "type": "string",
                "maxLength": 120
              }
            },
            "details": {
              "type": "array",
              "items": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "label": {
                    "type": "string",
                    "maxLength": 80
                  },
                  "value": {
                    "type": "string",
                    "maxLength": 1000
                  }
                },
                "required": [
                  "label",
                  "value"
                ]
              },
              "maxItems": 4
            }
          },
          "required": []
        },
        "variables": {
          "type": "array",
          "items": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "key": {
                "type": "string",
                "pattern": "^[a-z][a-z0-9_]{0,39}$"
              },
              "label": {
                "type": "string",
                "maxLength": 80
              },
              "type": {
                "enum": [
                  "text",
                  "number",
                  "boolean"
                ]
              },
              "required": {
                "type": "boolean"
              },
              "maxLength": {
                "type": "integer",
                "minimum": 1,
                "maximum": 4000
              },
              "defaultValue": {
                "type": [
                  "string",
                  "number",
                  "boolean"
                ]
              }
            },
            "required": [
              "key"
            ]
          },
          "maxItems": 20
        }
      },
      "required": []
    },
    "DomainCreate": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "appId": {
          "$ref": "#/$defs/AppId"
        },
        "mode": {
          "enum": [
            "platform",
            "managed",
            "external"
          ]
        },
        "prefix": {
          "type": "string",
          "maxLength": 32
        },
        "hostname": {
          "$ref": "#/$defs/Domain"
        },
        "apexProfileId": {
          "type": "string",
          "maxLength": 100
        }
      },
      "required": [
        "appId",
        "mode"
      ]
    },
    "DomainResource": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "id": {
          "type": "string",
          "maxLength": 500
        },
        "appId": {
          "$ref": "#/$defs/AppId"
        },
        "hostname": {
          "$ref": "#/$defs/Domain"
        },
        "mode": {
          "enum": [
            "platform",
            "managed",
            "external",
            "legacy"
          ]
        },
        "ownership": {
          "type": "string",
          "maxLength": 30
        },
        "dns": {
          "type": "string",
          "maxLength": 30
        },
        "https": {
          "type": "string",
          "maxLength": 30
        },
        "links": {
          "type": "string",
          "maxLength": 30
        },
        "detached": {
          "type": "boolean"
        },
        "removalState": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 30
            },
            {
              "type": "null"
            }
          ]
        },
        "canManageDns": {
          "type": "boolean"
        },
        "zoneName": {
          "type": "string",
          "maxLength": 253
        },
        "nameservers": {
          "type": "array",
          "items": {
            "type": "string",
            "maxLength": 253
          },
          "maxItems": 100
        },
        "challenge": {
          "anyOf": [
            {
              "type": "object",
              "additionalProperties": {
                "$ref": "#/$defs/JsonValue"
              }
            },
            {
              "type": "null"
            }
          ]
        },
        "connectionRecords": {
          "type": "array",
          "items": {
            "type": "object",
            "additionalProperties": {
              "$ref": "#/$defs/JsonValue"
            }
          },
          "maxItems": 100
        },
        "nativeConfig": {
          "type": "object",
          "additionalProperties": {
            "$ref": "#/$defs/JsonValue"
          }
        },
        "revision": {
          "$ref": "#/$defs/Revision"
        },
        "createdAt": {
          "$ref": "#/$defs/DateTime"
        },
        "updatedAt": {
          "$ref": "#/$defs/DateTime"
        },
        "publication": {
          "$ref": "#/$defs/Publication"
        },
        "lastCheckedAt": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ]
        },
        "lastError": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 2000
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "required": [
        "id",
        "appId",
        "hostname",
        "mode",
        "ownership",
        "dns",
        "https",
        "links",
        "detached",
        "canManageDns",
        "revision",
        "createdAt",
        "updatedAt",
        "publication"
      ]
    },
    "DomainCapabilities": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "domainId": {
          "type": "string",
          "maxLength": 500
        },
        "appId": {
          "$ref": "#/$defs/AppId"
        },
        "revision": {
          "$ref": "#/$defs/Revision"
        },
        "mode": {
          "type": "string",
          "maxLength": 30
        },
        "actions": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "verify": {
              "type": "boolean"
            },
            "detach": {
              "type": "boolean"
            },
            "dns": {
              "type": "boolean"
            },
            "nativeConfig": {
              "type": "boolean"
            },
            "webConfig": {
              "type": "boolean"
            },
            "recovery": {
              "type": "boolean"
            },
            "templates": {
              "type": "boolean"
            }
          },
          "required": []
        },
        "reasons": {
          "type": "object",
          "additionalProperties": {
            "type": "string",
            "maxLength": 2000
          }
        }
      },
      "required": [
        "domainId",
        "appId",
        "revision",
        "mode",
        "actions",
        "reasons"
      ]
    },
    "DomainDiagnostics": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "domainId": {
          "type": "string",
          "maxLength": 500
        },
        "appId": {
          "$ref": "#/$defs/AppId"
        },
        "revision": {
          "$ref": "#/$defs/Revision"
        },
        "configurationSaved": {
          "type": "boolean"
        },
        "publication": {
          "$ref": "#/$defs/Publication"
        },
        "ownership": {
          "type": "string",
          "maxLength": 30
        },
        "dns": {
          "type": "string",
          "maxLength": 30
        },
        "https": {
          "type": "string",
          "maxLength": 30
        },
        "links": {
          "type": "string",
          "maxLength": 30
        },
        "androidConfigured": {
          "type": "boolean"
        },
        "iosConfigured": {
          "type": "boolean"
        },
        "deviceAssociationTested": {
          "const": false
        },
        "appClipVerified": {
          "const": false
        },
        "notes": {
          "type": "array",
          "items": {
            "type": "string",
            "maxLength": 2000
          },
          "maxItems": 100
        }
      },
      "required": [
        "domainId",
        "appId",
        "revision",
        "configurationSaved",
        "publication",
        "ownership",
        "dns",
        "https",
        "links",
        "androidConfigured",
        "iosConfigured",
        "deviceAssociationTested",
        "appClipVerified",
        "notes"
      ]
    },
    "DomainOptions": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "appId": {
          "$ref": "#/$defs/AppId"
        },
        "enabled": {
          "type": "boolean"
        },
        "mutationsEnabled": {
          "type": "boolean"
        },
        "platformDomain": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 253
            },
            {
              "type": "null"
            }
          ]
        },
        "modes": {
          "type": "array",
          "items": {
            "enum": [
              "platform",
              "managed",
              "external"
            ]
          },
          "maxItems": 100
        },
        "externalDns": {
          "type": "object",
          "additionalProperties": {
            "$ref": "#/$defs/JsonValue"
          }
        }
      },
      "required": [
        "appId",
        "enabled",
        "mutationsEnabled",
        "platformDomain",
        "modes",
        "externalDns"
      ]
    },
    "NativeConfigPut": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "androidPackage": {
          "type": "string",
          "maxLength": 255
        },
        "fingerprints": {
          "type": "array",
          "items": {
            "type": "string",
            "pattern": "^(?:[A-Fa-f0-9]{2}:){31}[A-Fa-f0-9]{2}$"
          },
          "maxItems": 10
        },
        "ios": {
          "anyOf": [
            {
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "appIdPrefix": {
                  "type": "string",
                  "pattern": "^[A-Z0-9]{10}$"
                },
                "bundleId": {
                  "type": "string",
                  "maxLength": 255
                }
              },
              "required": [
                "appIdPrefix",
                "bundleId"
              ]
            },
            {
              "type": "null"
            }
          ]
        },
        "routing": {
          "anyOf": [
            {
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "prefixes": {
                  "type": "array",
                  "items": {
                    "type": "string",
                    "maxLength": 200
                  },
                  "maxItems": 20
                },
                "schemeLinkFormat": {
                  "enum": [
                    "app-path",
                    "agilink-v1"
                  ]
                }
              },
              "required": [
                "prefixes",
                "schemeLinkFormat"
              ]
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "required": []
    },
    "WebConfigPut": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "flutterUrl": {
          "type": "string",
          "maxLength": 4096
        },
        "flutterName": {
          "type": "string",
          "maxLength": 100
        },
        "flutterDescription": {
          "type": "string",
          "maxLength": 300
        },
        "flutterRoutePrefix": {
          "type": "string",
          "maxLength": 200
        }
      },
      "required": []
    },
    "RecoveryConfigPut": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "enabled": {
          "type": "boolean"
        },
        "sdkReady": {
          "type": "boolean"
        },
        "appClipBundleId": {
          "type": "string",
          "maxLength": 255
        },
        "detection": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "enabled": {
              "type": "boolean"
            },
            "mode": {
              "enum": [
                "confirm",
                "automatic"
              ]
            }
          },
          "required": [
            "enabled",
            "mode"
          ]
        }
      },
      "required": [
        "enabled",
        "sdkReady"
      ]
    },
    "DomainConfig": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "domainId": {
          "type": "string",
          "maxLength": 500
        },
        "appId": {
          "$ref": "#/$defs/AppId"
        },
        "revision": {
          "$ref": "#/$defs/Revision"
        },
        "config": {
          "type": "object",
          "additionalProperties": {
            "$ref": "#/$defs/JsonValue"
          }
        },
        "publication": {
          "$ref": "#/$defs/Publication"
        }
      },
      "required": [
        "domainId",
        "appId",
        "revision",
        "config",
        "publication"
      ]
    },
    "DnsRecordInput": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "type": {
          "enum": [
            "A",
            "AAAA",
            "CNAME",
            "TXT",
            "MX"
          ]
        },
        "name": {
          "type": "string",
          "maxLength": 253
        },
        "content": {
          "type": "string",
          "maxLength": 2048
        },
        "ttl": {
          "type": "integer",
          "minimum": 1,
          "maximum": 86400
        },
        "proxied": {
          "type": "boolean"
        },
        "priority": {
          "type": "integer",
          "minimum": 0,
          "maximum": 65535
        }
      },
      "required": [
        "type",
        "name",
        "content",
        "ttl"
      ]
    },
    "DnsRecord": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "id": {
          "type": "string",
          "maxLength": 500
        },
        "name": {
          "type": "string",
          "maxLength": 253
        },
        "type": {
          "type": "string",
          "maxLength": 20
        },
        "content": {
          "type": "string",
          "maxLength": 4096
        },
        "ttl": {
          "type": "integer"
        },
        "proxied": {
          "type": "boolean"
        },
        "priority": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ]
        },
        "version": {
          "type": "string",
          "pattern": "^[a-f0-9]{64}$"
        },
        "revision": {
          "$ref": "#/$defs/Revision"
        },
        "canEdit": {
          "type": "boolean"
        },
        "canDelete": {
          "type": "boolean"
        },
        "protectedReason": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 2000
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "required": [
        "id",
        "name",
        "type",
        "content",
        "ttl",
        "proxied",
        "priority",
        "version",
        "revision",
        "canEdit",
        "canDelete",
        "protectedReason"
      ]
    },
    "TemplateCreate": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "appId": {
          "$ref": "#/$defs/AppId"
        },
        "name": {
          "type": "string",
          "maxLength": 100
        },
        "baseTemplateId": {
          "enum": [
            "android",
            "ios",
            "recovery"
          ]
        },
        "config": {
          "$ref": "#/$defs/TemplateConfig"
        }
      },
      "required": [
        "appId",
        "name",
        "baseTemplateId"
      ]
    },
    "TemplatePatch": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "name": {
          "type": "string",
          "maxLength": 100
        },
        "archived": {
          "type": "boolean"
        }
      },
      "required": []
    },
    "TemplateDuplicate": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "name": {
          "type": "string",
          "maxLength": 100
        },
        "sourceVersion": {
          "type": "integer",
          "minimum": 1
        },
        "draftRevision": {
          "$ref": "#/$defs/Revision"
        }
      },
      "required": [
        "name"
      ]
    },
    "TemplateDraftPut": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "config": {
          "$ref": "#/$defs/TemplateConfig"
        }
      },
      "required": [
        "config"
      ]
    },
    "TemplateValidate": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "config": {
          "$ref": "#/$defs/TemplateConfig"
        },
        "usage": {
          "enum": [
            "link",
            "default"
          ]
        }
      },
      "required": [
        "config"
      ]
    },
    "TemplatePreview": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "config": {
          "$ref": "#/$defs/TemplateConfig"
        },
        "linkId": {
          "$ref": "#/$defs/LinkId"
        },
        "templateData": {
          "type": "object",
          "additionalProperties": {
            "$ref": "#/$defs/JsonValue"
          }
        }
      },
      "required": []
    },
    "TemplateVersionCreate": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "draftRevision": {
          "$ref": "#/$defs/Revision"
        },
        "usage": {
          "enum": [
            "link",
            "default"
          ]
        }
      },
      "required": [
        "draftRevision"
      ]
    },
    "TemplateMeta": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "id": {
          "$ref": "#/$defs/Revision"
        },
        "appId": {
          "$ref": "#/$defs/AppId"
        },
        "name": {
          "type": "string",
          "maxLength": 100
        },
        "baseTemplateId": {
          "enum": [
            "android",
            "ios",
            "recovery"
          ]
        },
        "archived": {
          "type": "boolean"
        },
        "revision": {
          "$ref": "#/$defs/Revision"
        },
        "createdAt": {
          "$ref": "#/$defs/DateTime"
        },
        "updatedAt": {
          "$ref": "#/$defs/DateTime"
        }
      },
      "required": [
        "id",
        "appId",
        "name",
        "baseTemplateId",
        "archived",
        "revision",
        "createdAt",
        "updatedAt"
      ]
    },
    "TemplateDraft": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "templateId": {
          "$ref": "#/$defs/Revision"
        },
        "config": {
          "$ref": "#/$defs/TemplateConfig"
        },
        "revision": {
          "$ref": "#/$defs/Revision"
        },
        "baseVersion": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ]
        },
        "updatedAt": {
          "$ref": "#/$defs/DateTime"
        }
      },
      "required": [
        "templateId",
        "config",
        "revision",
        "baseVersion",
        "updatedAt"
      ]
    },
    "TemplateDetail": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "template": {
          "$ref": "#/$defs/TemplateMeta"
        },
        "draft": {
          "$ref": "#/$defs/TemplateDraft"
        },
        "revision": {
          "$ref": "#/$defs/Revision"
        }
      },
      "required": [
        "template",
        "draft",
        "revision"
      ]
    },
    "TemplateVersion": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "templateId": {
          "$ref": "#/$defs/Revision"
        },
        "version": {
          "type": "integer",
          "minimum": 1
        },
        "state": {
          "const": "prepared"
        },
        "config": {
          "$ref": "#/$defs/TemplateConfig"
        },
        "checksum": {
          "type": "string",
          "maxLength": 64
        },
        "usage": {
          "enum": [
            "link",
            "default"
          ]
        },
        "authorId": {
          "$ref": "#/$defs/Revision"
        },
        "createdAt": {
          "$ref": "#/$defs/DateTime"
        }
      },
      "required": [
        "templateId",
        "version",
        "state",
        "config",
        "checksum",
        "usage",
        "authorId",
        "createdAt"
      ]
    },
    "TemplateSnapshot": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "template": {
          "$ref": "#/$defs/TemplateMeta"
        },
        "version": {
          "$ref": "#/$defs/TemplateVersion"
        },
        "draft": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "revision": {
              "$ref": "#/$defs/Revision"
            },
            "baseVersion": {
              "type": "integer"
            },
            "updatedAt": {
              "$ref": "#/$defs/DateTime"
            }
          },
          "required": [
            "revision",
            "baseVersion",
            "updatedAt"
          ]
        },
        "revision": {
          "$ref": "#/$defs/Revision"
        }
      },
      "required": [
        "template",
        "version",
        "draft",
        "revision"
      ]
    },
    "TemplateTarget": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "scope": {
          "enum": [
            "app",
            "domain",
            "link"
          ]
        },
        "domainId": {
          "type": "string",
          "maxLength": 500
        },
        "linkId": {
          "$ref": "#/$defs/LinkId"
        },
        "expectedRevision": {
          "anyOf": [
            {
              "$ref": "#/$defs/Revision"
            },
            {
              "type": "null"
            }
          ]
        },
        "expectedLinkRevision": {
          "$ref": "#/$defs/Revision"
        }
      },
      "required": [
        "scope",
        "expectedRevision"
      ]
    },
    "TemplatePublish": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "version": {
          "type": "integer",
          "minimum": 1
        },
        "draftRevision": {
          "$ref": "#/$defs/Revision"
        },
        "usage": {
          "enum": [
            "link",
            "default"
          ]
        },
        "targets": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/TemplateTarget"
          },
          "maxItems": 50
        }
      },
      "required": [
        "targets"
      ]
    },
    "TemplateRestore": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "version": {
          "type": "integer",
          "minimum": 1
        },
        "mode": {
          "enum": [
            "official",
            "inherit"
          ]
        },
        "targets": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/TemplateTarget"
          },
          "maxItems": 50
        }
      },
      "required": [
        "targets"
      ]
    },
    "TemplatePublication": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "id": {
          "$ref": "#/$defs/Revision"
        },
        "appId": {
          "$ref": "#/$defs/AppId"
        },
        "revision": {
          "$ref": "#/$defs/Revision"
        },
        "action": {
          "enum": [
            "publish",
            "restore"
          ]
        },
        "baseTemplateId": {
          "enum": [
            "android",
            "ios",
            "recovery"
          ]
        },
        "choice": {
          "$ref": "#/$defs/TemplateChoice"
        },
        "state": {
          "enum": [
            "queued",
            "applying",
            "confirmed",
            "partial",
            "conflict",
            "superseded",
            "denied"
          ]
        },
        "phase": {
          "enum": [
            "version",
            "activation",
            "projection"
          ]
        },
        "error": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 2000
            },
            {
              "type": "null"
            }
          ]
        },
        "versionAvailability": {
          "anyOf": [
            {
              "enum": [
                "available",
                "prepared"
              ]
            },
            {
              "type": "null"
            }
          ]
        },
        "createdAt": {
          "$ref": "#/$defs/DateTime"
        },
        "updatedAt": {
          "$ref": "#/$defs/DateTime"
        },
        "targets": {
          "type": "array",
          "items": {
            "type": "object",
            "additionalProperties": {
              "$ref": "#/$defs/JsonValue"
            }
          },
          "maxItems": 50
        }
      },
      "required": [
        "id",
        "appId",
        "revision",
        "action",
        "baseTemplateId",
        "choice",
        "state",
        "phase",
        "error",
        "versionAvailability",
        "createdAt",
        "updatedAt",
        "targets"
      ]
    },
    "TemplateAvailabilityItem": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "version": {
          "type": "integer",
          "minimum": 1
        },
        "confirmedAt": {
          "$ref": "#/$defs/DateTime"
        }
      },
      "required": [
        "version",
        "confirmedAt"
      ]
    },
    "TemplateChoiceItem": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "templateId": {
          "$ref": "#/$defs/Revision"
        },
        "version": {
          "type": "integer",
          "minimum": 1
        },
        "baseTemplateId": {
          "enum": [
            "android",
            "ios",
            "recovery"
          ]
        },
        "name": {
          "type": "string",
          "maxLength": 100
        },
        "variables": {
          "type": "array",
          "items": {
            "type": "object",
            "additionalProperties": {
              "$ref": "#/$defs/JsonValue"
            }
          },
          "maxItems": 20
        }
      },
      "required": [
        "templateId",
        "version",
        "baseTemplateId",
        "name",
        "variables"
      ]
    },
    "TemplateBindingPut": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "baseTemplateId": {
          "enum": [
            "android",
            "ios",
            "recovery"
          ]
        },
        "choice": {
          "$ref": "#/$defs/TemplateChoice"
        }
      },
      "required": [
        "baseTemplateId",
        "choice"
      ]
    },
    "TemplateBindingView": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "appId": {
          "$ref": "#/$defs/AppId"
        },
        "scope": {
          "enum": [
            "app",
            "domain",
            "link"
          ]
        },
        "domainId": {
          "type": "string",
          "maxLength": 500
        },
        "linkId": {
          "$ref": "#/$defs/LinkId"
        },
        "revision": {
          "$ref": "#/$defs/Revision"
        },
        "enabled": {
          "type": "boolean"
        },
        "current": {
          "type": "object",
          "additionalProperties": {
            "$ref": "#/$defs/JsonValue"
          }
        },
        "effective": {
          "type": "object",
          "additionalProperties": {
            "$ref": "#/$defs/JsonValue"
          }
        },
        "inherited": {
          "type": "object",
          "additionalProperties": {
            "$ref": "#/$defs/JsonValue"
          }
        },
        "templateData": {
          "type": "object",
          "additionalProperties": {
            "$ref": "#/$defs/JsonValue"
          }
        }
      },
      "required": [
        "appId",
        "scope",
        "revision",
        "enabled",
        "current",
        "effective",
        "inherited",
        "templateData"
      ]
    },
    "TemplateValidationResult": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "valid": {
          "const": true
        },
        "config": {
          "$ref": "#/$defs/TemplateConfig"
        },
        "usage": {
          "enum": [
            "link",
            "default"
          ]
        }
      },
      "required": [
        "valid",
        "config",
        "usage"
      ]
    },
    "TemplatePreviewResult": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "templateId": {
          "$ref": "#/$defs/Revision"
        },
        "config": {
          "$ref": "#/$defs/TemplateConfig"
        },
        "content": {
          "type": "object",
          "additionalProperties": {
            "$ref": "#/$defs/JsonValue"
          }
        },
        "sideEffects": {
          "const": false
        },
        "rendererContractVersion": {
          "const": 1
        }
      },
      "required": [
        "templateId",
        "config",
        "content",
        "sideEffects",
        "rendererContractVersion"
      ]
    },
    "TemplateCatalogItem": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "id": {
          "enum": [
            "android",
            "ios",
            "recovery"
          ]
        },
        "rendererContractVersion": {
          "const": 1
        },
        "states": {
          "type": "array",
          "items": {
            "type": "string",
            "maxLength": 50
          },
          "maxItems": 100
        },
        "actions": {
          "type": "array",
          "items": {
            "type": "string",
            "maxLength": 50
          },
          "maxItems": 100
        },
        "nativeVariables": {
          "type": "array",
          "items": {
            "type": "string",
            "maxLength": 100
          },
          "maxItems": 100
        },
        "themes": {
          "type": "object",
          "additionalProperties": {
            "$ref": "#/$defs/JsonValue"
          }
        }
      },
      "required": [
        "id",
        "rendererContractVersion",
        "states",
        "actions",
        "nativeVariables",
        "themes"
      ]
    },
    "TemplateSchemaResult": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "baseTemplateId": {
          "enum": [
            "android",
            "ios",
            "recovery"
          ]
        },
        "limits": {
          "type": "object",
          "additionalProperties": {
            "$ref": "#/$defs/JsonValue"
          }
        },
        "schema": {
          "type": "object",
          "additionalProperties": {
            "$ref": "#/$defs/JsonValue"
          }
        },
        "example": {
          "$ref": "#/$defs/TemplateConfig"
        }
      },
      "required": [
        "baseTemplateId",
        "limits",
        "schema",
        "example"
      ]
    },
    "DomainEnvelope": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "data": {
          "$ref": "#/$defs/DomainResource"
        },
        "meta": {
          "$ref": "#/$defs/Meta"
        }
      },
      "required": [
        "data",
        "meta"
      ]
    },
    "DomainCapabilitiesEnvelope": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "data": {
          "$ref": "#/$defs/DomainCapabilities"
        },
        "meta": {
          "$ref": "#/$defs/Meta"
        }
      },
      "required": [
        "data",
        "meta"
      ]
    },
    "DomainDiagnosticsEnvelope": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "data": {
          "$ref": "#/$defs/DomainDiagnostics"
        },
        "meta": {
          "$ref": "#/$defs/Meta"
        }
      },
      "required": [
        "data",
        "meta"
      ]
    },
    "DomainOptionsEnvelope": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "data": {
          "$ref": "#/$defs/DomainOptions"
        },
        "meta": {
          "$ref": "#/$defs/Meta"
        }
      },
      "required": [
        "data",
        "meta"
      ]
    },
    "DomainConfigEnvelope": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "data": {
          "$ref": "#/$defs/DomainConfig"
        },
        "meta": {
          "$ref": "#/$defs/Meta"
        }
      },
      "required": [
        "data",
        "meta"
      ]
    },
    "TemplateDetailEnvelope": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "data": {
          "$ref": "#/$defs/TemplateDetail"
        },
        "meta": {
          "$ref": "#/$defs/Meta"
        }
      },
      "required": [
        "data",
        "meta"
      ]
    },
    "TemplateDraftEnvelope": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "data": {
          "$ref": "#/$defs/TemplateDraft"
        },
        "meta": {
          "$ref": "#/$defs/Meta"
        }
      },
      "required": [
        "data",
        "meta"
      ]
    },
    "TemplateVersionEnvelope": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "data": {
          "$ref": "#/$defs/TemplateVersion"
        },
        "meta": {
          "$ref": "#/$defs/Meta"
        }
      },
      "required": [
        "data",
        "meta"
      ]
    },
    "TemplateSnapshotEnvelope": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "data": {
          "$ref": "#/$defs/TemplateSnapshot"
        },
        "meta": {
          "$ref": "#/$defs/Meta"
        }
      },
      "required": [
        "data",
        "meta"
      ]
    },
    "TemplatePublicationEnvelope": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "data": {
          "$ref": "#/$defs/TemplatePublication"
        },
        "meta": {
          "$ref": "#/$defs/Meta"
        }
      },
      "required": [
        "data",
        "meta"
      ]
    },
    "TemplateBindingViewEnvelope": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "data": {
          "$ref": "#/$defs/TemplateBindingView"
        },
        "meta": {
          "$ref": "#/$defs/Meta"
        }
      },
      "required": [
        "data",
        "meta"
      ]
    },
    "TemplateValidationResultEnvelope": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "data": {
          "$ref": "#/$defs/TemplateValidationResult"
        },
        "meta": {
          "$ref": "#/$defs/Meta"
        }
      },
      "required": [
        "data",
        "meta"
      ]
    },
    "TemplatePreviewResultEnvelope": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "data": {
          "$ref": "#/$defs/TemplatePreviewResult"
        },
        "meta": {
          "$ref": "#/$defs/Meta"
        }
      },
      "required": [
        "data",
        "meta"
      ]
    },
    "TemplateSchemaResultEnvelope": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "data": {
          "$ref": "#/$defs/TemplateSchemaResult"
        },
        "meta": {
          "$ref": "#/$defs/Meta"
        }
      },
      "required": [
        "data",
        "meta"
      ]
    },
    "DomainListEnvelope": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "data": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/DomainResource"
          },
          "maxItems": 100
        },
        "pagination": {
          "$ref": "#/$defs/Pagination"
        },
        "meta": {
          "$ref": "#/$defs/Meta"
        }
      },
      "required": [
        "data",
        "pagination",
        "meta"
      ]
    },
    "DnsRecordListEnvelope": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "data": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/DnsRecord"
          },
          "maxItems": 100
        },
        "pagination": {
          "$ref": "#/$defs/Pagination"
        },
        "meta": {
          "$ref": "#/$defs/Meta"
        }
      },
      "required": [
        "data",
        "pagination",
        "meta"
      ]
    },
    "TemplateListEnvelope": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "data": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/TemplateMeta"
          },
          "maxItems": 100
        },
        "pagination": {
          "$ref": "#/$defs/Pagination"
        },
        "meta": {
          "$ref": "#/$defs/Meta"
        }
      },
      "required": [
        "data",
        "pagination",
        "meta"
      ]
    },
    "TemplateVersionListEnvelope": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "data": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/TemplateVersion"
          },
          "maxItems": 100
        },
        "pagination": {
          "$ref": "#/$defs/Pagination"
        },
        "meta": {
          "$ref": "#/$defs/Meta"
        }
      },
      "required": [
        "data",
        "pagination",
        "meta"
      ]
    },
    "TemplatePublicationListEnvelope": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "data": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/TemplatePublication"
          },
          "maxItems": 100
        },
        "pagination": {
          "$ref": "#/$defs/Pagination"
        },
        "meta": {
          "$ref": "#/$defs/Meta"
        }
      },
      "required": [
        "data",
        "pagination",
        "meta"
      ]
    },
    "TemplateAvailabilityListEnvelope": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "data": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/TemplateAvailabilityItem"
          },
          "maxItems": 100
        },
        "pagination": {
          "$ref": "#/$defs/Pagination"
        },
        "meta": {
          "$ref": "#/$defs/Meta"
        }
      },
      "required": [
        "data",
        "pagination",
        "meta"
      ]
    },
    "TemplateChoiceListEnvelope": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "data": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/TemplateChoiceItem"
          },
          "maxItems": 100
        },
        "pagination": {
          "$ref": "#/$defs/Pagination"
        },
        "meta": {
          "$ref": "#/$defs/Meta"
        }
      },
      "required": [
        "data",
        "pagination",
        "meta"
      ]
    },
    "TemplateCatalogListEnvelope": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "data": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/TemplateCatalogItem"
          },
          "maxItems": 100
        },
        "pagination": {
          "$ref": "#/$defs/Pagination"
        },
        "meta": {
          "$ref": "#/$defs/Meta"
        }
      },
      "required": [
        "data",
        "pagination",
        "meta"
      ]
    },
    "AnalyticsInstant": {
      "type": "string",
      "format": "date-time",
      "pattern": "T\\d{2}:\\d{2}:\\d{2}(?:\\.\\d{1,3})?(?:[Zz]|[+-]\\d{2}:\\d{2})$"
    },
    "AnalyticsPeriod": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "start": {
          "$ref": "#/$defs/AnalyticsInstant"
        },
        "end": {
          "$ref": "#/$defs/AnalyticsInstant"
        },
        "timezone": {
          "type": "string",
          "maxLength": 100
        },
        "startInclusive": {
          "const": true
        },
        "endExclusive": {
          "const": true
        }
      },
      "required": [
        "start",
        "end",
        "timezone",
        "startInclusive",
        "endExclusive"
      ]
    },
    "AnalyticsFilters": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "campaignId": {
          "anyOf": [
            {
              "type": "string",
              "format": "uuid"
            },
            {
              "type": "null"
            }
          ]
        },
        "folderId": {
          "anyOf": [
            {
              "type": "string",
              "format": "uuid"
            },
            {
              "type": "null"
            }
          ]
        },
        "tagId": {
          "anyOf": [
            {
              "type": "string",
              "format": "uuid"
            },
            {
              "type": "null"
            }
          ]
        },
        "group": {
          "enum": [
            "all",
            "main",
            "operational"
          ]
        },
        "linkId": {
          "anyOf": [
            {
              "$ref": "#/$defs/LinkId"
            },
            {
              "type": "null"
            }
          ]
        },
        "domain": {
          "anyOf": [
            {
              "$ref": "#/$defs/Domain"
            },
            {
              "type": "null"
            }
          ]
        },
        "prefix": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 200
            },
            {
              "type": "null"
            }
          ]
        },
        "device": {
          "anyOf": [
            {
              "enum": [
                "android",
                "ios",
                "desktop",
                "unknown"
              ]
            },
            {
              "type": "null"
            }
          ]
        },
        "source": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 200
            },
            {
              "type": "null"
            }
          ]
        },
        "country": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 7
            },
            {
              "type": "null"
            }
          ]
        },
        "eventType": {
          "enum": [
            "all",
            "click",
            "app_open",
            "content_view",
            "legacy_content_load"
          ]
        }
      },
      "required": [
        "campaignId",
        "folderId",
        "tagId",
        "group",
        "linkId",
        "domain",
        "prefix",
        "device",
        "source",
        "country",
        "eventType"
      ]
    },
    "AnalyticsCoverage": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "source": {
          "enum": [
            "event_rows",
            "retained_recovery_tokens"
          ]
        },
        "grouping": {
          "const": "current_link_group"
        },
        "deletedLinks": {
          "const": "excluded"
        },
        "historicalAggregates": {
          "const": "not_merged"
        },
        "uniqueVisitors": {
          "const": "distinct_click_hash_estimate"
        },
        "nativeTrust": {
          "const": "client_reported"
        },
        "completenessGuaranteed": {
          "const": false
        },
        "limitations": {
          "type": "array",
          "items": {
            "type": "string",
            "maxLength": 1000
          },
          "maxItems": 1000
        }
      },
      "required": [
        "source",
        "grouping",
        "deletedLinks",
        "historicalAggregates",
        "uniqueVisitors",
        "nativeTrust",
        "completenessGuaranteed",
        "limitations"
      ]
    },
    "AnalyticsCounts": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "clicks": {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991
        },
        "uniqueVisitors": {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991
        },
        "identifiedClicks": {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991
        },
        "appOpens": {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991
        },
        "contentViews": {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991
        },
        "legacyContentLoads": {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991
        }
      },
      "required": [
        "clicks",
        "uniqueVisitors",
        "identifiedClicks",
        "appOpens",
        "contentViews",
        "legacyContentLoads"
      ]
    },
    "AnalyticsSummary": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "appId": {
          "$ref": "#/$defs/AppId"
        },
        "period": {
          "$ref": "#/$defs/AnalyticsPeriod"
        },
        "filters": {
          "$ref": "#/$defs/AnalyticsFilters"
        },
        "generatedAt": {
          "type": "string",
          "format": "date-time"
        },
        "coverage": {
          "$ref": "#/$defs/AnalyticsCoverage"
        },
        "totals": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "clicks": {
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991
            },
            "uniqueVisitors": {
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991
            },
            "identifiedClicks": {
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991
            },
            "appOpens": {
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991
            },
            "contentViews": {
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991
            },
            "legacyContentLoads": {
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991
            },
            "activeLinks": {
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991
            },
            "firstEventAt": {
              "anyOf": [
                {
                  "type": "string",
                  "format": "date-time"
                },
                {
                  "type": "null"
                }
              ]
            },
            "lastEventAt": {
              "anyOf": [
                {
                  "type": "string",
                  "format": "date-time"
                },
                {
                  "type": "null"
                }
              ]
            }
          },
          "required": [
            "clicks",
            "uniqueVisitors",
            "identifiedClicks",
            "appOpens",
            "contentViews",
            "legacyContentLoads",
            "activeLinks",
            "firstEventAt",
            "lastEventAt"
          ]
        }
      },
      "required": [
        "appId",
        "period",
        "filters",
        "generatedAt",
        "coverage",
        "totals"
      ]
    },
    "AnalyticsTimeseries": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "appId": {
          "$ref": "#/$defs/AppId"
        },
        "period": {
          "$ref": "#/$defs/AnalyticsPeriod"
        },
        "filters": {
          "$ref": "#/$defs/AnalyticsFilters"
        },
        "generatedAt": {
          "type": "string",
          "format": "date-time"
        },
        "coverage": {
          "$ref": "#/$defs/AnalyticsCoverage"
        },
        "granularity": {
          "enum": [
            "hour",
            "day",
            "month",
            "year"
          ]
        },
        "sparse": {
          "const": true
        },
        "buckets": {
          "type": "array",
          "items": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "start": {
                "type": "string",
                "format": "date-time"
              },
              "localLabel": {
                "type": "string",
                "maxLength": 40
              },
              "clicks": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "uniqueVisitors": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "identifiedClicks": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "appOpens": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "contentViews": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "legacyContentLoads": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "start",
              "localLabel",
              "clicks",
              "uniqueVisitors",
              "identifiedClicks",
              "appOpens",
              "contentViews",
              "legacyContentLoads"
            ]
          },
          "maxItems": 1000
        }
      },
      "required": [
        "appId",
        "period",
        "filters",
        "generatedAt",
        "coverage",
        "granularity",
        "sparse",
        "buckets"
      ]
    },
    "AnalyticsBreakdown": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "appId": {
          "$ref": "#/$defs/AppId"
        },
        "period": {
          "$ref": "#/$defs/AnalyticsPeriod"
        },
        "filters": {
          "$ref": "#/$defs/AnalyticsFilters"
        },
        "generatedAt": {
          "type": "string",
          "format": "date-time"
        },
        "coverage": {
          "$ref": "#/$defs/AnalyticsCoverage"
        },
        "dimension": {
          "enum": [
            "device",
            "source",
            "country",
            "eventType",
            "producer",
            "entryMethod"
          ]
        },
        "truncated": {
          "type": "boolean"
        },
        "items": {
          "type": "array",
          "items": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "value": {
                "type": "string",
                "maxLength": 200
              },
              "events": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "clicks": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "uniqueVisitors": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "identifiedClicks": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "appOpens": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "contentViews": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "legacyContentLoads": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "value",
              "events",
              "clicks",
              "uniqueVisitors",
              "identifiedClicks",
              "appOpens",
              "contentViews",
              "legacyContentLoads"
            ]
          },
          "maxItems": 1000
        }
      },
      "required": [
        "appId",
        "period",
        "filters",
        "generatedAt",
        "coverage",
        "dimension",
        "truncated",
        "items"
      ]
    },
    "AnalyticsTopLinks": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "appId": {
          "$ref": "#/$defs/AppId"
        },
        "period": {
          "$ref": "#/$defs/AnalyticsPeriod"
        },
        "filters": {
          "$ref": "#/$defs/AnalyticsFilters"
        },
        "generatedAt": {
          "type": "string",
          "format": "date-time"
        },
        "coverage": {
          "$ref": "#/$defs/AnalyticsCoverage"
        },
        "items": {
          "type": "array",
          "items": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "linkId": {
                "$ref": "#/$defs/LinkId"
              },
              "title": {
                "anyOf": [
                  {
                    "type": "string",
                    "maxLength": 1000
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "domain": {
                "$ref": "#/$defs/Domain"
              },
              "prefix": {
                "type": "string",
                "maxLength": 200
              },
              "slug": {
                "type": "string",
                "maxLength": 200
              },
              "clicks": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "uniqueVisitors": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "lastClickAt": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date-time"
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "linkId",
              "title",
              "domain",
              "prefix",
              "slug",
              "clicks",
              "uniqueVisitors",
              "lastClickAt"
            ]
          },
          "maxItems": 1000
        }
      },
      "required": [
        "appId",
        "period",
        "filters",
        "generatedAt",
        "coverage",
        "items"
      ]
    },
    "AnalyticsEvent": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "id": {
          "$ref": "#/$defs/OpaqueId"
        },
        "appId": {
          "$ref": "#/$defs/AppId"
        },
        "linkId": {
          "$ref": "#/$defs/LinkId"
        },
        "type": {
          "enum": [
            "click",
            "app_open",
            "content_view",
            "legacy_content_load"
          ]
        },
        "producer": {
          "enum": [
            "legacy_unknown",
            "worker",
            "flutter_sdk",
            "pilot_legacy"
          ]
        },
        "trust": {
          "enum": [
            "worker_observed",
            "client_reported",
            "legacy_unknown"
          ]
        },
        "occurredAt": {
          "type": "string",
          "format": "date-time"
        },
        "receivedAt": {
          "anyOf": [
            {
              "type": "string",
              "format": "date-time"
            },
            {
              "type": "null"
            }
          ]
        },
        "device": {
          "type": "string",
          "maxLength": 7
        },
        "source": {
          "type": "string",
          "maxLength": 200
        },
        "country": {
          "type": "string",
          "maxLength": 7
        },
        "entryMethod": {
          "type": "string",
          "maxLength": 200
        },
        "openId": {
          "anyOf": [
            {
              "type": "string",
              "format": "uuid"
            },
            {
              "type": "null"
            }
          ]
        },
        "parentEventId": {
          "anyOf": [
            {
              "$ref": "#/$defs/OpaqueId"
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "required": [
        "id",
        "appId",
        "linkId",
        "type",
        "producer",
        "trust",
        "occurredAt",
        "receivedAt",
        "device",
        "source",
        "country",
        "entryMethod",
        "openId",
        "parentEventId"
      ]
    },
    "AnalyticsEvents": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "appId": {
          "$ref": "#/$defs/AppId"
        },
        "period": {
          "$ref": "#/$defs/AnalyticsPeriod"
        },
        "filters": {
          "$ref": "#/$defs/AnalyticsFilters"
        },
        "generatedAt": {
          "type": "string",
          "format": "date-time"
        },
        "coverage": {
          "$ref": "#/$defs/AnalyticsCoverage"
        },
        "events": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/AnalyticsEvent"
          },
          "maxItems": 1000
        }
      },
      "required": [
        "appId",
        "period",
        "filters",
        "generatedAt",
        "coverage",
        "events"
      ]
    },
    "AnalyticsNative": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "appId": {
          "$ref": "#/$defs/AppId"
        },
        "period": {
          "$ref": "#/$defs/AnalyticsPeriod"
        },
        "filters": {
          "$ref": "#/$defs/AnalyticsFilters"
        },
        "generatedAt": {
          "type": "string",
          "format": "date-time"
        },
        "coverage": {
          "$ref": "#/$defs/AnalyticsCoverage"
        },
        "appOpens": {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991
        },
        "contentViews": {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991
        },
        "legacyContentLoads": {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991
        },
        "confirmedOpens24h": {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991
        },
        "matureOpens24h": {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991
        },
        "provisionalOpens24h": {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991
        },
        "cohortWindowHours": {
          "const": 24
        },
        "contentViewRate24h": {
          "anyOf": [
            {
              "type": "number",
              "minimum": 0,
              "maximum": 1
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "required": [
        "appId",
        "period",
        "filters",
        "generatedAt",
        "coverage",
        "appOpens",
        "contentViews",
        "legacyContentLoads",
        "confirmedOpens24h",
        "matureOpens24h",
        "provisionalOpens24h",
        "cohortWindowHours",
        "contentViewRate24h"
      ]
    },
    "AnalyticsRecovery": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "appId": {
          "$ref": "#/$defs/AppId"
        },
        "period": {
          "$ref": "#/$defs/AnalyticsPeriod"
        },
        "filters": {
          "$ref": "#/$defs/AnalyticsFilters"
        },
        "generatedAt": {
          "type": "string",
          "format": "date-time"
        },
        "coverage": {
          "$ref": "#/$defs/AnalyticsCoverage"
        },
        "issuedTokens": {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991
        },
        "stages": {
          "type": "array",
          "items": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "stage": {
                "enum": [
                  "page_presented",
                  "copied",
                  "store_choice",
                  "clip_preview",
                  "recovered"
                ]
              },
              "eventCount": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "tokens": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "stage",
              "eventCount",
              "tokens"
            ]
          },
          "maxItems": 1000
        }
      },
      "required": [
        "appId",
        "period",
        "filters",
        "generatedAt",
        "coverage",
        "issuedTokens",
        "stages"
      ]
    },
    "AnalyticsSummaryEnvelope": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "data": {
          "$ref": "#/$defs/AnalyticsSummary"
        },
        "meta": {
          "$ref": "#/$defs/Meta"
        }
      },
      "required": [
        "data",
        "meta"
      ]
    },
    "AnalyticsTimeseriesEnvelope": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "data": {
          "$ref": "#/$defs/AnalyticsTimeseries"
        },
        "meta": {
          "$ref": "#/$defs/Meta"
        }
      },
      "required": [
        "data",
        "meta"
      ]
    },
    "AnalyticsBreakdownEnvelope": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "data": {
          "$ref": "#/$defs/AnalyticsBreakdown"
        },
        "meta": {
          "$ref": "#/$defs/Meta"
        }
      },
      "required": [
        "data",
        "meta"
      ]
    },
    "AnalyticsTopLinksEnvelope": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "data": {
          "$ref": "#/$defs/AnalyticsTopLinks"
        },
        "pagination": {
          "$ref": "#/$defs/Pagination"
        },
        "meta": {
          "$ref": "#/$defs/Meta"
        }
      },
      "required": [
        "data",
        "pagination",
        "meta"
      ]
    },
    "AnalyticsEventsEnvelope": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "data": {
          "$ref": "#/$defs/AnalyticsEvents"
        },
        "pagination": {
          "$ref": "#/$defs/Pagination"
        },
        "meta": {
          "$ref": "#/$defs/Meta"
        }
      },
      "required": [
        "data",
        "pagination",
        "meta"
      ]
    },
    "AnalyticsNativeEnvelope": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "data": {
          "$ref": "#/$defs/AnalyticsNative"
        },
        "meta": {
          "$ref": "#/$defs/Meta"
        }
      },
      "required": [
        "data",
        "meta"
      ]
    },
    "AnalyticsRecoveryEnvelope": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "data": {
          "$ref": "#/$defs/AnalyticsRecovery"
        },
        "meta": {
          "$ref": "#/$defs/Meta"
        }
      },
      "required": [
        "data",
        "meta"
      ]
    },
    "UtmParameters": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "utm_source": {
          "type": "string",
          "maxLength": 200,
          "minLength": 1,
          "pattern": "^[^\\u0000-\\u001f\\u007f]+$"
        },
        "utm_medium": {
          "type": "string",
          "maxLength": 200,
          "minLength": 1,
          "pattern": "^[^\\u0000-\\u001f\\u007f]+$"
        },
        "utm_campaign": {
          "type": "string",
          "maxLength": 200,
          "minLength": 1,
          "pattern": "^[^\\u0000-\\u001f\\u007f]+$"
        },
        "utm_term": {
          "type": "string",
          "maxLength": 200,
          "minLength": 1,
          "pattern": "^[^\\u0000-\\u001f\\u007f]+$"
        },
        "utm_content": {
          "type": "string",
          "maxLength": 200,
          "minLength": 1,
          "pattern": "^[^\\u0000-\\u001f\\u007f]+$"
        }
      },
      "required": []
    },
    "LinkLifecycle": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "archived": {
          "type": "boolean"
        },
        "paused": {
          "type": "boolean"
        },
        "startsAt": {
          "anyOf": [
            {
              "$ref": "#/$defs/AnalyticsInstant"
            },
            {
              "type": "null"
            }
          ]
        },
        "expiresAt": {
          "anyOf": [
            {
              "$ref": "#/$defs/AnalyticsInstant"
            },
            {
              "type": "null"
            }
          ]
        },
        "fallbackUrl": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 4096,
              "format": "uri",
              "pattern": "^https://[^/@?#\\s]+(?:[/?#]|$)"
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "required": [
        "archived",
        "paused",
        "startsAt",
        "expiresAt",
        "fallbackUrl"
      ]
    },
    "RoutingRule": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "id": {
          "type": "string",
          "maxLength": 50,
          "minLength": 1,
          "pattern": "^[a-zA-Z0-9_-]+$"
        },
        "platform": {
          "enum": [
            "all",
            "desktop",
            "android",
            "ios"
          ]
        },
        "country": {
          "anyOf": [
            {
              "type": "string",
              "pattern": "^[A-Z]{2}$"
            },
            {
              "type": "null"
            }
          ]
        },
        "startsAt": {
          "anyOf": [
            {
              "$ref": "#/$defs/AnalyticsInstant"
            },
            {
              "type": "null"
            }
          ]
        },
        "expiresAt": {
          "anyOf": [
            {
              "$ref": "#/$defs/AnalyticsInstant"
            },
            {
              "type": "null"
            }
          ]
        },
        "destinationUrl": {
          "type": "string",
          "maxLength": 4096,
          "format": "uri",
          "pattern": "^https://[^/@?#\\s]+(?:[/?#]|$)"
        },
        "utm": {
          "$ref": "#/$defs/UtmParameters"
        }
      },
      "required": [
        "id",
        "platform",
        "country",
        "startsAt",
        "expiresAt",
        "destinationUrl",
        "utm"
      ]
    },
    "RoutingRulesPut": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "rules": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/RoutingRule"
          },
          "maxItems": 10
        }
      },
      "required": [
        "rules"
      ]
    },
    "LinkTagsPut": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "tagIds": {
          "type": "array",
          "items": {
            "type": "string",
            "format": "uuid"
          },
          "maxItems": 20,
          "uniqueItems": true
        }
      },
      "required": [
        "tagIds"
      ]
    },
    "OrganizationCreate": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "appId": {
          "$ref": "#/$defs/AppId"
        },
        "name": {
          "type": "string",
          "maxLength": 100,
          "minLength": 1,
          "pattern": "^[^\\u0000-\\u001f\\u007f]+$"
        },
        "description": {
          "type": "string",
          "maxLength": 1000,
          "pattern": "^[^\\u0000-\\u001f\\u007f]*$"
        },
        "archived": {
          "type": "boolean"
        },
        "utm": {
          "$ref": "#/$defs/UtmParameters"
        }
      },
      "required": [
        "appId",
        "name"
      ]
    },
    "OrganizationPatch": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "name": {
          "type": "string",
          "maxLength": 100,
          "minLength": 1,
          "pattern": "^[^\\u0000-\\u001f\\u007f]+$"
        },
        "description": {
          "type": "string",
          "maxLength": 1000,
          "pattern": "^[^\\u0000-\\u001f\\u007f]*$"
        },
        "archived": {
          "type": "boolean"
        },
        "utm": {
          "$ref": "#/$defs/UtmParameters"
        }
      },
      "required": [],
      "minProperties": 1
    },
    "Organization": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "id": {
          "type": "string",
          "format": "uuid"
        },
        "appId": {
          "$ref": "#/$defs/AppId"
        },
        "kind": {
          "enum": [
            "tags",
            "folders",
            "campaigns"
          ]
        },
        "name": {
          "type": "string",
          "maxLength": 100,
          "minLength": 1,
          "pattern": "^[^\\u0000-\\u001f\\u007f]+$"
        },
        "description": {
          "type": "string",
          "maxLength": 1000,
          "pattern": "^[^\\u0000-\\u001f\\u007f]*$"
        },
        "archived": {
          "type": "boolean"
        },
        "utm": {
          "$ref": "#/$defs/UtmParameters"
        },
        "revision": {
          "type": "string",
          "format": "uuid"
        },
        "createdAt": {
          "type": "string",
          "format": "date-time"
        },
        "updatedAt": {
          "type": "string",
          "format": "date-time"
        }
      },
      "required": [
        "id",
        "appId",
        "kind",
        "name",
        "description",
        "archived",
        "utm",
        "revision",
        "createdAt",
        "updatedAt"
      ]
    },
    "QrStyle": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "size": {
          "type": "integer",
          "minimum": 256,
          "maximum": 1024
        },
        "margin": {
          "type": "integer",
          "minimum": 4,
          "maximum": 16
        },
        "errorCorrectionLevel": {
          "enum": [
            "M",
            "Q",
            "H"
          ]
        },
        "dark": {
          "enum": [
            "#000000",
            "#0f172a"
          ]
        },
        "light": {
          "const": "#ffffff"
        }
      },
      "required": [
        "size",
        "margin",
        "errorCorrectionLevel",
        "dark",
        "light"
      ]
    },
    "QrCreate": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "appId": {
          "$ref": "#/$defs/AppId"
        },
        "linkId": {
          "$ref": "#/$defs/LinkId"
        },
        "name": {
          "type": "string",
          "maxLength": 100,
          "minLength": 1,
          "pattern": "^[^\\u0000-\\u001f\\u007f]+$"
        },
        "style": {
          "$ref": "#/$defs/QrStyle"
        }
      },
      "required": [
        "appId",
        "linkId",
        "name"
      ]
    },
    "QrPatch": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "name": {
          "type": "string",
          "maxLength": 100,
          "minLength": 1,
          "pattern": "^[^\\u0000-\\u001f\\u007f]+$"
        },
        "style": {
          "$ref": "#/$defs/QrStyle"
        }
      },
      "required": [],
      "minProperties": 1
    },
    "QrCode": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "id": {
          "type": "string",
          "format": "uuid"
        },
        "appId": {
          "$ref": "#/$defs/AppId"
        },
        "linkId": {
          "$ref": "#/$defs/LinkId"
        },
        "url": {
          "type": "string",
          "maxLength": 4096,
          "format": "uri",
          "pattern": "^https://[^/@?#\\s]+(?:[/?#]|$)"
        },
        "name": {
          "type": "string",
          "maxLength": 100,
          "minLength": 1,
          "pattern": "^[^\\u0000-\\u001f\\u007f]+$"
        },
        "style": {
          "$ref": "#/$defs/QrStyle"
        },
        "revision": {
          "type": "string",
          "format": "uuid"
        },
        "createdAt": {
          "type": "string",
          "format": "date-time"
        },
        "updatedAt": {
          "type": "string",
          "format": "date-time"
        }
      },
      "required": [
        "id",
        "appId",
        "linkId",
        "url",
        "name",
        "style",
        "revision",
        "createdAt",
        "updatedAt"
      ]
    },
    "LinkTags": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "linkId": {
          "$ref": "#/$defs/LinkId"
        },
        "appId": {
          "$ref": "#/$defs/AppId"
        },
        "revision": {
          "type": "string",
          "format": "uuid"
        },
        "tagIds": {
          "type": "array",
          "items": {
            "type": "string",
            "format": "uuid"
          },
          "maxItems": 20,
          "uniqueItems": true
        }
      },
      "required": [
        "linkId",
        "appId",
        "revision",
        "tagIds"
      ]
    },
    "LinkRoutingRules": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "linkId": {
          "$ref": "#/$defs/LinkId"
        },
        "appId": {
          "$ref": "#/$defs/AppId"
        },
        "revision": {
          "type": "string",
          "format": "uuid"
        },
        "rules": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/RoutingRule"
          },
          "maxItems": 10
        }
      },
      "required": [
        "linkId",
        "appId",
        "revision",
        "rules"
      ]
    },
    "LinkHistoryEvent": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "id": {
          "type": "string",
          "format": "uuid"
        },
        "linkId": {
          "$ref": "#/$defs/LinkId"
        },
        "appId": {
          "$ref": "#/$defs/AppId"
        },
        "action": {
          "enum": [
            "create",
            "update",
            "delete"
          ]
        },
        "fields": {
          "type": "array",
          "items": {
            "type": "string",
            "maxLength": 100
          },
          "maxItems": 100
        },
        "revision": {
          "type": "string",
          "format": "uuid"
        },
        "createdAt": {
          "type": "string",
          "format": "date-time"
        }
      },
      "required": [
        "id",
        "linkId",
        "appId",
        "action",
        "fields",
        "revision",
        "createdAt"
      ]
    },
    "OrganizationEnvelope": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "data": {
          "$ref": "#/$defs/Organization"
        },
        "meta": {
          "$ref": "#/$defs/Meta"
        }
      },
      "required": [
        "data",
        "meta"
      ]
    },
    "QrCodeEnvelope": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "data": {
          "$ref": "#/$defs/QrCode"
        },
        "meta": {
          "$ref": "#/$defs/Meta"
        }
      },
      "required": [
        "data",
        "meta"
      ]
    },
    "LinkTagsEnvelope": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "data": {
          "$ref": "#/$defs/LinkTags"
        },
        "meta": {
          "$ref": "#/$defs/Meta"
        }
      },
      "required": [
        "data",
        "meta"
      ]
    },
    "LinkRoutingRulesEnvelope": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "data": {
          "$ref": "#/$defs/LinkRoutingRules"
        },
        "meta": {
          "$ref": "#/$defs/Meta"
        }
      },
      "required": [
        "data",
        "meta"
      ]
    },
    "OrganizationListEnvelope": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "data": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/Organization"
          },
          "maxItems": 100
        },
        "pagination": {
          "$ref": "#/$defs/Pagination"
        },
        "meta": {
          "$ref": "#/$defs/Meta"
        }
      },
      "required": [
        "data",
        "pagination",
        "meta"
      ]
    },
    "QrCodeListEnvelope": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "data": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/QrCode"
          },
          "maxItems": 100
        },
        "pagination": {
          "$ref": "#/$defs/Pagination"
        },
        "meta": {
          "$ref": "#/$defs/Meta"
        }
      },
      "required": [
        "data",
        "pagination",
        "meta"
      ]
    },
    "LinkHistoryListEnvelope": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "data": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/LinkHistoryEvent"
          },
          "maxItems": 100
        },
        "pagination": {
          "$ref": "#/$defs/Pagination"
        },
        "meta": {
          "$ref": "#/$defs/Meta"
        }
      },
      "required": [
        "data",
        "pagination",
        "meta"
      ]
    },
    "BatchItem": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "clientId": {
          "type": "string",
          "maxLength": 100,
          "minLength": 1,
          "pattern": "^[A-Za-z0-9_.-]+$"
        },
        "action": {
          "enum": [
            "create",
            "update",
            "move",
            "archive",
            "delete"
          ]
        },
        "linkId": {
          "$ref": "#/$defs/LinkId"
        },
        "revision": {
          "type": "string",
          "format": "uuid"
        },
        "input": {
          "type": "object",
          "maxProperties": 40,
          "additionalProperties": true
        }
      },
      "required": [
        "clientId",
        "action"
      ]
    },
    "BatchCreate": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "appId": {
          "$ref": "#/$defs/AppId"
        },
        "items": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/BatchItem"
          },
          "maxItems": 50,
          "minItems": 1
        }
      },
      "required": [
        "appId",
        "items"
      ]
    },
    "ImportCreate": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "appId": {
          "$ref": "#/$defs/AppId"
        },
        "format": {
          "enum": [
            "csv",
            "json"
          ]
        },
        "content": {
          "type": "string",
          "maxLength": 24000,
          "minLength": 1
        },
        "mapping": {
          "type": "object",
          "maxProperties": 30,
          "additionalProperties": {
            "enum": [
              "clientId",
              "domain",
              "prefix",
              "slug",
              "title",
              "description",
              "desktopUrl",
              "playStoreUrl",
              "appStoreUrl",
              "appPath",
              "webOnly",
              "behavior",
              "group"
            ]
          }
        }
      },
      "required": [
        "appId",
        "format",
        "content"
      ]
    },
    "ExportCreate": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "appId": {
          "$ref": "#/$defs/AppId"
        },
        "dataset": {
          "enum": [
            "links",
            "events",
            "summary"
          ]
        },
        "format": {
          "enum": [
            "csv",
            "json"
          ]
        },
        "filters": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "start": {
              "$ref": "#/$defs/AnalyticsInstant"
            },
            "end": {
              "$ref": "#/$defs/AnalyticsInstant"
            },
            "timezone": {
              "const": "UTC"
            },
            "group": {
              "enum": [
                "all",
                "main",
                "operational"
              ]
            }
          },
          "required": []
        }
      },
      "required": [
        "appId",
        "dataset",
        "format"
      ]
    },
    "AutomationTask": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "id": {
          "type": "string",
          "format": "uuid"
        },
        "appId": {
          "$ref": "#/$defs/AppId"
        },
        "kind": {
          "enum": [
            "batch",
            "import",
            "export"
          ]
        },
        "state": {
          "enum": [
            "uploaded",
            "validated",
            "queued",
            "running",
            "succeeded",
            "partially_succeeded",
            "failed",
            "cancel_requested",
            "cancelled"
          ]
        },
        "operationId": {
          "anyOf": [
            {
              "$ref": "#/$defs/OpaqueId"
            },
            {
              "type": "null"
            }
          ]
        },
        "revision": {
          "type": "string",
          "format": "uuid"
        },
        "total": {
          "type": "integer",
          "minimum": 0,
          "maximum": 1000
        },
        "succeeded": {
          "type": "integer",
          "minimum": 0
        },
        "failed": {
          "type": "integer",
          "minimum": 0
        },
        "expiresAt": {
          "type": "string",
          "format": "date-time"
        },
        "createdAt": {
          "type": "string",
          "format": "date-time"
        },
        "updatedAt": {
          "type": "string",
          "format": "date-time"
        },
        "downloadUrl": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 1000
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "required": [
        "id",
        "appId",
        "kind",
        "state",
        "operationId",
        "revision",
        "total",
        "succeeded",
        "failed",
        "expiresAt",
        "createdAt",
        "updatedAt",
        "downloadUrl"
      ]
    },
    "AutomationItem": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "clientId": {
          "type": "string",
          "maxLength": 100,
          "minLength": 1,
          "pattern": "^[A-Za-z0-9_.-]+$"
        },
        "ordinal": {
          "type": "integer",
          "minimum": 1,
          "maximum": 50
        },
        "state": {
          "enum": [
            "pending",
            "valid",
            "invalid",
            "succeeded",
            "failed"
          ]
        },
        "result": {
          "anyOf": [
            {
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "id": {
                  "$ref": "#/$defs/LinkId"
                },
                "revision": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "uuid"
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              },
              "required": [
                "id",
                "revision"
              ]
            },
            {
              "type": "null"
            }
          ]
        },
        "error": {
          "anyOf": [
            {
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "code": {
                  "type": "string",
                  "maxLength": 100
                },
                "message": {
                  "type": "string",
                  "maxLength": 300
                }
              },
              "required": [
                "code",
                "message"
              ]
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "required": [
        "clientId",
        "ordinal",
        "state",
        "result",
        "error"
      ]
    },
    "WebhookCreate": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "appId": {
          "$ref": "#/$defs/AppId"
        },
        "name": {
          "type": "string",
          "maxLength": 100,
          "minLength": 1,
          "pattern": "^[^\\u0000-\\u001f\\u007f]+$"
        },
        "url": {
          "type": "string",
          "maxLength": 2048,
          "format": "uri",
          "pattern": "^https://[^/@?#\\s]+(?:/[^#]*)?$"
        },
        "events": {
          "type": "array",
          "items": {
            "enum": [
              "link.created",
              "link.updated",
              "link.deleted",
              "domain.status_changed",
              "template.publication_succeeded",
              "template.publication_failed",
              "operation.completed",
              "operation.failed",
              "export.ready"
            ]
          },
          "maxItems": 9,
          "minItems": 1,
          "uniqueItems": true
        }
      },
      "required": [
        "appId",
        "name",
        "url",
        "events"
      ]
    },
    "WebhookPatch": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "name": {
          "type": "string",
          "maxLength": 100,
          "minLength": 1,
          "pattern": "^[^\\u0000-\\u001f\\u007f]+$"
        },
        "url": {
          "type": "string",
          "maxLength": 2048,
          "format": "uri",
          "pattern": "^https://[^/@?#\\s]+(?:/[^#]*)?$"
        },
        "events": {
          "type": "array",
          "items": {
            "enum": [
              "link.created",
              "link.updated",
              "link.deleted",
              "domain.status_changed",
              "template.publication_succeeded",
              "template.publication_failed",
              "operation.completed",
              "operation.failed",
              "export.ready"
            ]
          },
          "maxItems": 9,
          "minItems": 1,
          "uniqueItems": true
        },
        "enabled": {
          "type": "boolean"
        }
      },
      "required": [],
      "minProperties": 1
    },
    "WebhookRotate": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "overlapSeconds": {
          "type": "integer",
          "minimum": 0,
          "maximum": 86400
        }
      },
      "required": []
    },
    "Webhook": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "id": {
          "type": "string",
          "format": "uuid"
        },
        "appId": {
          "$ref": "#/$defs/AppId"
        },
        "name": {
          "type": "string",
          "maxLength": 100,
          "minLength": 1,
          "pattern": "^[^\\u0000-\\u001f\\u007f]+$"
        },
        "url": {
          "type": "string",
          "maxLength": 2048,
          "format": "uri",
          "pattern": "^https://[^/@?#\\s]+(?:/[^#]*)?$"
        },
        "events": {
          "type": "array",
          "items": {
            "enum": [
              "link.created",
              "link.updated",
              "link.deleted",
              "domain.status_changed",
              "template.publication_succeeded",
              "template.publication_failed",
              "operation.completed",
              "operation.failed",
              "export.ready"
            ]
          },
          "maxItems": 9,
          "minItems": 1,
          "uniqueItems": true
        },
        "enabled": {
          "type": "boolean"
        },
        "failures": {
          "type": "integer",
          "minimum": 0
        },
        "revision": {
          "type": "string",
          "format": "uuid"
        },
        "previousSecretExpiresAt": {
          "anyOf": [
            {
              "type": "string",
              "format": "date-time"
            },
            {
              "type": "null"
            }
          ]
        },
        "createdAt": {
          "type": "string",
          "format": "date-time"
        },
        "updatedAt": {
          "type": "string",
          "format": "date-time"
        }
      },
      "required": [
        "id",
        "appId",
        "name",
        "url",
        "events",
        "enabled",
        "failures",
        "revision",
        "previousSecretExpiresAt",
        "createdAt",
        "updatedAt"
      ]
    },
    "Delivery": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "id": {
          "type": "string",
          "format": "uuid"
        },
        "appId": {
          "$ref": "#/$defs/AppId"
        },
        "webhookId": {
          "type": "string",
          "format": "uuid"
        },
        "eventId": {
          "type": "string",
          "format": "uuid"
        },
        "eventType": {
          "enum": [
            "link.created",
            "link.updated",
            "link.deleted",
            "domain.status_changed",
            "template.publication_succeeded",
            "template.publication_failed",
            "operation.completed",
            "operation.failed",
            "export.ready",
            "webhook.test"
          ]
        },
        "test": {
          "type": "boolean"
        },
        "state": {
          "enum": [
            "pending",
            "sending",
            "succeeded",
            "failed",
            "cancelled"
          ]
        },
        "attempts": {
          "type": "integer",
          "minimum": 0,
          "maximum": 5
        },
        "statusCode": {
          "anyOf": [
            {
              "type": "integer",
              "minimum": 100,
              "maximum": 599
            },
            {
              "type": "null"
            }
          ]
        },
        "errorCode": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 100
            },
            {
              "type": "null"
            }
          ]
        },
        "nextAttemptAt": {
          "type": "string",
          "format": "date-time"
        },
        "revision": {
          "type": "string",
          "format": "uuid"
        },
        "createdAt": {
          "type": "string",
          "format": "date-time"
        },
        "expiresAt": {
          "type": "string",
          "format": "date-time"
        }
      },
      "required": [
        "id",
        "appId",
        "webhookId",
        "eventId",
        "eventType",
        "test",
        "state",
        "attempts",
        "statusCode",
        "errorCode",
        "nextAttemptAt",
        "revision",
        "createdAt",
        "expiresAt"
      ]
    },
    "WebhookEvent": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "id": {
          "type": "string",
          "format": "uuid"
        },
        "type": {
          "enum": [
            "link.created",
            "link.updated",
            "link.deleted",
            "domain.status_changed",
            "template.publication_succeeded",
            "template.publication_failed",
            "operation.completed",
            "operation.failed",
            "export.ready",
            "webhook.test"
          ]
        },
        "schemaVersion": {
          "const": "1"
        },
        "appId": {
          "$ref": "#/$defs/AppId"
        },
        "occurredAt": {
          "type": "string",
          "format": "date-time"
        },
        "test": {
          "type": "boolean"
        },
        "resource": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "id": {
              "type": "string",
              "maxLength": 500
            },
            "revision": {
              "anyOf": [
                {
                  "type": "string",
                  "format": "uuid"
                },
                {
                  "type": "null"
                }
              ]
            }
          },
          "required": [
            "id",
            "revision"
          ]
        }
      },
      "required": [
        "id",
        "type",
        "schemaVersion",
        "appId",
        "occurredAt",
        "test",
        "resource"
      ]
    },
    "AutomationEnvelope": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "data": {
          "$ref": "#/$defs/AutomationTask"
        },
        "meta": {
          "$ref": "#/$defs/Meta"
        }
      },
      "required": [
        "data",
        "meta"
      ]
    },
    "WebhookEnvelope": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "data": {
          "$ref": "#/$defs/Webhook"
        },
        "meta": {
          "$ref": "#/$defs/Meta"
        }
      },
      "required": [
        "data",
        "meta"
      ]
    },
    "DeliveryEnvelope": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "data": {
          "$ref": "#/$defs/Delivery"
        },
        "meta": {
          "$ref": "#/$defs/Meta"
        }
      },
      "required": [
        "data",
        "meta"
      ]
    },
    "AutomationItemListEnvelope": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "data": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/AutomationItem"
          },
          "maxItems": 100
        },
        "pagination": {
          "$ref": "#/$defs/Pagination"
        },
        "meta": {
          "$ref": "#/$defs/Meta"
        }
      },
      "required": [
        "data",
        "pagination",
        "meta"
      ]
    },
    "WebhookListEnvelope": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "data": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/Webhook"
          },
          "maxItems": 100
        },
        "pagination": {
          "$ref": "#/$defs/Pagination"
        },
        "meta": {
          "$ref": "#/$defs/Meta"
        }
      },
      "required": [
        "data",
        "pagination",
        "meta"
      ]
    },
    "DeliveryListEnvelope": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "data": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/Delivery"
          },
          "maxItems": 100
        },
        "pagination": {
          "$ref": "#/$defs/Pagination"
        },
        "meta": {
          "$ref": "#/$defs/Meta"
        }
      },
      "required": [
        "data",
        "pagination",
        "meta"
      ]
    },
    "WebhookIssuedEnvelope": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "data": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "webhook": {
              "$ref": "#/$defs/Webhook"
            },
            "secret": {
              "type": "string",
              "pattern": "^whsec_[A-Za-z0-9_-]{43}$"
            }
          },
          "required": [
            "webhook",
            "secret"
          ]
        },
        "meta": {
          "$ref": "#/$defs/Meta"
        }
      },
      "required": [
        "data",
        "meta"
      ]
    },
    "AppPatch": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "name": {
          "type": "string",
          "maxLength": 100,
          "minLength": 1,
          "pattern": "^(?=.*\\S)[^\\u0000-\\u001f\\u007f]+$"
        },
        "defaultDomain": {
          "anyOf": [
            {
              "$ref": "#/$defs/Domain"
            },
            {
              "type": "null"
            }
          ]
        },
        "desktopUrl": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 4096,
              "format": "uri",
              "pattern": "^https://[^/@?#\\s]+(?:[/?#]|$)"
            },
            {
              "type": "null"
            }
          ]
        },
        "playStoreUrl": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 4096,
              "format": "uri",
              "pattern": "^https://[^/@?#\\s]+(?:[/?#]|$)"
            },
            {
              "type": "null"
            }
          ]
        },
        "appStoreUrl": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 4096,
              "format": "uri",
              "pattern": "^https://[^/@?#\\s]+(?:[/?#]|$)"
            },
            {
              "type": "null"
            }
          ]
        },
        "scheme": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 100,
              "pattern": "^[a-z][a-z0-9+.-]*$",
              "not": {
                "enum": [
                  "http",
                  "https",
                  "javascript",
                  "data",
                  "file"
                ]
              }
            },
            {
              "type": "null"
            }
          ]
        },
        "androidPackage": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 255,
              "pattern": "^[A-Za-z][A-Za-z0-9_]*(?:\\.[A-Za-z][A-Za-z0-9_]*)+$"
            },
            {
              "type": "null"
            }
          ]
        },
        "iosBundleId": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 255,
              "pattern": "^[A-Za-z0-9-]+(?:\\.[A-Za-z0-9-]+)+$"
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "required": [],
      "minProperties": 1
    },
    "AppListEnvelope": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "data": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/App"
          },
          "maxItems": 100
        },
        "pagination": {
          "$ref": "#/$defs/Pagination"
        },
        "meta": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "requestId": {
              "$ref": "#/$defs/RequestId"
            }
          },
          "required": [
            "requestId"
          ]
        }
      },
      "required": [
        "data",
        "pagination",
        "meta"
      ]
    },
    "AssetListEnvelope": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "data": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/Asset"
          },
          "maxItems": 100
        },
        "pagination": {
          "$ref": "#/$defs/Pagination"
        },
        "meta": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "requestId": {
              "$ref": "#/$defs/RequestId"
            }
          },
          "required": [
            "requestId"
          ]
        }
      },
      "required": [
        "data",
        "pagination",
        "meta"
      ]
    },
    "AppEnvelope": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "data": {
          "$ref": "#/$defs/App"
        },
        "meta": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "requestId": {
              "$ref": "#/$defs/RequestId"
            }
          },
          "required": [
            "requestId"
          ]
        }
      },
      "required": [
        "data",
        "meta"
      ]
    },
    "AppDefaultsEnvelope": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "data": {
          "$ref": "#/$defs/AppDefaults"
        },
        "meta": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "requestId": {
              "$ref": "#/$defs/RequestId"
            }
          },
          "required": [
            "requestId"
          ]
        }
      },
      "required": [
        "data",
        "meta"
      ]
    },
    "AppLogoEnvelope": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "data": {
          "$ref": "#/$defs/AppLogo"
        },
        "meta": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "requestId": {
              "$ref": "#/$defs/RequestId"
            }
          },
          "required": [
            "requestId"
          ]
        }
      },
      "required": [
        "data",
        "meta"
      ]
    },
    "AssetEnvelope": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "data": {
          "$ref": "#/$defs/Asset"
        },
        "meta": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "requestId": {
              "$ref": "#/$defs/RequestId"
            }
          },
          "required": [
            "requestId"
          ]
        }
      },
      "required": [
        "data",
        "meta"
      ]
    },
    "LinkAvailabilityEnvelope": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "data": {
          "$ref": "#/$defs/LinkAvailability"
        },
        "meta": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "requestId": {
              "$ref": "#/$defs/RequestId"
            }
          },
          "required": [
            "requestId"
          ]
        }
      },
      "required": [
        "data",
        "meta"
      ]
    },
    "LinkValidationEnvelope": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "data": {
          "$ref": "#/$defs/LinkValidation"
        },
        "meta": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "requestId": {
              "$ref": "#/$defs/RequestId"
            }
          },
          "required": [
            "requestId"
          ]
        }
      },
      "required": [
        "data",
        "meta"
      ]
    },
    "LinkPreviewResultEnvelope": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "data": {
          "$ref": "#/$defs/LinkPreviewResult"
        },
        "meta": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "requestId": {
              "$ref": "#/$defs/RequestId"
            }
          },
          "required": [
            "requestId"
          ]
        }
      },
      "required": [
        "data",
        "meta"
      ]
    },
    "LinkPublicationEnvelope": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "data": {
          "$ref": "#/$defs/LinkPublication"
        },
        "meta": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "requestId": {
              "$ref": "#/$defs/RequestId"
            }
          },
          "required": [
            "requestId"
          ]
        }
      },
      "required": [
        "data",
        "meta"
      ]
    },
    "MeEnvelope": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "data": {
          "$ref": "#/$defs/Me"
        },
        "meta": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "requestId": {
              "$ref": "#/$defs/RequestId"
            }
          },
          "required": [
            "requestId"
          ]
        }
      },
      "required": [
        "data",
        "meta"
      ]
    },
    "PreferencesEnvelope": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "data": {
          "$ref": "#/$defs/Preferences"
        },
        "meta": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "requestId": {
              "$ref": "#/$defs/RequestId"
            }
          },
          "required": [
            "requestId"
          ]
        }
      },
      "required": [
        "data",
        "meta"
      ]
    },
    "OperationEnvelope": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "data": {
          "$ref": "#/$defs/Operation"
        },
        "meta": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "requestId": {
              "$ref": "#/$defs/RequestId"
            }
          },
          "required": [
            "requestId"
          ]
        }
      },
      "required": [
        "data",
        "meta"
      ]
    }
  }
}
