/** * NexHealth Integration for WORKWAY * * Modern healthcare scheduling and patient engagement platform. * Designed for dental and medical practice automation - patient scheduling, * forms, reminders, and online booking. * * Zuhandenheit: "Appointments that confirm themselves" not "POST /appointments endpoint" * * @example * ```typescript * import { NexHealth } from '@workwayco/integrations/nexhealth'; * * const nexhealth = new NexHealth({ * apiKey: env.NEXHEALTH_API_KEY, * subdomain: 'your-practice', * }); * * // Get today's appointments * const appointments = await nexhealth.getTodaysAppointments(); * * // Get patients needing reactivation (no visit in 6+ months) * const inactive = await nexhealth.getInactivePatients({ monthsInactive: 6 }); * * // Send appointment reminder * await nexhealth.sendAppointmentReminder(appointmentId); * ``` */ import { ActionResult } from '@workwayco/sdk'; import { BaseAPIClient } from '../core/index.js'; /** * NexHealth integration configuration */ export interface NexHealthConfig { /** API key (Bearer token) */ apiKey: string; /** Practice subdomain */ subdomain: string; /** Location ID (required for most operations) */ locationId?: string; /** Optional: Override API endpoint (for testing) */ apiUrl?: string; /** Request timeout in milliseconds (default: 30000) */ timeout?: number; } /** * NexHealth Patient */ export interface NHPatient { id: number; first_name: string; last_name: string; name: string; email?: string; phone?: string; cell_phone?: string; date_of_birth?: string; gender?: string; address?: NHAddress; inactive: boolean; balance?: number; insurance_id?: string; last_appointment_date?: string; next_appointment_date?: string; created_at: string; updated_at: string; foreign_id?: string; foreign_id_type?: string; } /** * NexHealth Address */ export interface NHAddress { line1?: string; line2?: string; city?: string; state?: string; zip?: string; country?: string; } /** * NexHealth Appointment */ export interface NHAppointment { id: number; patient_id: number; patient?: NHPatient; provider_id: number; provider?: NHProvider; location_id: number; operatory_id?: number; appointment_type_id?: number; appointment_type?: NHAppointmentType; start_time: string; end_time: string; duration: number; status: NHAppointmentStatus; confirmed: boolean; confirmation_status?: 'unconfirmed' | 'confirmed' | 'attempted'; notes?: string; created_at: string; updated_at: string; foreign_id?: string; } /** * NexHealth Appointment Status */ export type NHAppointmentStatus = 'pending' | 'confirmed' | 'checked_in' | 'in_progress' | 'completed' | 'cancelled' | 'no_show' | 'rescheduled'; /** * NexHealth Provider (Doctor/Hygienist) */ export interface NHProvider { id: number; first_name: string; last_name: string; name: string; email?: string; npi?: string; specialty?: string; active: boolean; foreign_id?: string; } /** * NexHealth Appointment Type */ export interface NHAppointmentType { id: number; name: string; duration: number; color?: string; description?: string; active: boolean; bookable_online: boolean; } /** * NexHealth Location */ export interface NHLocation { id: number; name: string; phone?: string; email?: string; address?: NHAddress; timezone: string; active: boolean; } /** * NexHealth Available Slot */ export interface NHAvailableSlot { time: string; provider_id: number; provider?: NHProvider; operatory_id?: number; duration: number; } /** * NexHealth Form */ export interface NHForm { id: number; name: string; description?: string; active: boolean; created_at: string; } /** * NexHealth Form Submission */ export interface NHFormSubmission { id: number; form_id: number; patient_id: number; status: 'pending' | 'completed' | 'expired'; submitted_at?: string; created_at: string; } /** * NexHealth Paginated Response */ export interface NHPaginatedResponse { data: T[]; count: number; page: number; per_page: number; total_pages: number; } export interface ListPatientsOptions { /** Search query (name, email, phone) */ query?: string; /** Filter by inactive status */ inactive?: boolean; /** Page number */ page?: number; /** Results per page (max 100) */ perPage?: number; } export interface CreatePatientOptions { firstName: string; lastName: string; email?: string; phone?: string; cellPhone?: string; dateOfBirth?: string; gender?: string; address?: { line1?: string; city?: string; state?: string; zip?: string; }; } export interface ListAppointmentsOptions { /** Filter by patient ID */ patientId?: number; /** Filter by provider ID */ providerId?: number; /** Start date (ISO string) */ startDate?: string; /** End date (ISO string) */ endDate?: string; /** Filter by status */ status?: NHAppointmentStatus; /** Page number */ page?: number; /** Results per page */ perPage?: number; } export interface CreateAppointmentOptions { /** Patient ID */ patientId: number; /** Provider ID */ providerId: number; /** Appointment type ID */ appointmentTypeId: number; /** Start time (ISO string) */ startTime: string; /** Duration in minutes (optional, uses appointment type default) */ duration?: number; /** Operatory ID */ operatoryId?: number; /** Notes */ notes?: string; } export interface GetAvailableSlotsOptions { /** Provider ID */ providerId?: number; /** Appointment type ID */ appointmentTypeId: number; /** Start date (ISO string) */ startDate: string; /** End date (ISO string) */ endDate: string; } export interface SendFormOptions { /** Patient ID */ patientId: number; /** Form ID */ formId: number; /** Delivery method */ deliveryMethod?: 'email' | 'sms' | 'both'; } export interface GetInactivePatientsOptions { /** Months since last appointment (default: 6) */ monthsInactive?: number; /** Page number */ page?: number; /** Results per page */ perPage?: number; } /** * NexHealth Healthcare Integration * * Weniger, aber besser: Unified healthcare client for patient scheduling automation. */ export declare class NexHealth extends BaseAPIClient { private readonly subdomain; private readonly locationId?; constructor(config: NexHealthConfig); /** * Get standard query params including subdomain */ private getBaseParams; /** * Get a patient by ID */ getPatient(patientId: number): Promise>; /** * List patients with optional filters */ listPatients(options?: ListPatientsOptions): Promise>>; /** * Search for patients */ searchPatients(query: string): Promise>; /** * Create a patient */ createPatient(options: CreatePatientOptions): Promise>; /** * Get inactive patients (Zuhandenheit API) * * Outcome-focused: "Who needs to be reactivated?" */ getInactivePatients(options?: GetInactivePatientsOptions): Promise>; /** * Get an appointment by ID */ getAppointment(appointmentId: number): Promise>; /** * List appointments with optional filters */ listAppointments(options?: ListAppointmentsOptions): Promise>>; /** * Get today's appointments (Zuhandenheit API) * * Outcome-focused: "What's on the schedule today?" */ getTodaysAppointments(): Promise>; /** * Get upcoming appointments (Zuhandenheit API) * * Outcome-focused: "What's coming up this week?" */ getUpcomingAppointments(days?: number): Promise>; /** * Create an appointment */ createAppointment(options: CreateAppointmentOptions): Promise>; /** * Confirm an appointment */ confirmAppointment(appointmentId: number): Promise>; /** * Cancel an appointment */ cancelAppointment(appointmentId: number, reason?: string): Promise>; /** * Mark appointment as no-show */ markNoShow(appointmentId: number): Promise>; /** * Get available appointment slots */ getAvailableSlots(options: GetAvailableSlotsOptions): Promise>; /** * List providers */ listProviders(): Promise>; /** * List locations */ listLocations(): Promise>; /** * List appointment types */ listAppointmentTypes(): Promise>; /** * List forms */ listForms(): Promise>; /** * Send form to patient */ sendForm(options: SendFormOptions): Promise>; /** * Verify NexHealth webhook signature */ verifyWebhook(payload: string, signature: string, secret: string): Promise>; private getCapabilities; } export interface NHWebhookEvent { event: string; resource_type: 'appointment' | 'patient' | 'form_submission'; resource_id: number; data: { appointment?: NHAppointment; patient?: NHPatient; form_submission?: NHFormSubmission; }; created_at: string; } //# sourceMappingURL=index.d.ts.map