{"components":{"schemas":{"Appointment":{"properties":{"cancellation_reason":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Cancellation Reason"},"cancelled_at":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}],"title":"Cancelled At"},"created_at":{"format":"date-time","title":"Created At","type":"string"},"doctor_id":{"format":"uuid","title":"Doctor Id","type":"string"},"ends_at":{"format":"date-time","title":"Ends At","type":"string"},"id":{"format":"uuid","title":"Id","type":"string"},"patient_id":{"format":"uuid","title":"Patient Id","type":"string"},"starts_at":{"format":"date-time","title":"Starts At","type":"string"},"status":{"enum":["booked","cancelled"],"title":"Status","type":"string"},"updated_at":{"format":"date-time","title":"Updated At","type":"string"}},"required":["id","doctor_id","patient_id","starts_at","ends_at","status","cancellation_reason","cancelled_at","created_at","updated_at"],"title":"Appointment","type":"object"},"AppointmentCreate":{"additionalProperties":false,"properties":{"doctor_id":{"format":"uuid","title":"Doctor Id","type":"string"},"patient_id":{"format":"uuid","title":"Patient Id","type":"string"},"starts_at":{"format":"date-time","title":"Starts At","type":"string"}},"required":["doctor_id","patient_id","starts_at"],"title":"AppointmentCreate","type":"object"},"AppointmentWithDoctor":{"properties":{"cancellation_reason":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Cancellation Reason"},"cancelled_at":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}],"title":"Cancelled At"},"created_at":{"format":"date-time","title":"Created At","type":"string"},"doctor":{"$ref":"#/components/schemas/DoctorRef"},"doctor_id":{"format":"uuid","title":"Doctor Id","type":"string"},"ends_at":{"format":"date-time","title":"Ends At","type":"string"},"id":{"format":"uuid","title":"Id","type":"string"},"patient_id":{"format":"uuid","title":"Patient Id","type":"string"},"starts_at":{"format":"date-time","title":"Starts At","type":"string"},"status":{"enum":["booked","cancelled"],"title":"Status","type":"string"},"updated_at":{"format":"date-time","title":"Updated At","type":"string"}},"required":["id","doctor_id","patient_id","starts_at","ends_at","status","cancellation_reason","cancelled_at","created_at","updated_at","doctor"],"title":"AppointmentWithDoctor","type":"object"},"Availability":{"properties":{"date":{"title":"Date","type":"string"},"doctor_id":{"format":"uuid","title":"Doctor Id","type":"string"},"slot_minutes":{"const":30,"default":30,"title":"Slot Minutes","type":"integer"},"slots":{"items":{"$ref":"#/components/schemas/Slot"},"title":"Slots","type":"array"},"timezone":{"title":"Timezone","type":"string"}},"required":["doctor_id","date","timezone","slots"],"title":"Availability","type":"object"},"CancelRequest":{"additionalProperties":false,"properties":{"reason":{"maxLength":500,"minLength":3,"title":"Reason","type":"string"}},"required":["reason"],"title":"CancelRequest","type":"object"},"Clinic":{"properties":{"id":{"format":"uuid","title":"Id","type":"string"},"name":{"title":"Name","type":"string"},"timezone":{"title":"Timezone","type":"string"}},"required":["id","name","timezone"],"title":"Clinic","type":"object"},"Doctor":{"properties":{"clinic":{"$ref":"#/components/schemas/Clinic"},"full_name":{"title":"Full Name","type":"string"},"id":{"format":"uuid","title":"Id","type":"string"},"specialty":{"title":"Specialty","type":"string"},"working_hours":{"items":{"$ref":"#/components/schemas/WorkingWindow"},"title":"Working Hours","type":"array"}},"required":["id","full_name","specialty","clinic","working_hours"],"title":"Doctor","type":"object"},"DoctorList":{"properties":{"items":{"items":{"$ref":"#/components/schemas/Doctor"},"title":"Items","type":"array"}},"required":["items"],"title":"DoctorList","type":"object"},"DoctorRef":{"properties":{"full_name":{"title":"Full Name","type":"string"},"id":{"format":"uuid","title":"Id","type":"string"},"specialty":{"title":"Specialty","type":"string"}},"required":["id","full_name","specialty"],"title":"DoctorRef","type":"object"},"ErrorItem":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"title":"Loc","type":"array"},"msg":{"title":"Msg","type":"string"},"type":{"title":"Type","type":"string"}},"required":["loc","msg","type"],"title":"ErrorItem","type":"object"},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"title":"Detail","type":"array"}},"title":"HTTPValidationError","type":"object"},"Health":{"properties":{"status":{"const":"ok","title":"Status","type":"string"}},"required":["status"],"title":"Health","type":"object"},"Patient":{"properties":{"created_at":{"format":"date-time","title":"Created At","type":"string"},"email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Email"},"full_name":{"title":"Full Name","type":"string"},"id":{"format":"uuid","title":"Id","type":"string"},"phone":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Phone"}},"required":["id","full_name","phone","email","created_at"],"title":"Patient","type":"object"},"PatientAppointments":{"properties":{"items":{"items":{"$ref":"#/components/schemas/AppointmentWithDoctor"},"title":"Items","type":"array"},"next_cursor":{"title":"Next Cursor","type":"null"}},"required":["items"],"title":"PatientAppointments","type":"object"},"PatientCreate":{"additionalProperties":false,"properties":{"email":{"anyOf":[{"format":"email","type":"string"},{"type":"null"}],"title":"Email"},"full_name":{"maxLength":200,"minLength":2,"title":"Full Name","type":"string"},"phone":{"anyOf":[{"pattern":"^\\+[1-9][0-9]{7,14}$","type":"string"},{"type":"null"}],"title":"Phone"}},"required":["full_name"],"title":"PatientCreate","type":"object"},"Problem":{"properties":{"code":{"$ref":"#/components/schemas/ProblemCode"},"detail":{"title":"Detail","type":"string"},"errors":{"anyOf":[{"items":{"$ref":"#/components/schemas/ErrorItem"},"type":"array"},{"type":"null"}],"title":"Errors"},"instance":{"title":"Instance","type":"string"},"request_id":{"format":"uuid","title":"Request Id","type":"string"},"status":{"title":"Status","type":"integer"},"title":{"title":"Title","type":"string"},"type":{"title":"Type","type":"string"}},"required":["type","title","status","detail","instance","code","request_id"],"title":"Problem","type":"object"},"ProblemCode":{"enum":["VALIDATION_ERROR","TIMEZONE_REQUIRED","UNKNOWN_DOCTOR","UNKNOWN_PATIENT","SLOT_IN_PAST","BOOKING_TOO_SOON","DATE_OUT_OF_RANGE","SLOT_MISALIGNED","OUTSIDE_WORKING_HOURS","SLOT_TAKEN","PATIENT_DOUBLE_BOOKED","APPOINTMENT_ALREADY_CANCELLED","APPOINTMENT_ALREADY_STARTED","PATIENT_PHONE_EXISTS","CONCURRENT_UPDATE","DOCTOR_NOT_FOUND","PATIENT_NOT_FOUND","APPOINTMENT_NOT_FOUND","PROBLEM_NOT_FOUND","NOT_FOUND","METHOD_NOT_ALLOWED","DB_UNAVAILABLE","INTERNAL_ERROR"],"title":"ProblemCode","type":"string"},"ProblemEntry":{"properties":{"code":{"$ref":"#/components/schemas/ProblemCode"},"description":{"title":"Description","type":"string"},"slug":{"title":"Slug","type":"string"},"status":{"title":"Status","type":"integer"},"title":{"title":"Title","type":"string"}},"required":["code","slug","title","status","description"],"title":"ProblemEntry","type":"object"},"RescheduleRequest":{"additionalProperties":false,"properties":{"starts_at":{"format":"date-time","title":"Starts At","type":"string"}},"required":["starts_at"],"title":"RescheduleRequest","type":"object"},"Slot":{"properties":{"ends_at":{"format":"date-time","title":"Ends At","type":"string"},"starts_at":{"format":"date-time","title":"Starts At","type":"string"}},"required":["starts_at","ends_at"],"title":"Slot","type":"object"},"ValidationError":{"properties":{"ctx":{"title":"Context","type":"object"},"input":{"title":"Input"},"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"title":"Location","type":"array"},"msg":{"title":"Message","type":"string"},"type":{"title":"Error Type","type":"string"}},"required":["loc","msg","type"],"title":"ValidationError","type":"object"},"WorkingWindow":{"properties":{"end_time":{"title":"End Time","type":"string"},"start_time":{"title":"Start Time","type":"string"},"weekday":{"title":"Weekday","type":"integer"}},"required":["weekday","start_time","end_time"],"title":"WorkingWindow","type":"object"}}},"info":{"title":"Clinic Booking API","version":"1.0.0"},"openapi":"3.1.0","paths":{"/appointments":{"post":{"operationId":"create_appointment_appointments_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppointmentCreate"}}},"required":true},"responses":{"201":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Appointment"}}},"description":"Successful Response"},"409":{"content":{"application/problem+json":{}},"description":"Problem (RFC 9457)"},"422":{"content":{"application/problem+json":{}},"description":"Problem (RFC 9457)"},"503":{"content":{"application/problem+json":{}},"description":"Problem (RFC 9457)"}},"summary":"Create Appointment","tags":["appointments"]}},"/appointments/{appointment_id}":{"get":{"operationId":"get_appointment_appointments__appointment_id__get","parameters":[{"in":"path","name":"appointment_id","required":true,"schema":{"format":"uuid","title":"Appointment Id","type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Appointment"}}},"description":"Successful Response"},"404":{"content":{"application/problem+json":{}},"description":"Problem (RFC 9457)"},"422":{"content":{"application/problem+json":{}},"description":"Problem (RFC 9457)"}},"summary":"Get Appointment","tags":["appointments"]}},"/appointments/{appointment_id}/cancel":{"patch":{"operationId":"cancel_appointment_appointments__appointment_id__cancel_patch","parameters":[{"in":"path","name":"appointment_id","required":true,"schema":{"format":"uuid","title":"Appointment Id","type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CancelRequest"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Appointment"}}},"description":"Successful Response"},"404":{"content":{"application/problem+json":{}},"description":"Problem (RFC 9457)"},"409":{"content":{"application/problem+json":{}},"description":"Problem (RFC 9457)"},"422":{"content":{"application/problem+json":{}},"description":"Problem (RFC 9457)"}},"summary":"Cancel Appointment","tags":["appointments"]}},"/appointments/{appointment_id}/reschedule":{"patch":{"operationId":"reschedule_appointment_appointments__appointment_id__reschedule_patch","parameters":[{"in":"path","name":"appointment_id","required":true,"schema":{"format":"uuid","title":"Appointment Id","type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RescheduleRequest"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Appointment"}}},"description":"Successful Response"},"404":{"content":{"application/problem+json":{}},"description":"Problem (RFC 9457)"},"409":{"content":{"application/problem+json":{}},"description":"Problem (RFC 9457)"},"422":{"content":{"application/problem+json":{}},"description":"Problem (RFC 9457)"}},"summary":"Reschedule Appointment","tags":["appointments"]}},"/doctors":{"get":{"operationId":"list_doctors_doctors_get","responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DoctorList"}}},"description":"Successful Response"}},"summary":"List Doctors","tags":["doctors"]}},"/doctors/{doctor_id}":{"get":{"operationId":"get_doctor_doctors__doctor_id__get","parameters":[{"in":"path","name":"doctor_id","required":true,"schema":{"format":"uuid","title":"Doctor Id","type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Doctor"}}},"description":"Successful Response"},"404":{"content":{"application/problem+json":{}},"description":"Problem (RFC 9457)"},"422":{"content":{"application/problem+json":{}},"description":"Problem (RFC 9457)"}},"summary":"Get Doctor","tags":["doctors"]}},"/doctors/{doctor_id}/availability":{"get":{"operationId":"doctor_availability_doctors__doctor_id__availability_get","parameters":[{"in":"path","name":"doctor_id","required":true,"schema":{"format":"uuid","title":"Doctor Id","type":"string"}},{"in":"query","name":"date","required":true,"schema":{"format":"date","title":"Date","type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Availability"}}},"description":"Successful Response"},"404":{"content":{"application/problem+json":{}},"description":"Problem (RFC 9457)"},"422":{"content":{"application/problem+json":{}},"description":"Problem (RFC 9457)"}},"summary":"Doctor Availability","tags":["doctors"]}},"/health":{"get":{"description":"Liveness. Never touches the DB, so it never wakes Neon.","operationId":"health_health_get","responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Health"}}},"description":"Successful Response"}},"summary":"Health","tags":["health"]}},"/patients":{"post":{"operationId":"post_patient_patients_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PatientCreate"}}},"required":true},"responses":{"201":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Patient"}}},"description":"Successful Response"},"409":{"content":{"application/problem+json":{}},"description":"Problem (RFC 9457)"},"422":{"content":{"application/problem+json":{}},"description":"Problem (RFC 9457)"}},"summary":"Post Patient","tags":["patients"]}},"/patients/{patient_id}/appointments":{"get":{"operationId":"patient_appointments_patients__patient_id__appointments_get","parameters":[{"in":"path","name":"patient_id","required":true,"schema":{"format":"uuid","title":"Patient Id","type":"string"}},{"in":"query","name":"limit","required":false,"schema":{"default":50,"maximum":100,"minimum":1,"title":"Limit","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PatientAppointments"}}},"description":"Successful Response"},"404":{"content":{"application/problem+json":{}},"description":"Problem (RFC 9457)"},"422":{"content":{"application/problem+json":{}},"description":"Problem (RFC 9457)"}},"summary":"Patient Appointments","tags":["patients"]}},"/problems":{"get":{"operationId":"list_problems_problems_get","responses":{"200":{"content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/ProblemEntry"},"title":"Response List Problems Problems Get","type":"array"}}},"description":"Successful Response"}},"summary":"List Problems","tags":["problems"]}},"/problems/{slug}":{"get":{"operationId":"get_problem_problems__slug__get","parameters":[{"in":"path","name":"slug","required":true,"schema":{"title":"Slug","type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemEntry"}}},"description":"Successful Response"},"404":{"content":{"application/problem+json":{}},"description":"Problem (RFC 9457)"},"422":{"description":"Validation Error"}},"summary":"Get Problem","tags":["problems"]}},"/ready":{"get":{"description":"Readiness. A failed SELECT 1 propagates to the DB_UNAVAILABLE handler (503).","operationId":"ready_ready_get","responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Health"}}},"description":"Successful Response"},"503":{"content":{"application/problem+json":{}},"description":"Problem (RFC 9457)"}},"summary":"Ready","tags":["health"]}}},"servers":[{"url":"/api"}]}