{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "title": "Workflow Schema",
  "description": "Schema definition for a Workflow file.",
  "type": "object",
  "required": [
    "name",
    "steps"
  ],
  "properties": {
    "name": {
      "type": "string",
      "description": "A short, human-readable name for the workflow."
    },
    "description": {
      "type": "string",
      "description": "A concise description of what the workflow accomplishes."
    },
    "inputs": {
      "type": "array",
      "description": "A list of global inputs that the workflow requires.",
      "items": {
        "type": "object",
        "required": [
          "name"
        ],
        "properties": {
          "name": {
            "type": "string",
            "description": "The name of the input variable."
          },
          "description": {
            "type": "string",
            "description": "A description of what this input represents."
          }
        }
      }
    },
    "steps": {
      "type": "array",
      "description": "An ordered list of prompt execution steps that make up the workflow.",
      "items": {
        "type": "object",
        "required": [
          "step_id",
          "prompt_file",
          "map_inputs"
        ],
        "properties": {
          "step_id": {
            "type": "string",
            "description": "A unique identifier for the step within the workflow."
          },
          "prompt_file": {
            "type": "string",
            "description": "The path to the .prompt.yaml file to be executed in this step."
          },
          "map_inputs": {
            "type": "object",
            "description": "An object that maps the variables required by the prompt to their data sources.",
            "additionalProperties": {
              "type": "string"
            }
          }
        }
      }
    }
  }
}
