import { z } from "zod";
import { TriggerInboxPropertySchema, LeaseSecondsPropertySchema, LeaseLimitPropertySchema, } from "../../../types/properties";
import { TriggerInboxStatusSchema, TriggerInboxPausedReasonSchema, } from "../../../schemas/TriggerInbox";
import { LeasedTriggerMessageItemSchema, } from "../../../schemas/TriggerMessage";
export const LeaseTriggerInboxMessagesSchema = z
    .object({
    inbox: TriggerInboxPropertySchema,
    leaseLimit: LeaseLimitPropertySchema.optional(),
    leaseSeconds: LeaseSecondsPropertySchema.optional(),
    signal: z
        .custom((v) => v instanceof AbortSignal)
        .optional()
        .describe("Abort signal forwarded to the lease HTTP request. Aborting causes the in-flight request to reject with AbortError."),
})
    .describe("Lease up to N messages from a trigger inbox. Returns messages plus a lease ID; ack within the lease window to remove from the inbox.");
const InboxAttributesSchema = z.object({
    status: TriggerInboxStatusSchema,
    paused_reason: TriggerInboxPausedReasonSchema.nullable(),
});
export const LeaseTriggerInboxMessagesItemSchema = z.object({
    lease_id: z.string().nullable(),
    leased_until: z.string().nullable(),
    results: z.array(LeasedTriggerMessageItemSchema),
    inbox_attributes: InboxAttributesSchema,
});
