// Context API: ctx.step("name", || async { ... }), ctx.sleep(duration), ctx.wait_for_event(...).
// Step names are cache keys. Renaming breaks resume — bump the workflow version instead.
use forge::prelude::*;
#[forge::workflow(version = "v1", active, timeout = "1h")]
pub async fn {{name}}(ctx: &WorkflowContext, input: serde_json::Value) -> Result<serde_json::Value> {
let stage1 = ctx
.step("stage_one", || async {
// TODO: real work
Ok::<_, ForgeError>(serde_json::json!({ "stage": 1 }))
})
.run()
.await?
.expect("required step always returns Some");
Ok(serde_json::json!({ "input": input, "stage1": stage1 }))
}