import { z } from 'zod';

export const createKnowledgeBaseSchema = z.object({
  branch_id: z.string().uuid().optional(),
  type: z.enum(['doc', 'url', 'qa', 'article']).optional(),
  title: z.string().min(1, 'Title is required'),
  content: z.string().optional(),
  url: z.string().url().optional().or(z.literal('')),
  question: z.string().optional(),
  answer: z.string().optional(),
  file_size: z.string().optional(),
  file_type: z.string().optional(),
  pages: z.number().int().positive().optional(),
  status: z.string().optional(),
  is_active: z.boolean().optional(),
});

export const updateKnowledgeBaseSchema = z.object({
  title: z.string().min(1).optional(),
  content: z.string().optional(),
  url: z.string().url().optional().or(z.literal('')),
  question: z.string().optional(),
  answer: z.string().optional(),
  is_active: z.boolean().optional(),
  status: z.string().optional(),
});

export type CreateKnowledgeBaseInput = z.infer<typeof createKnowledgeBaseSchema>;
export type UpdateKnowledgeBaseInput = z.infer<typeof updateKnowledgeBaseSchema>;
