// 1. Create a schedule for a practitioner
const { data: schedule } = await clinik.schedules.create({
actorIds: ['Practitioner/dr_jones'],
serviceType: ['Cardiology Consultation'],
specialty: ['Cardiology'],
planningHorizon: {
start: '2025-04-01T00:00:00Z',
end: '2025-04-30T23:59:59Z',
},
});
// 2. Create slots on that schedule
for (let day = 1; day <= 30; day++) {
const date = `2025-04-${String(day).padStart(2, '0')}`;
for (let hour = 9; hour < 17; hour++) {
await clinik.slots.create({
scheduleId: schedule.id,
status: 'free',
start: `${date}T${String(hour).padStart(2, '0')}:00:00Z`,
end: `${date}T${String(hour).padStart(2, '0')}:30:00Z`,
});
}
}
// 3. When a patient books, create an appointment and mark the slot busy