{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/vmotif-com/json-schema/vmotif-com-workflow-run-schema.json",
  "title": "WorkflowRun",
  "x-generated": "2026-11-28",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/vmotif-com-openapi.yml#/components/schemas/WorkflowRun",
  "type": "object",
  "required": [
    "id",
    "workflowId",
    "status",
    "progress",
    "results",
    "error",
    "createdAt",
    "completedAt"
  ],
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid"
    },
    "workflowId": {
      "type": "string",
      "format": "uuid"
    },
    "status": {
      "type": "string",
      "enum": [
        "pending",
        "running",
        "completed",
        "failed"
      ]
    },
    "progress": {
      "type": "object",
      "required": [
        "total",
        "completed"
      ],
      "properties": {
        "total": {
          "type": "integer"
        },
        "completed": {
          "type": "integer"
        }
      }
    },
    "results": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/WorkflowRunResult"
      }
    },
    "error": {
      "type": [
        "string",
        "null"
      ]
    },
    "createdAt": {
      "type": "string",
      "format": "date-time"
    },
    "completedAt": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    }
  },
  "$defs": {
    "WorkflowRunResult": {
      "type": "object",
      "required": [
        "promptNodeId",
        "outputNodeId",
        "type",
        "status"
      ],
      "properties": {
        "promptNodeId": {
          "type": "string"
        },
        "outputNodeId": {
          "type": "string"
        },
        "type": {
          "type": "string",
          "enum": [
            "image",
            "code",
            "screen",
            "design"
          ]
        },
        "status": {
          "type": "string",
          "enum": [
            "completed",
            "failed",
            "skipped"
          ]
        },
        "label": {
          "type": "string",
          "description": "Output node's user-facing label/title (e.g. \"LinkedIn Post Copy\"), when set."
        },
        "platform": {
          "type": "string",
          "enum": [
            "x",
            "linkedin",
            "instagram",
            "facebook",
            "threads",
            "tiktok"
          ],
          "description": "Target platform, present on outputs created by a social_post campaign."
        },
        "url": {
          "type": "string",
          "description": "Signed URL (image outputs)."
        },
        "mediaType": {
          "type": "string",
          "description": "Image outputs."
        },
        "code": {
          "type": "string",
          "description": "Code/screen/design outputs."
        },
        "error": {
          "type": "string",
          "description": "Set when `status` is `failed`."
        },
        "costMicros": {
          "type": "number"
        }
      }
    }
  }
}