import * as z from 'zod';

export const courseSchema = z.object({
  courseCode: z.string().trim().max(50, 'Course code must be 50 characters or less').optional(),
  name: z.string().min(2, 'Course name must be at least 2 characters.'),
  category: z.string().min(1, 'Please select a category'),
  organizer: z.string().trim().optional(),
  standardHours: z.number().min(0, 'Standard hours must be 0 or greater'),
  certificateValidityMonths: z.number().int().min(0).optional(),
  isRequired: z.boolean(),
  trainingCost: z.number().min(0, 'Training cost must be 0 or greater').optional(),
  description: z.string().trim().optional(),
  isActive: z.boolean()
});

export type CourseFormValues = {
  courseCode?: string;
  name: string;
  category: string;
  organizer?: string;
  standardHours: number | undefined;
  certificateValidityMonths?: number | undefined;
  isRequired: boolean;
  trainingCost?: number | undefined;
  description?: string;
  isActive: boolean;
};
