import { z } from 'zod';

const folderName = z
  .string()
  .min(1, 'Folder name is required')
  .max(200, 'Folder name cannot exceed 200 characters')
  .refine((s) => s.trim().length > 0, 'Folder name cannot be only whitespace');

export const createFolderSchema = z.object({
  name: folderName,
  parentId: z.string().nullable(),
});
export type CreateFolderInput = z.infer<typeof createFolderSchema>;

export const renameFolderSchema = z.object({
  name: folderName,
});
export type RenameFolderInput = z.infer<typeof renameFolderSchema>;

export const moveFolderSchema = z.object({
  parentId: z.string().nullable(),
});
export type MoveFolderInput = z.infer<typeof moveFolderSchema>;

export const moveDocumentToFolderSchema = z.object({
  folderId: z.string().nullable(),
});
export type MoveDocumentToFolderInput = z.infer<typeof moveDocumentToFolderSchema>;
