import { z } from "zod";

export const createKnowledgePointSchema = z.object({
  chapterId: z.string().min(1).max(32),
  title: z.string().min(1).max(255),
  description: z.string().optional(),
  difficulty: z.number().int().min(1).max(5).optional().default(3),
  metadata: z.record(z.unknown()).nullish(),
});

export const updateKnowledgePointSchema = z.object({
  title: z.string().min(1).max(255).optional(),
  description: z.string().optional(),
  difficulty: z.number().int().min(1).max(5).optional(),
  metadata: z.record(z.unknown()).nullish(),
});

export const addPrerequisiteSchema = z.object({
  prerequisiteId: z.string().min(1).max(32),
});

export type CreateKnowledgePointDto = z.infer<
  typeof createKnowledgePointSchema
>;
export type UpdateKnowledgePointDto = z.infer<
  typeof updateKnowledgePointSchema
>;
export type AddPrerequisiteDto = z.infer<typeof addPrerequisiteSchema>;
