/**
 * src/cron/types.ts
 * Cron Job Types — Persistent scheduled tasks
 */
import { z } from 'zod';
export const cronJobSchema = z.object({
    id: z.string().uuid(),
    tenant_id: z.string().uuid(),
    name: z.string().min(1).max(200),
    schedule: z.string(), // Cron expression: "0 9 * * 1"
    timezone: z.string().default('Asia/Riyadh'),
    payload: z.object({
        kind: z.enum(['systemEvent', 'agentTurn']),
        text: z.string().optional(),
        message: z.string().optional(),
        model: z.string().optional(),
        timeoutSeconds: z.number().optional(),
        /** Set on agentTurn payloads created mid-conversation to track
         * indirect-recursion depth across cron-fed turns. (Audit C5.) */
        recursionDepth: z.number().optional(),
        /** Set on schedule_followup one-shot followups so the runner can
         * disable the row after firing once. */
        oneShot: z.boolean().optional(),
        /** customerId for schedule_followup payloads. */
        customerId: z.string().optional(),
    }),
    delivery: z.object({
        mode: z.enum(['none', 'announce', 'webhook']),
        channel: z.string().optional(),
        to: z.string().optional(),
        bestEffort: z.boolean().optional(),
    }).optional(),
    enabled: z.boolean().default(true),
    lastRunAt: z.string().nullable(),
    nextRunAt: z.string(),
    runCount: z.number().default(0),
    created_at: z.string(),
    updated_at: z.string(),
});
export const cronExecutionSchema = z.object({
    id: z.string().uuid(),
    job_id: z.string().uuid(),
    tenant_id: z.string().uuid(),
    executed_at: z.string(),
    success: z.boolean(),
    output: z.string().nullable(),
    error: z.string().nullable(),
    duration_ms: z.number(),
});
//# sourceMappingURL=types.js.map