import { z } from 'zod';

// --- Access policy ---

export const upsertPolicySchema = z.object({
  documentPath: z.string().min(1).max(500),
  isDirectory: z.boolean().optional().default(false),
  allowedEditors: z.array(z.string().max(200)).min(1),
});

export type UpsertPolicyInput = z.infer<typeof upsertPolicySchema>;

// --- Share link ---

export const createShareLinkSchema = z.object({
  documentPath: z.string().min(1).max(500),
  canEdit: z.boolean().optional().default(true),
  expiresInHours: z.number().int().positive().max(720).optional(), // max 30 days
  maxUses: z.number().int().positive().max(1000).optional(),
  guestName: z.string().max(200).optional(),
});

export type CreateShareLinkInput = z.infer<typeof createShareLinkSchema>;
