/**
 * Appointment Type Validators
 * Zod schemas for validating appointment type CRUD operations
 */

import { z } from 'zod';

export const CreateAppointmentTypeSchema = z.object({
  nameEn: z.string().min(1, 'English name is required').max(200),
  nameAr: z.string().max(200).optional().default(''),
  duration: z.number().int().min(5).max(480).default(30),
  price: z.number().min(0).optional().nullable(),
});

export const UpdateAppointmentTypeSchema = z.object({
  nameEn: z.string().min(1).max(200).optional(),
  nameAr: z.string().min(1).max(200).optional(),
  duration: z.number().int().min(5).max(480).optional(),
  price: z.number().min(0).optional().nullable(),
  isActive: z.boolean().optional(),
  sortOrder: z.number().int().min(0).optional(),
});

export const ReorderAppointmentTypesSchema = z.object({
  order: z.array(
    z.object({
      id: z.string().min(1),
      sortOrder: z.number().int().min(0),
    })
  ).min(1).max(200),
});

export const ImportAppointmentTypesSchema = z.object({
  types: z.array(CreateAppointmentTypeSchema).min(1).max(100),
});

export type CreateAppointmentTypeInput = z.infer<typeof CreateAppointmentTypeSchema>;
export type UpdateAppointmentTypeInput = z.infer<typeof UpdateAppointmentTypeSchema>;
export type ReorderAppointmentTypesInput = z.infer<typeof ReorderAppointmentTypesSchema>;
export type ImportAppointmentTypesInput = z.infer<typeof ImportAppointmentTypesSchema>;
