/**
 * Action event type definitions — state machine constants and environment interface.
 *
 * @module
 */
import { z } from 'zod';
export const ActionExecutor = z.enum(['frontend', 'backend']);
export const ActionEventStep = z.enum(['initial', 'parsed', 'handling', 'handled', 'failed']);
// The constants below use `Record<K, V> = {...}` rather than
// `as const satisfies Record<K, V>`. The typed annotation gives full
// completeness checking (TS rejects missing keys, excess keys, and wrong
// value types on the object literal) without narrowing lookups to literal
// tuple types — a `satisfies` shape forces every `X[k]` reader to widen
// back to `ReadonlyArray<V>` themselves to call `.includes(...)`.
export const action_event_step_transitions = {
    initial: ['parsed', 'failed'],
    parsed: ['handling', 'failed'],
    handling: ['handled', 'failed'],
    handled: [],
    failed: [],
};
export const action_event_phase_by_kind = {
    request_response: [
        'send_request',
        'receive_request',
        'send_response',
        'receive_response',
        'send_error',
        'receive_error',
    ],
    remote_notification: ['send', 'receive'],
    local_call: ['execute'],
};
export const action_event_phase_transitions = {
    send_request: 'receive_response',
    receive_request: 'send_response',
    send_response: null,
    receive_response: null,
    send_error: null,
    receive_error: null,
    send: null,
    receive: null,
    execute: null,
};
