{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://catalog.lintel.tools/schemas/schemastore/c4interflow/latest.json",
  "x-lintel": {
    "source": "https://raw.githubusercontent.com/SlavaVedernikov/C4InterFlow/refs/heads/master/C4InterFlow/schema.json",
    "sourceSha256": "4317007f46fb482be46216db1c824290318ab7ba478fb99dc87c8cdd08e14d9c",
    "fileMatch": [
      "**/*.c4interflow.yaml",
      "**/*.c4interflow.json"
    ],
    "parsers": [
      "json",
      "yaml"
    ]
  },
  "type": "object",
  "$defs": {
    "Namespace": {
      "type": "object",
      "properties": {
        "Label": {
          "type": "string"
        },
        "Actors": {
          "type": "object",
          "additionalProperties": {
            "$ref": "#/$defs/Actor"
          }
        },
        "SoftwareSystems": {
          "type": "object",
          "additionalProperties": {
            "$ref": "#/$defs/SoftwareSystem"
          }
        },
        "BusinessProcesses": {
          "type": "object",
          "additionalProperties": {
            "$ref": "#/$defs/BusinessProcess"
          }
        },
        "Views": {
          "type": "object",
          "additionalProperties": {
            "$ref": "#/$defs/View"
          }
        }
      },
      "additionalProperties": {
        "$ref": "#/$defs/Namespace"
      }
    },
    "View": {
      "type": "object",
      "properties": {
        "Label": {
          "type": "string"
        },
        "Description": {
          "type": "string"
        },
        "Scopes": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/View.Scope"
          }
        },
        "Types": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/View.Type"
          }
        },
        "LevelsOfDetails": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/View.LevelOfDetails"
          }
        },
        "Formats": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/View.Format"
          }
        },
        "Interfaces": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "BusinessProcesses": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "Namespaces": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "MaxLineLabels": {
          "type": "integer"
        },
        "ExpandUpstream": {
          "type": "boolean"
        }
      },
      "required": [],
      "additionalProperties": false
    },
    "View.Scope": {
      "type": "string",
      "enum": [
        "AllSoftwareSystems",
        "Namespace",
        "NamespaceSoftwareSystems",
        "SoftwareSystem",
        "SoftwareSystemInterface",
        "Container",
        "ContainerInterface",
        "Component",
        "ComponentInterface",
        "BusinessProcess"
      ]
    },
    "View.Type": {
      "type": "string",
      "enum": [
        "C4",
        "C4Static",
        "C4Sequence",
        "Sequence",
        "Entity"
      ]
    },
    "View.LevelOfDetails": {
      "type": "string",
      "enum": [
        "Context",
        "Container",
        "Component"
      ]
    },
    "View.Format": {
      "type": "string",
      "enum": [
        "Puml",
        "Svg",
        "Png",
        "Md"
      ]
    },
    "Actor": {
      "oneOf": [
        {
          "type": "object",
          "properties": {
            "Type": {
              "type": "string",
              "enum": [
                "Person"
              ]
            },
            "Label": {
              "type": "string"
            },
            "Description": {
              "type": "string"
            },
            "Activities": {
              "type": "object",
              "additionalProperties": {
                "$ref": "#/$defs/ActivityBase"
              }
            }
          },
          "required": [
            "Type"
          ],
          "additionalProperties": false
        },
        {
          "type": "object",
          "properties": {
            "Type": {
              "type": "string",
              "enum": [
                "SoftwareSystem"
              ]
            },
            "Label": {
              "type": "string"
            },
            "Description": {
              "type": "string"
            }
          },
          "required": [
            "Type"
          ],
          "additionalProperties": false
        }
      ]
    },
    "ActivityBase": {
      "type": "object",
      "properties": {
        "Label": {
          "type": "string"
        },
        "Description": {
          "type": "string"
        },
        "Flows": {
          "$ref": "#/$defs/Flows"
        }
      },
      "required": [
        "Flows"
      ]
    },
    "SoftwareSystem": {
      "type": "object",
      "properties": {
        "Label": {
          "type": "string"
        },
        "Description": {
          "type": "string"
        },
        "Boundary": {
          "$ref": "#/$defs/Boundary"
        },
        "Tags": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "Icon": {
          "type": "string"
        },
        "Attributes": {
          "type": "object",
          "additionalProperties": {
            "$ref": "#/$defs/Attribute"
          }
        },
        "Containers": {
          "type": "object",
          "additionalProperties": {
            "$ref": "#/$defs/Container"
          }
        },
        "Interfaces": {
          "type": "object",
          "additionalProperties": {
            "$ref": "#/$defs/Interface"
          }
        }
      },
      "additionalProperties": false
    },
    "Container": {
      "type": "object",
      "properties": {
        "Label": {
          "type": "string"
        },
        "Description": {
          "type": "string"
        },
        "Boundary": {
          "$ref": "#/$defs/Boundary"
        },
        "ContainerType": {
          "type": "string",
          "enum": [
            "Mobile",
            "WebApplication",
            "ServerConsole",
            "ClientDesktop",
            "ServerlessFunction",
            "Blob",
            "FileSystem",
            "ShellScript",
            "Spa",
            "Api",
            "Microservice",
            "Queue",
            "Topic",
            "Database",
            "Cache",
            "IntegrationService",
            "IdentityService",
            "None"
          ]
        },
        "Technology": {
          "type": "string"
        },
        "Tags": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "Icon": {
          "type": "string"
        },
        "Attributes": {
          "type": "object",
          "additionalProperties": {
            "$ref": "#/$defs/Attribute"
          }
        },
        "Components": {
          "type": "object",
          "additionalProperties": {
            "$ref": "#/$defs/Component"
          }
        },
        "Entities": {
          "type": "object",
          "additionalProperties": {
            "$ref": "#/$defs/Entity"
          }
        },
        "Interfaces": {
          "type": "object",
          "additionalProperties": {
            "$ref": "#/$defs/Interface"
          }
        }
      },
      "additionalProperties": false
    },
    "Component": {
      "type": "object",
      "properties": {
        "Label": {
          "type": "string"
        },
        "Description": {
          "type": "string"
        },
        "ComponentType": {
          "type": "string",
          "enum": [
            "Database",
            "Queue",
            "Topic",
            "TopicSubscription"
          ]
        },
        "Technology": {
          "type": "string"
        },
        "Boundary": {
          "$ref": "#/$defs/Boundary"
        },
        "Tags": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "Icon": {
          "type": "string"
        },
        "Attributes": {
          "type": "object",
          "additionalProperties": {
            "$ref": "#/$defs/Attribute"
          }
        },
        "Interfaces": {
          "type": "object",
          "additionalProperties": {
            "$ref": "#/$defs/Interface"
          }
        }
      },
      "additionalProperties": false
    },
    "Entity": {
      "type": "object",
      "properties": {
        "Label": {
          "type": "string"
        },
        "Description": {
          "type": "string"
        },
        "EntityType": {
          "type": "string",
          "enum": [
            "None",
            "Enum",
            "Data",
            "Message",
            "Query",
            "Command"
          ]
        },
        "Tags": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "Attributes": {
          "type": "object",
          "additionalProperties": {
            "$ref": "#/$defs/Attribute"
          }
        }
      },
      "additionalProperties": false
    },
    "Attribute": {
      "oneOf": [
        {
          "type": "object"
        },
        {
          "type": "array",
          "items": {
            "type": "object"
          }
        },
        {
          "type": "string"
        }
      ]
    },
    "Interface": {
      "type": "object",
      "properties": {
        "Label": {
          "type": "string"
        },
        "Description": {
          "type": "string"
        },
        "Protocol": {
          "type": "string"
        },
        "Path": {
          "type": "string"
        },
        "Flows": {
          "$ref": "#/$defs/Flows"
        },
        "Input": {
          "type": "string"
        },
        "InputTemplate": {
          "type": "string"
        },
        "Output": {
          "type": "string"
        },
        "OutputTemplate": {
          "type": "string"
        }
      },
      "additionalProperties": false
    },
    "Boundary": {
      "type": "string",
      "enum": [
        "Internal",
        "External"
      ]
    },
    "Activity": {
      "type": "object",
      "allOf": [
        {
          "$ref": "#/$defs/ActivityBase"
        }
      ],
      "properties": {
        "Actor": {
          "type": "string"
        }
      },
      "required": [
        "Label",
        "Flows"
      ]
    },
    "BusinessProcess": {
      "type": "object",
      "properties": {
        "Label": {
          "type": "string"
        },
        "Description": {
          "type": "string"
        },
        "Activities": {
          "type": "array",
          "items": {
            "anyOf": [
              {
                "$ref": "#/$defs/Activity"
              },
              {
                "type": "string"
              }
            ]
          }
        }
      },
      "required": [
        "Activities"
      ],
      "additionalProperties": false
    },
    "Flows": {
      "type": "array",
      "items": {
        "anyOf": [
          {
            "$ref": "#/$defs/Flow.Use"
          },
          {
            "$ref": "#/$defs/Flow.If"
          },
          {
            "$ref": "#/$defs/Flow.Loop"
          },
          {
            "$ref": "#/$defs/Flow.Group"
          },
          {
            "$ref": "#/$defs/Flow.Try"
          },
          {
            "$ref": "#/$defs/Flow.ThrowException"
          },
          {
            "$ref": "#/$defs/Flow.Return"
          }
        ]
      }
    },
    "Flow.Use": {
      "type": "object",
      "properties": {
        "Type": {
          "type": "string",
          "enum": [
            "Use"
          ]
        },
        "Expression": {
          "$ref": "#/$defs/Flow.Use.Expression"
        }
      },
      "required": [
        "Type",
        "Expression"
      ]
    },
    "Flow.If": {
      "type": "object",
      "properties": {
        "Type": {
          "type": "string",
          "enum": [
            "If"
          ]
        },
        "Expression": {
          "type": "string"
        },
        "Flows": {
          "type": "array",
          "items": {
            "anyOf": [
              {
                "$ref": "#/$defs/Flow.Use"
              },
              {
                "$ref": "#/$defs/Flow.If"
              },
              {
                "$ref": "#/$defs/Flow.ElseIf"
              },
              {
                "$ref": "#/$defs/Flow.Else"
              },
              {
                "$ref": "#/$defs/Flow.Loop"
              },
              {
                "$ref": "#/$defs/Flow.Group"
              },
              {
                "$ref": "#/$defs/Flow.Try"
              },
              {
                "$ref": "#/$defs/Flow.ThrowException"
              },
              {
                "$ref": "#/$defs/Flow.Return"
              }
            ]
          }
        }
      },
      "required": [
        "Type",
        "Expression",
        "Flows"
      ]
    },
    "Flow.ElseIf": {
      "type": "object",
      "properties": {
        "Type": {
          "type": "string",
          "enum": [
            "ElseIf"
          ]
        },
        "Expression": {
          "type": "string"
        },
        "Flows": {
          "$ref": "#/$defs/Flows"
        }
      },
      "required": [
        "Type",
        "Expression",
        "Flows"
      ]
    },
    "Flow.Else": {
      "type": "object",
      "properties": {
        "Type": {
          "type": "string",
          "enum": [
            "Else"
          ]
        },
        "Flows": {
          "$ref": "#/$defs/Flows"
        }
      },
      "required": [
        "Type",
        "Flows"
      ]
    },
    "Flow.Loop": {
      "type": "object",
      "properties": {
        "Type": {
          "type": "string",
          "enum": [
            "Loop"
          ]
        },
        "Expression": {
          "type": "string"
        },
        "Flows": {
          "$ref": "#/$defs/Flows"
        }
      },
      "required": [
        "Type",
        "Expression",
        "Flows"
      ]
    },
    "Flow.Group": {
      "type": "object",
      "properties": {
        "Type": {
          "type": "string",
          "enum": [
            "Group"
          ]
        },
        "Expression": {
          "type": "string"
        },
        "Flows": {
          "$ref": "#/$defs/Flows"
        }
      },
      "required": [
        "Type",
        "Flows"
      ]
    },
    "Flow.Try": {
      "type": "object",
      "properties": {
        "Type": {
          "type": "string",
          "enum": [
            "Try"
          ]
        },
        "Flows": {
          "type": "array",
          "items": {
            "anyOf": [
              {
                "$ref": "#/$defs/Flow.Use"
              },
              {
                "$ref": "#/$defs/Flow.If"
              },
              {
                "$ref": "#/$defs/Flow.Loop"
              },
              {
                "$ref": "#/$defs/Flow.Group"
              },
              {
                "$ref": "#/$defs/Flow.Try"
              },
              {
                "$ref": "#/$defs/Flow.Catch"
              },
              {
                "$ref": "#/$defs/Flow.Finally"
              },
              {
                "$ref": "#/$defs/Flow.ThrowException"
              },
              {
                "$ref": "#/$defs/Flow.Return"
              }
            ]
          }
        }
      },
      "required": [
        "Type",
        "Flows"
      ]
    },
    "Flow.Catch": {
      "type": "object",
      "properties": {
        "Type": {
          "type": "string",
          "enum": [
            "Catch"
          ]
        },
        "Expression": {
          "type": "string"
        },
        "Flows": {
          "$ref": "#/$defs/Flows"
        }
      },
      "required": [
        "Type",
        "Flows"
      ]
    },
    "Flow.Finally": {
      "type": "object",
      "properties": {
        "Type": {
          "type": "string",
          "enum": [
            "Finally"
          ]
        },
        "Flows": {
          "$ref": "#/$defs/Flows"
        }
      },
      "required": [
        "Type",
        "Flows"
      ]
    },
    "Flow.ThrowException": {
      "type": "object",
      "properties": {
        "Type": {
          "type": "string",
          "enum": [
            "ThrowException"
          ]
        },
        "Expression": {
          "type": "string"
        }
      },
      "required": [
        "Type",
        "Expression"
      ]
    },
    "Flow.Return": {
      "type": "object",
      "properties": {
        "Type": {
          "type": "string",
          "enum": [
            "Return"
          ]
        },
        "Expression": {
          "type": "string"
        }
      },
      "required": [
        "Type"
      ]
    },
    "Flow.Use.Expression": {
      "type": "string"
    }
  },
  "additionalProperties": {
    "$ref": "#/$defs/Namespace"
  }
}
