44 lines
1.5 KiB
TypeScript
44 lines
1.5 KiB
TypeScript
|
|
import { z } from "zod";
|
||
|
|
|
||
|
|
// Create Appointment Schema
|
||
|
|
export const createAppointmentSchema = z.object({
|
||
|
|
first_name: z.string().min(1, "First name is required"),
|
||
|
|
last_name: z.string().min(1, "Last name is required"),
|
||
|
|
email: z.string().email("Invalid email address"),
|
||
|
|
preferred_dates: z
|
||
|
|
.array(z.string().regex(/^\d{4}-\d{2}-\d{2}$/, "Date must be in YYYY-MM-DD format"))
|
||
|
|
.min(1, "At least one preferred date is required"),
|
||
|
|
preferred_time_slots: z
|
||
|
|
.array(z.enum(["morning", "afternoon", "evening"]))
|
||
|
|
.min(1, "At least one preferred time slot is required"),
|
||
|
|
phone: z.string().optional(),
|
||
|
|
reason: z.string().optional(),
|
||
|
|
});
|
||
|
|
|
||
|
|
export type CreateAppointmentInput = z.infer<typeof createAppointmentSchema>;
|
||
|
|
|
||
|
|
// Schedule Appointment Schema (Admin only)
|
||
|
|
export const scheduleAppointmentSchema = z.object({
|
||
|
|
scheduled_datetime: z.string().datetime("Invalid datetime format"),
|
||
|
|
scheduled_duration: z.number().int().positive().optional(),
|
||
|
|
});
|
||
|
|
|
||
|
|
export type ScheduleAppointmentInput = z.infer<typeof scheduleAppointmentSchema>;
|
||
|
|
|
||
|
|
// Reject Appointment Schema (Admin only)
|
||
|
|
export const rejectAppointmentSchema = z.object({
|
||
|
|
rejection_reason: z.string().optional(),
|
||
|
|
});
|
||
|
|
|
||
|
|
export type RejectAppointmentInput = z.infer<typeof rejectAppointmentSchema>;
|
||
|
|
|
||
|
|
// Update Admin Availability Schema
|
||
|
|
export const updateAvailabilitySchema = z.object({
|
||
|
|
available_days: z
|
||
|
|
.array(z.number().int().min(0).max(6))
|
||
|
|
.min(1, "At least one day must be selected"),
|
||
|
|
});
|
||
|
|
|
||
|
|
export type UpdateAvailabilityInput = z.infer<typeof updateAvailabilitySchema>;
|
||
|
|
|