// Slice 33: `on` handlers attach to pa actions too.
//
// Before: `on <status> <target>` required `<target>` to be a named scope.
// Now: any `pa <name>` is also a valid handler target without any opt-in
// syntax -- pa actions always carry a user-written name that becomes the
// PA action key.
//
// That closes a natural gap in the stub-and-fix workflow: the most common
// "action that can fail" in pax is a connector call (HTTP, SharePoint,
// Outlook), and those live in pa/<Name>.json files. Handlers attach by name.


var outcome: string = ""

// Opaque PA action: the body lives in pa/HTTP_Get_Order.json next to this
// source file. paxc reads it at compile time and drops it verbatim into
// the emitted flow.
pa HTTP_Get_Order

// Single-status handler on the raw block. Runs only if the HTTP call fails.
on failed HTTP_Get_Order {
    outcome = "http-failed"
}

// Multi-status handlers work the same on raw targets as on scope targets.
on skipped or timedout HTTP_Get_Order {
    outcome = "http-skipped-or-slow"
}

// A handler including `succeeded` fires on the paxr happy path, so paxr
// will set outcome to "http-ok" in the end-of-run state dump.
on succeeded HTTP_Get_Order {
    outcome = "http-ok"
}

debug(outcome)
