import { z } from 'zod';

export const createSavedViewSchema = z.object({
  entityType: z.string().min(1),
  name: z.string().min(1),
  filters: z.record(z.string(), z.unknown()).default({}),
  sortConfig: z
    .object({
      field: z.string(),
      direction: z.enum(['asc', 'desc']),
    })
    .optional(),
  columnConfig: z.record(z.string(), z.unknown()).optional(),
  isShared: z.boolean().optional().default(false),
  isDefault: z.boolean().optional().default(false),
});

export const updateSavedViewSchema = createSavedViewSchema.partial();

export type CreateSavedViewInput = z.infer<typeof createSavedViewSchema>;
export type UpdateSavedViewInput = z.infer<typeof updateSavedViewSchema>;
