import { z } from "zod";
import type { LeasedTriggerMessageItem } from "../../../schemas/TriggerMessage";
import { ZapierSignal } from "../../../types/signals";
/**
 * Signal an `onMessage` callback can throw to release the current
 * message back to the inbox immediately (status returns to
 * `available`) rather than leaving it leased until the lease
 * timeout. The actual release call is deferred to the end of the
 * drain so the same drain doesn't immediately re-lease it.
 *
 * Always triggers release regardless of `releaseOnError`.
 */
export declare class ZapierReleaseTriggerMessageSignal extends ZapierSignal {
    readonly name = "ZapierReleaseTriggerMessageSignal";
    readonly code: "ZAPIER_RELEASE_TRIGGER_MESSAGE_SIGNAL";
}
/**
 * Signal an `onMessage` callback can throw to stop the drain after
 * the current batch — no further leases, no further callbacks. The
 * triggering message gets the same release-or-leave treatment as any
 * thrown error (per `releaseOnError`). Other in-flight messages in
 * the same batch finish normally before the command returns.
 * Already-leased-but-not-yet-started messages are released so
 * they're available for re-lease.
 */
export declare class ZapierAbortDrainSignal extends ZapierSignal {
    readonly name = "ZapierAbortDrainSignal";
    readonly code: "ZAPIER_ABORT_DRAIN_SIGNAL";
}
/**
 * Per-message handler. Resolves to ack the message; rejects to
 * release-or-leave per `releaseOnError`. Throw a
 * `ZapierReleaseTriggerMessageSignal` for explicit release; throw a
 * `ZapierAbortDrainSignal` to stop the drain after the current
 * batch.
 */
export type DrainTriggerInboxCallback = (message: LeasedTriggerMessageItem) => void | Promise<void>;
/**
 * Per-message error observer for `continueOnError: true` mode.
 * Called with the failure reason and the message; signals
 * (`ZapierSignal` subclasses) are filtered out — they're
 * control-flow throws, not failures to observe. Synchronous from
 * the loop's perspective; throwing from `onError` is swallowed,
 * since it's an observer not a flow controller.
 */
export type DrainTriggerInboxErrorObserver = (error: unknown, message: LeasedTriggerMessageItem) => void | Promise<void>;
export declare const DrainTriggerInboxSchema: z.ZodObject<{
    inbox: z.ZodString & {
        _def: z.core.$ZodStringDef & import("../../..").PositionalMetadata;
    };
    onMessage: z.ZodOptional<z.ZodFunction<z.core.$ZodFunctionArgs, z.core.$ZodFunctionOut>>;
    concurrency: z.ZodOptional<z.ZodNumber>;
    leaseLimit: z.ZodOptional<z.ZodNumber>;
    leaseSeconds: z.ZodOptional<z.ZodNumber>;
    releaseOnError: z.ZodOptional<z.ZodBoolean>;
    continueOnError: z.ZodOptional<z.ZodBoolean>;
    onError: z.ZodOptional<z.ZodFunction<z.core.$ZodFunctionArgs, z.core.$ZodFunctionOut>>;
    signal: z.ZodOptional<z.ZodCustom<AbortSignal, AbortSignal>>;
    maxMessages: z.ZodOptional<z.ZodNumber>;
}, z.core.$strip>;
export declare const WatchTriggerInboxSchema: z.ZodObject<{
    inbox: z.ZodString & {
        _def: z.core.$ZodStringDef & import("../../..").PositionalMetadata;
    };
    onMessage: z.ZodOptional<z.ZodFunction<z.core.$ZodFunctionArgs, z.core.$ZodFunctionOut>>;
    concurrency: z.ZodOptional<z.ZodNumber>;
    leaseLimit: z.ZodOptional<z.ZodNumber>;
    leaseSeconds: z.ZodOptional<z.ZodNumber>;
    releaseOnError: z.ZodOptional<z.ZodBoolean>;
    continueOnError: z.ZodOptional<z.ZodBoolean>;
    onError: z.ZodOptional<z.ZodFunction<z.core.$ZodFunctionArgs, z.core.$ZodFunctionOut>>;
    signal: z.ZodOptional<z.ZodCustom<AbortSignal, AbortSignal>>;
    maxDrainIntervalSeconds: z.ZodOptional<z.ZodNumber>;
}, z.core.$strip>;
/**
 * Fields shared by both `drainTriggerInbox` and `watchTriggerInbox`.
 * `onMessage` is required at the type level; runtime validation in
 * the handler covers JS callers who bypass TS.
 */
interface TriggerInboxCommandSharedFields {
    inbox: string;
    onMessage: DrainTriggerInboxCallback;
    concurrency?: number;
    leaseLimit?: number;
    leaseSeconds?: number;
    releaseOnError?: boolean;
    continueOnError?: boolean;
    onError?: DrainTriggerInboxErrorObserver;
    signal?: AbortSignal;
}
/**
 * Hand-typed options for `drainTriggerInbox`. The Zod schema above is
 * for docs and registry; this type is what the SDK function accepts,
 * with `onMessage` / `onError` typed as proper callbacks instead of
 * opaque `z.function()`.
 */
export type DrainTriggerInboxOptions = TriggerInboxCommandSharedFields & {
    maxMessages?: number;
};
export type WatchTriggerInboxOptions = TriggerInboxCommandSharedFields & {
    maxDrainIntervalSeconds?: number;
};
export type { LeasedTriggerMessageItem };
//# sourceMappingURL=schemas.d.ts.map