import { z } from 'zod';

export const approvalReminderPolicySchema = z.object({
  workflowId: z.string().min(1),
  stepNumber: z.number().int().min(1),
  slaHours: z.number().int().min(1),
  reminderOffsetsHours: z.array(z.number().int().min(1)).default([]),
  calendarMode: z.literal('calendar_days').default('calendar_days'),
  timeoutAction: z
    .enum(['none', 'auto_reject', 'auto_cancel', 'auto_escalate'])
    .default('none'),
  isActive: z.boolean().default(true)
});

export const approvalEscalationPolicySchema = z.object({
  workflowId: z.string().min(1),
  stepNumber: z.number().int().min(1),
  triggerAfterHours: z.number().int().min(1),
  targetType: z.enum([
    'manager',
    'requester',
    'explicit_user',
    'role',
    'permission_group'
  ]),
  targetValue: z.string().trim().optional().nullable(),
  isActive: z.boolean().default(true)
});
