import { z } from 'zod';

const VALID_ROLES = ['SUPER_ADMIN', 'INFLUENCE_ADMIN', 'MAP_ADMIN', 'USER', 'TEMP'] as const;
const VALID_LAYER_TYPES = ['SHIFTS', 'TICKETS', 'POLLS', 'PUBLIC_EVENTS'] as const;

export const createAdminViewSchema = z.object({
  name: z.string().min(1).max(100),
  description: z.string().optional(),
  autoIncludeRoles: z.array(z.enum(VALID_ROLES)).min(1),
  includedLayerTypes: z.array(z.enum(VALID_LAYER_TYPES)).min(1),
});

export const updateAdminViewSchema = z.object({
  name: z.string().min(1).max(100).optional(),
  description: z.string().nullable().optional(),
  autoIncludeRoles: z.array(z.enum(VALID_ROLES)).min(1).optional(),
  includedLayerTypes: z.array(z.enum(VALID_LAYER_TYPES)).min(1).optional(),
});

export type CreateAdminViewInput = z.infer<typeof createAdminViewSchema>;
export type UpdateAdminViewInput = z.infer<typeof updateAdminViewSchema>;
