import { z } from 'zod';
import { EncounterResultSchema } from './encounter';
import { MissionSchema } from './mission';
import { SurvivorSchema } from './survivor';

export const MissionStateResponseSchema = z
  .object({
    mission: MissionSchema,
    survivors: z.array(SurvivorSchema),
    recentLog: z.array(EncounterResultSchema).max(20),
  })
  .nullable();
export type MissionStateResponse = z.infer<typeof MissionStateResponseSchema>;

export const StartMissionRequestSchema = z.object({
  difficulty: z.number().int().min(1).max(3),
  durationMinutes: z.union([z.literal(10), z.literal(20), z.literal(30)]),
  characterName: z.string().min(1).max(32).optional(),
});
export type StartMissionRequest = z.infer<typeof StartMissionRequestSchema>;

export const ChoosePerkRequestSchema = z.object({
  perkKey: z.string().min(1),
});
export type ChoosePerkRequest = z.infer<typeof ChoosePerkRequestSchema>;
