{
  "$id": "https://opendatafabric.org/schemas/flows/v1alpha1/FlowSpec",
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "description": "Defines a sequence of tasks to be executed upon certain trigger conditions.",
  "type": "object",
  "required": [
    "target",
    "triggers",
    "tasks"
  ],
  "properties": {
    "target": {
      "$ref": "https://opendatafabric.org/schemas/resources/v1alpha1/ResourceSelector",
      "unevaluatedProperties": false,
      "description": "Defines resources for which this flow will be instantiated."
    },
    "serviceAccount": {
      "$ref": "https://opendatafabric.org/schemas/auth/v1alpha1/PrincipalHandle",
      "unevaluatedProperties": false,
      "description": "Service account whose permissions the tasks of this flow execute with. Must be an account of service account type. Required for flows owned by an organization. When omitted, tasks execute with the permissions of the user account that owns the flow."
    },
    "triggers": {
      "type": "array",
      "items": {
        "$ref": "https://opendatafabric.org/schemas/flows/v1alpha1/FlowTrigger",
        "unevaluatedProperties": false
      },
      "description": "Conditions that cause this flow to execute."
    },
    "tasks": {
      "type": "array",
      "items": {
        "$ref": "https://opendatafabric.org/schemas/tasks/v1alpha1/TaskSpec",
        "unevaluatedProperties": false
      },
      "description": "List of tasks to run consecutively."
    },
    "retryPolicy": {
      "$ref": "https://opendatafabric.org/schemas/flows/v1alpha1/RetryPolicy",
      "unevaluatedProperties": false,
      "description": "Defines how a flow should react to failures."
    },
    "recentBindingsRetention": {
      "$ref": "https://opendatafabric.org/schemas/flows/v1alpha1/RecentBindingsRetention",
      "unevaluatedProperties": false,
      "description": "Controls retention of `FlowStatus.recentBindings`."
    },
    "recentRunsRetention": {
      "$ref": "https://opendatafabric.org/schemas/flows/v1alpha1/RecentRunsRetention",
      "unevaluatedProperties": false,
      "description": "Controls retention of `FlowStatus.recentRuns`."
    }
  }
}
