{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "title": "FormKiQ v1.19.2 event payloads",
  "description": "Documentation schemas for built-in document delivery channels; fields not supplied by a producer may be omitted. Additional fields are allowed.",
  "definitions": {
    "documentProcessing": {
      "type": "object",
      "required": [
        "type"
      ],
      "properties": {
        "siteId": {
          "type": "string"
        },
        "documentId": {
          "type": "string"
        },
        "artifactId": {
          "type": "string"
        },
        "s3bucket": {
          "type": "string"
        },
        "s3key": {
          "type": "string"
        },
        "userId": {
          "type": "string"
        },
        "path": {
          "type": "string"
        },
        "contentType": {
          "type": "string"
        },
        "content": {
          "type": "string"
        },
        "url": {
          "type": "string"
        },
        "type": {
          "enum": [
            "create",
            "update",
            "delete",
            "softDelete",
            "actions"
          ]
        },
        "tags": {
          "type": "object",
          "additionalProperties": {
            "type": "string"
          }
        }
      }
    },
    "folderMove": {
      "type": "object",
      "required": [
        "type"
      ],
      "properties": {
        "type": {
          "const": "folder_move"
        },
        "siteId": {
          "type": "string"
        },
        "documentId": {
          "type": "string"
        },
        "sourcePath": {
          "type": "string"
        },
        "destinationPath": {
          "type": "string"
        }
      }
    },
    "notificationTest": {
      "type": "object",
      "required": [
        "type"
      ],
      "properties": {
        "type": {
          "const": "testNotification"
        },
        "siteId": {
          "type": "string"
        },
        "to": {
          "type": "string"
        },
        "userId": {
          "type": "string"
        }
      }
    },
    "documentExport": {
      "type": "object",
      "required": [
        "document"
      ],
      "properties": {
        "document": {
          "type": "object",
          "required": [
            "documentId",
            "siteId"
          ],
          "properties": {
            "documentId": {
              "type": "string"
            },
            "siteId": {
              "type": "string"
            },
            "artifactId": {
              "type": "string"
            },
            "path": {
              "type": "string"
            },
            "contentType": {
              "type": "string"
            },
            "url": {
              "type": "string"
            },
            "status": {
              "type": "string"
            },
            "timestamp": {
              "type": "string"
            },
            "attributes": {
              "type": "object",
              "additionalProperties": {
                "type": "object"
              }
            },
            "changed": {
              "type": "object"
            },
            "addedAttributes": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "changedAttributes": {
              "type": "object"
            }
          }
        }
      }
    },
    "eventBridge": {
      "type": "object",
      "required": [
        "detail-type",
        "source",
        "detail"
      ],
      "properties": {
        "version": {
          "type": "string"
        },
        "id": {
          "type": "string"
        },
        "account": {
          "type": "string"
        },
        "time": {
          "type": "string"
        },
        "region": {
          "type": "string"
        },
        "resources": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "source": {
          "type": "string",
          "pattern": "^formkiq\\."
        },
        "detail-type": {
          "enum": [
            "New Document Create Metadata",
            "New Document Create Content",
            "Document Create Content",
            "Document Restore",
            "Document Update Metadata",
            "Document Create Metadata",
            "Document Soft Delete",
            "Document Delete",
            "Document Delete Metadata",
            "Document Action Event"
          ]
        },
        "detail": {
          "$ref": "#/definitions/documentExport"
        }
      }
    }
  },
  "oneOf": [
    {
      "$ref": "#/definitions/documentProcessing"
    },
    {
      "$ref": "#/definitions/folderMove"
    },
    {
      "$ref": "#/definitions/notificationTest"
    },
    {
      "$ref": "#/definitions/eventBridge"
    }
  ]
}
