{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://docs.horusbi.com.br/schemas/v2/flow.schema.json",
  "title": "Lumo v2 flow YAML",
  "type": "object",
  "required": [
    "header",
    "body"
  ],
  "properties": {
    "fileName": {
      "$ref": "shared.schema.json#/$defs/resourceFileName"
    },
    "header": {
      "allOf": [
        {
          "$ref": "shared.schema.json#/$defs/resourceHeaderBase"
        },
        {
          "type": "object",
          "required": [
            "id"
          ],
          "properties": {
            "kind": {
              "const": "flow"
            }
          }
        }
      ]
    },
    "body": {
      "allOf": [
        {
          "$ref": "shared.schema.json#/$defs/auditFields"
        },
        {
          "type": "object",
          "required": [
            "nome",
            "load_type",
            "nodes"
          ],
          "properties": {
            "nome": {
              "type": "string",
              "minLength": 1
            },
            "_state": {
              "$ref": "shared.schema.json#/$defs/readOnlyState"
            },
            "load_type": {
              "$ref": "shared.schema.json#/$defs/loadType"
            },
            "load_type_column": {
              "type": [
                "string",
                "null"
              ]
            },
            "deskId": {
              "$ref": "shared.schema.json#/$defs/readOnlyDeskId"
            },
            "cloned_from": {
              "$ref": "shared.schema.json#/$defs/readOnlyClonedFrom"
            },
            "originalTableId": {
              "$ref": "shared.schema.json#/$defs/readOnlyOriginalTableId"
            },
            "version": {
              "$ref": "shared.schema.json#/$defs/readOnlyVersion"
            },
            "tokenId": {
              "$ref": "shared.schema.json#/$defs/nullableId",
              "description": "Editable canonical agent/token assignment for this flow."
            },
            "development_variables": {
              "type": "array",
              "items": {
                "$ref": "shared.schema.json#/$defs/jsonValue"
              }
            },
            "nodes": {
              "type": "object",
              "required": [
                "Connections",
                "Processors"
              ],
              "properties": {
                "Connections": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "required": [
                      "from",
                      "to"
                    ],
                    "properties": {
                      "from": {
                        "type": "string"
                      },
                      "to": {
                        "type": "string"
                      }
                    },
                    "additionalProperties": true
                  }
                },
                "Processors": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "required": [
                      "internalId",
                      "kind"
                    ],
                    "properties": {
                      "complete_id": {
                        "type": "string"
                      },
                      "internalId": {
                        "type": "string",
                        "minLength": 1
                      },
                      "kind": {
                        "type": "string",
                        "minLength": 1
                      },
                      "description": {
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "inputs": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "metadata": {
                        "$ref": "shared.schema.json#/$defs/freeformObject"
                      },
                      "options": {
                        "$ref": "shared.schema.json#/$defs/freeformObject"
                      },
                      "x": {
                        "type": "number"
                      },
                      "y": {
                        "type": "number"
                      }
                    },
                    "additionalProperties": true
                  }
                }
              },
              "additionalProperties": true
            },
            "table": {
              "type": [
                "object",
                "null"
              ],
              "properties": {
                "id": {
                  "$ref": "shared.schema.json#/$defs/id"
                },
                "nome": {
                  "type": "string"
                }
              },
              "additionalProperties": true
            },
            "tags": {
              "$ref": "shared.schema.json#/$defs/tagList"
            },
            "owners": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "userId": {
                    "$ref": "shared.schema.json#/$defs/id"
                  }
                },
                "additionalProperties": true
              }
            }
          },
          "additionalProperties": true
        }
      ]
    }
  },
  "additionalProperties": false
}
