diff --git a/apps/Backend/src/queue/processors/preAuthCheckProcessor.ts b/apps/Backend/src/queue/processors/preAuthCheckProcessor.ts
index 367f70cb..3dcfa4c2 100644
--- a/apps/Backend/src/queue/processors/preAuthCheckProcessor.ts
+++ b/apps/Backend/src/queue/processors/preAuthCheckProcessor.ts
@@ -119,6 +119,14 @@ async function savePreauthHistory(claimId: number | undefined, preAuthNumber: st
log("preauth history saved", { claimId, patientId: claim.patientId, rows: procedures.length });
}
+// Portal status text (e.g. "Approved", "Denied") -> claim status; null leaves the claim as is.
+function claimStatusForPortalStatus(portalStatus: unknown): "APPROVED" | "DENIED" | null {
+ const s = String(portalStatus ?? "").toLowerCase();
+ if (s.includes("denied") || s.includes("rejected")) return "DENIED";
+ if (s.includes("approved")) return "APPROVED";
+ return null;
+}
+
export async function runPreAuthCheckProcessor(
input: {
siteKey: PreAuthCheckSiteKey;
@@ -149,6 +157,15 @@ export async function runPreAuthCheckProcessor(
throw new Error(result?.message ?? "Check PreAuth returned an error");
}
let message = typeof result.message === "string" ? result.message : "completed";
+ const newStatus = claimStatusForPortalStatus(result.preAuthStatus);
+ if (newStatus && claimId) {
+ try {
+ await storage.updateClaimStatus(claimId, newStatus);
+ message += ` Status set to ${newStatus === "DENIED" ? "Denied" : "Approved"}.`;
+ } catch (e: any) {
+ log("updating claim status failed", { claimId, error: e?.message });
+ }
+ }
try {
if (result.approval_pdf_path) {
const saved = await saveApprovalPdf(userId, claimId, result.approval_pdf_path);
diff --git a/apps/Frontend/src/components/claims/check-preauth-button.tsx b/apps/Frontend/src/components/claims/check-preauth-button.tsx
index 804835da..b72614f4 100644
--- a/apps/Frontend/src/components/claims/check-preauth-button.tsx
+++ b/apps/Frontend/src/components/claims/check-preauth-button.tsx
@@ -10,7 +10,7 @@ import {
DialogTitle,
} from "@/components/ui/dialog";
import { toast } from "@/hooks/use-toast";
-import { apiRequest } from "@/lib/queryClient";
+import { apiRequest, queryClient } from "@/lib/queryClient";
import { socket } from "@/lib/socket";
// Runs the Check PreAuth worker matching the claim's insurance (the backend picks it:
@@ -61,6 +61,8 @@ async function startPreauthCheck(claimId: number, onCompleted?: () => void) {
if (String(ev?.jobId) !== jobId || ev.status === "active") return;
if (ev.status === "completed") {
toast({ title: `${label} Check PreAuth complete`, description: ev.result?.message ?? "" });
+ // The check may have set the claim to Approved/Denied (QK_CLAIMS_BASE in claims-recent-table)
+ queryClient.invalidateQueries({ queryKey: ["claims-recent"] });
onCompleted?.();
} else {
toast({
diff --git a/apps/Frontend/src/components/claims/claim-edit-modal.tsx b/apps/Frontend/src/components/claims/claim-edit-modal.tsx
index f8f8a443..73c61c70 100755
--- a/apps/Frontend/src/components/claims/claim-edit-modal.tsx
+++ b/apps/Frontend/src/components/claims/claim-edit-modal.tsx
@@ -136,6 +136,7 @@ export default function ClaimEditModal({
Pending
Review
Approved
+ Denied
Cancelled
diff --git a/apps/Frontend/src/components/claims/claim-view-modal.tsx b/apps/Frontend/src/components/claims/claim-view-modal.tsx
index daebffd2..9b4bfbd9 100755
--- a/apps/Frontend/src/components/claims/claim-view-modal.tsx
+++ b/apps/Frontend/src/components/claims/claim-view-modal.tsx
@@ -126,7 +126,8 @@ export default function ClaimViewModal({
className={`font-medium ${
claim.status === "APPROVED"
? "text-green-600"
- : claim.status === "CANCELLED"
+ : claim.status === "CANCELLED" ||
+ claim.status === "DENIED"
? "text-red-600"
: claim.status === "REVIEW"
? "text-yellow-600"
diff --git a/apps/Frontend/src/components/claims/claims-recent-table.tsx b/apps/Frontend/src/components/claims/claims-recent-table.tsx
index c7afbed1..53a071bc 100755
--- a/apps/Frontend/src/components/claims/claims-recent-table.tsx
+++ b/apps/Frontend/src/components/claims/claims-recent-table.tsx
@@ -293,6 +293,12 @@ export default function ClaimsRecentTable({
color: "bg-blue-100 text-blue-800",
icon: ,
};
+ case "DENIED":
+ return {
+ label: "Denied",
+ color: "bg-red-100 text-red-800",
+ icon: ,
+ };
default:
return {
label: status
diff --git a/apps/SeleniumService/selenium_TuftsSCO_preAuthCheckWorker.py b/apps/SeleniumService/selenium_TuftsSCO_preAuthCheckWorker.py
index ce12ef68..34b3e6bf 100644
--- a/apps/SeleniumService/selenium_TuftsSCO_preAuthCheckWorker.py
+++ b/apps/SeleniumService/selenium_TuftsSCO_preAuthCheckWorker.py
@@ -5,6 +5,7 @@ from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
import base64
import os
+import re
import time
from selenium_DentaQuest_eligibilityCheckWorker import AutomationDentaQuestEligibilityCheck
@@ -88,29 +89,57 @@ class AutomationTuftsSCOPreAuthCheck(AutomationDentaQuestEligibilityCheck):
return {"status": "error", "message": f"Tufts SCO found no pre-auth/claim #{number}."}
return {"status": "error", "message": f"Search result for #{number} did not load."}
# Status column of the result row (e.g. "Approved"), read before leaving the page
+ # (cells may be
or | , and header text may carry sort-icon text)
status = ""
try:
- headers = [h.text.strip().lower() for h in self.driver.find_elements(By.XPATH, "//thead//th")]
- cells = self.driver.find_elements(By.XPATH, "//tbody//tr[1]/td")
- if "status" in headers and headers.index("status") < len(cells):
- status = cells[headers.index("status")].text.strip()
- except Exception:
- pass
+ headers = [h.text.strip().lower() for h in self.driver.find_elements(By.XPATH, "//thead//tr[1]/*")]
+ cells = self.driver.find_elements(By.XPATH, "//tbody//tr[1]/*")
+ idx = next((i for i, h in enumerate(headers) if h.startswith("status")), -1)
+ if 0 <= idx < len(cells):
+ status = cells[idx].text.strip()
+ if not status:
+ row_text = " ".join(c.text for c in cells).lower()
+ for word in ("Partially approved", "Approved", "Denied","Pending", "In review", "Rejected"):
+ if word.lower() in row_text:
+ status = word
+ break
+ except Exception as e:
+ print(f"[TuftsSCO PreAuthCheck step2] Reading status failed: {e}")
print(f"[TuftsSCO PreAuthCheck step2] Status: {status!r}")
- id_link.click()
- print(f"[TuftsSCO PreAuthCheck step2] Opened #{number}")
+ # A plain click can be intercepted (banner over the row) or hit a re-rendered link
+ link_xpath = f"//tbody//tr[1]/*[1]//*[self::a or self::button][contains(normalize-space(.), '{number}')]"
+ windows_before = set(self.driver.window_handles)
+ try:
+ id_link = self.driver.find_element(By.XPATH, link_xpath)
+ self.driver.execute_script("arguments[0].scrollIntoView({block: 'center'});", id_link)
+ id_link.click()
+ except Exception as e:
+ print(f"[TuftsSCO PreAuthCheck step2] Click failed ({type(e).__name__}), using JS click")
+ self.driver.execute_script("arguments[0].click();", self.driver.find_element(By.XPATH, link_xpath))
+ # The detail page may open in a new tab
+ time.sleep(1)
+ new_windows = [w for w in self.driver.window_handles if w not in windows_before]
+ if new_windows:
+ self.driver.switch_to.window(new_windows[0])
+ print("[TuftsSCO PreAuthCheck step2] Detail page opened in a new tab")
+ print(f"[TuftsSCO PreAuthCheck step2] Opened #{number}: {self.driver.current_url}")
# 2) Wait for the detail page ("Pre-authorization for ")
try:
WebDriverWait(self.driver, 30).until(EC.presence_of_element_located(
(By.XPATH, f"//h1[contains(., '{number}')] | //*[self::h1 or self::h2][contains(., 'for ')][contains(., '{number}')]")
))
- WebDriverWait(self.driver, 30).until(EC.presence_of_element_located(
+ except TimeoutException:
+ print(f"[TuftsSCO PreAuthCheck step2] Detail page not found. URL: {self.driver.current_url}")
+ return {"status": "error", "message": f"Detail page for #{number} did not load."}
+ # Denied pre-auths may have no procedure section; still save the page as a PDF
+ try:
+ WebDriverWait(self.driver, 15).until(EC.presence_of_element_located(
(By.XPATH, "//*[contains(normalize-space(.), 'Procedure information')]")
))
except TimeoutException:
- return {"status": "error", "message": f"Detail page for #{number} did not load."}
+ print("[TuftsSCO PreAuthCheck step2] No 'Procedure information' section")
time.sleep(2) # let the procedure table finish rendering
# Procedure lines for the patient's Preauth History
@@ -127,8 +156,9 @@ class AutomationTuftsSCOPreAuthCheck(AutomationDentaQuestEligibilityCheck):
"marginLeft": 0.4,
"marginRight": 0.4,
})
+ status_slug = re.sub(r"[^a-z0-9]+", "_", status.lower()).strip("_") or "approval"
pdf_path = os.path.join(
- self.download_dir, f"tuftssco_preauth_approval_{number}_{int(time.time())}.pdf"
+ self.download_dir, f"tuftssco_preauth_{status_slug}_{number}_{int(time.time())}.pdf"
)
with open(pdf_path, "wb") as f:
f.write(base64.b64decode(pdf.get("data", "")))
@@ -136,6 +166,9 @@ class AutomationTuftsSCOPreAuthCheck(AutomationDentaQuestEligibilityCheck):
# Leave the browser idle so the session stays logged in for the next run
try:
+ if new_windows:
+ self.driver.close()
+ self.driver.switch_to.window(next(iter(windows_before)))
self.driver.get("about:blank")
self.driver.minimize_window()
except Exception:
@@ -150,4 +183,5 @@ class AutomationTuftsSCOPreAuthCheck(AutomationDentaQuestEligibilityCheck):
"approval_pdf_path": pdf_path,
}
except Exception as e:
+ print(f"[TuftsSCO PreAuthCheck step2] Failed: {e}")
return {"status": "error", "message": f"Tufts SCO pre-auth check failed: {e}"}
diff --git a/packages/db/generated/prisma/edge.js b/packages/db/generated/prisma/edge.js
index 61976cad..8c33746f 100644
--- a/packages/db/generated/prisma/edge.js
+++ b/packages/db/generated/prisma/edge.js
@@ -605,7 +605,8 @@ exports.ClaimStatus = exports.$Enums.ClaimStatus = {
CANCELLED: 'CANCELLED',
REVIEW: 'REVIEW',
VOID: 'VOID',
- PREAUTH: 'PREAUTH'
+ PREAUTH: 'PREAUTH',
+ DENIED: 'DENIED'
};
exports.MissingTeethStatus = exports.$Enums.MissingTeethStatus = {
@@ -731,7 +732,7 @@ const config = {
"clientVersion": "7.4.1",
"engineVersion": "55ae170b1ced7fc6ed07a15f110549408c501bb3",
"activeProvider": "postgresql",
- "inlineSchema": "// This is your Prisma schema file,\n// learn more about it in the docs: https://pris.ly/d/prisma-schema\n\n// Looking for ways to speed up your queries, or scale easily with your serverless or edge functions?\n// Try Prisma Accelerate: https://pris.ly/cli/accelerate-init\n\ngenerator client {\n provider = \"prisma-client-js\"\n output = \"../generated/prisma\"\n}\n\ngenerator zod {\n provider = \"prisma-zod-generator\"\n output = \"../shared/\" // Zod schemas will be generated here inside `db/shared`\n}\n\ndatasource db {\n provider = \"postgresql\"\n}\n\nmodel User {\n id Int @id @default(autoincrement())\n username String @unique\n password String\n autoBackupEnabled Boolean @default(true)\n autoBackupHour Int @default(20)\n usbBackupEnabled Boolean @default(false)\n usbBackupHour Int @default(21)\n autoMhCheckEnabled Boolean @default(false)\n autoMhCheckDayOfWeek Int @default(1)\n autoMhCheckHour Int @default(13)\n patients Patient[]\n appointments Appointment[]\n staff Staff[]\n npiProviders NpiProvider[]\n claims Claim[]\n insuranceCredentials InsuranceCredential[]\n shoppingVendors ShoppingVendor[]\n updatedPayments Payment[] @relation(\"PaymentUpdatedBy\")\n backups DatabaseBackup[]\n backupDestinations BackupDestination[]\n notifications Notification[]\n cloudFolders CloudFolder[]\n cloudFiles CloudFile[]\n communications Communication[]\n twilioSettings TwilioSettings?\n telnyxSettings TelnyxSettings?\n aiSettings AiSettings?\n officeHours OfficeHours?\n officeContact OfficeContact?\n procedureTimeslot ProcedureTimeslot?\n insuranceContacts InsuranceContact[]\n patientConversations PatientConversation[]\n labRxTemplates LabRxTemplate[]\n seleniumSettings SeleniumSettings?\n}\n\nmodel Patient {\n id Int @id @default(autoincrement())\n firstName String\n lastName String\n dateOfBirth DateTime? @db.Date\n gender String\n phone String\n email String?\n address String?\n city String?\n state String? @default(\"MA\")\n zipCode String?\n insuranceProvider String?\n insuranceId String?\n groupNumber String?\n policyHolder String?\n policyHolderPatientId Int? // patient record of the policy holder, when picked from the DB\n policyHolderRelationship String? // ADA box 18: SELF | SPOUSE | DEPENDENT | OTHER\n allergies String?\n medicalConditions String?\n preferredLanguage String? @default(\"English\")\n status PatientStatus @default(UNKNOWN)\n remainingBenefit String?\n thirdPartyInsurance String?\n userId Int\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n user User @relation(fields: [userId], references: [id])\n appointments Appointment[]\n procedures AppointmentProcedure[]\n claims Claim[]\n groups PdfGroup[]\n payment Payment[]\n communications Communication[]\n documents PatientDocument[]\n conversation PatientConversation?\n cloudFolders CloudFolder[] @relation(\"PatientCloudFolder\")\n serviceHistory PatientServiceHistory[]\n preauthHistory PatientPreauthHistory[]\n\n @@index([insuranceId])\n @@index([createdAt])\n}\n\nenum PatientStatus {\n ACTIVE\n INACTIVE\n UNKNOWN\n PLAN_NOT_ACCEPTED\n}\n\nmodel Appointment {\n id Int @id @default(autoincrement())\n patientId Int\n userId Int\n staffId Int\n npiProviderId Int?\n title String\n date DateTime @db.Date\n startTime String // Store time as \"hh:mm\"\n endTime String // Store time as \"hh:mm\"\n type String // e.g., \"checkup\", \"cleaning\", \"filling\", etc.\n typeLocked Boolean @default(false) // true = user manually set; auto-sync will not overwrite\n notes String?\n procedureCodeNotes String?\n status String @default(\"scheduled\") // \"scheduled\", \"completed\", \"cancelled\", \"no-show\"\n movedByAi Boolean @default(false)\n createdAt DateTime @default(now())\n\n eligibilityStatus PatientStatus @default(UNKNOWN)\n\n patient Patient @relation(fields: [patientId], references: [id], onDelete: Cascade)\n user User @relation(fields: [userId], references: [id])\n staff Staff? @relation(fields: [staffId], references: [id])\n npiProvider NpiProvider? @relation(fields: [npiProviderId], references: [id])\n procedures AppointmentProcedure[]\n claims Claim[]\n files AppointmentFile[]\n\n @@index([patientId])\n @@index([date])\n}\n\nmodel AppointmentFile {\n id Int @id @default(autoincrement())\n appointmentId Int\n filename String\n mimeType String?\n filePath String?\n\n appointment Appointment @relation(fields: [appointmentId], references: [id], onDelete: Cascade)\n\n @@index([appointmentId])\n}\n\nmodel Staff {\n id Int @id @default(autoincrement())\n userId Int\n name String\n email String?\n role String // e.g., \"Dentist\", \"Hygienist\", \"Assistant\"\n phone String?\n createdAt DateTime @default(now())\n user User? @relation(fields: [userId], references: [id], onDelete: Cascade)\n appointments Appointment[]\n claims Claim[] @relation(\"ClaimStaff\")\n}\n\nmodel NpiProvider {\n id Int @id @default(autoincrement())\n userId Int\n npiNumber String\n providerName String\n /// State dental license (ADA claim form item 55)\n licenseNumber String?\n sortOrder Int @default(0)\n createdAt DateTime @default(now())\n\n user User @relation(fields: [userId], references: [id], onDelete: Cascade)\n claims Claim[]\n payments Payment[]\n commissionBatches CommissionBatch[]\n appointmentProcedures AppointmentProcedure[]\n appointments Appointment[]\n\n @@unique([userId, npiNumber])\n @@index([userId])\n}\n\nenum ProcedureSource {\n COMBO\n MANUAL\n}\n\nmodel AppointmentProcedure {\n id Int @id @default(autoincrement())\n appointmentId Int\n patientId Int\n npiProviderId Int?\n\n procedureCode String\n procedureLabel String?\n fee Decimal? @db.Decimal(10, 2)\n\n category String?\n\n toothNumber String?\n toothSurface String?\n oralCavityArea String?\n\n source ProcedureSource @default(MANUAL)\n comboKey String?\n\n createdAt DateTime @default(now())\n\n appointment Appointment @relation(fields: [appointmentId], references: [id], onDelete: Cascade)\n patient Patient @relation(fields: [patientId], references: [id], onDelete: Cascade)\n npiProvider NpiProvider? @relation(fields: [npiProviderId], references: [id])\n\n @@index([appointmentId])\n @@index([patientId])\n}\n\nmodel Claim {\n id Int @id @default(autoincrement())\n patientId Int\n /// @zod.number.int().nullable().optional()\n appointmentId Int?\n userId Int\n staffId Int\n patientName String\n memberId String\n dateOfBirth DateTime @db.Date\n remarks String\n missingTeethStatus MissingTeethStatus @default(No_missing)\n missingTeeth Json? // { \"T_14\": \"X\", \"T_G\": \"O\", ... }\n serviceDate DateTime\n insuranceProvider String // e.g., \"Delta MA\"\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n status ClaimStatus @default(PENDING)\n claimNumber String?\n preAuthNumber String?\n npiProviderId Int?\n\n patient Patient @relation(fields: [patientId], references: [id], onDelete: Cascade)\n appointment Appointment? @relation(fields: [appointmentId], references: [id], onDelete: Cascade)\n user User? @relation(fields: [userId], references: [id])\n staff Staff? @relation(\"ClaimStaff\", fields: [staffId], references: [id])\n npiProvider NpiProvider? @relation(fields: [npiProviderId], references: [id])\n\n serviceLines ServiceLine[]\n claimFiles ClaimFile[]\n payment Payment?\n}\n\nenum ClaimStatus {\n PENDING\n APPROVED\n CANCELLED\n REVIEW\n VOID\n PREAUTH\n}\n\nenum MissingTeethStatus {\n No_missing\n endentulous\n Yes_missing\n}\n\nmodel ServiceLine {\n id Int @id @default(autoincrement())\n claimId Int?\n paymentId Int?\n procedureCode String\n procedureDate DateTime @db.Date\n quad String?\n arch String?\n toothNumber String?\n toothSurface String?\n icn String?\n paidCode String?\n allowedAmount Decimal? @db.Decimal(10, 2)\n totalBilled Decimal @db.Decimal(10, 2)\n totalPaid Decimal @default(0.00) @db.Decimal(10, 2)\n totalAdjusted Decimal @default(0.00) @db.Decimal(10, 2)\n totalDue Decimal @default(0.00) @db.Decimal(10, 2)\n status ServiceLineStatus @default(UNPAID)\n\n claim Claim? @relation(fields: [claimId], references: [id], onDelete: Cascade)\n payment Payment? @relation(fields: [paymentId], references: [id], onDelete: Cascade)\n\n serviceLineTransactions ServiceLineTransaction[]\n}\n\nenum ServiceLineStatus {\n PENDING\n PARTIALLY_PAID\n PAID\n UNPAID\n ADJUSTED\n OVERPAID\n DENIED\n}\n\nmodel ClaimFile {\n id Int @id @default(autoincrement())\n claimId Int\n filename String\n mimeType String\n filePath String?\n\n claim Claim @relation(fields: [claimId], references: [id], onDelete: Cascade)\n}\n\nmodel InsuranceCredential {\n id Int @id @default(autoincrement())\n userId Int\n siteKey String\n username String\n password String\n\n user User @relation(fields: [userId], references: [id], onDelete: Cascade)\n\n @@unique([userId, siteKey])\n @@index([userId])\n}\n\nmodel ShoppingVendor {\n id Int @id @default(autoincrement())\n userId Int\n vendorName String\n websiteUrl String\n loginUsername String\n loginPassword String\n\n user User @relation(fields: [userId], references: [id], onDelete: Cascade)\n\n @@index([userId])\n}\n\nmodel PdfGroup {\n id Int @id @default(autoincrement())\n title String\n titleKey PdfTitleKey @default(OTHER)\n createdAt DateTime @default(now())\n patientId Int\n patient Patient @relation(fields: [patientId], references: [id], onDelete: Cascade)\n pdfs PdfFile[]\n\n @@index([patientId])\n @@index([titleKey])\n}\n\nmodel PdfFile {\n id Int @id @default(autoincrement())\n filename String\n pdfData Bytes\n uploadedAt DateTime @default(now())\n groupId Int\n group PdfGroup @relation(fields: [groupId], references: [id], onDelete: Cascade)\n\n @@index([groupId])\n}\n\nenum PdfTitleKey {\n INSURANCE_CLAIM\n INSURANCE_CLAIM_PREAUTH\n ELIGIBILITY_STATUS\n CLAIM_STATUS\n PREAUTH_APPROVAL\n OTHER\n}\n\nmodel Payment {\n id Int @id @default(autoincrement())\n claimId Int? @unique\n patientId Int\n userId Int\n updatedById Int?\n npiProviderId Int?\n totalBilled Decimal @db.Decimal(10, 2)\n totalPaid Decimal @default(0.00) @db.Decimal(10, 2)\n totalAdjusted Decimal @default(0.00) @db.Decimal(10, 2)\n totalDue Decimal @db.Decimal(10, 2)\n mhPaidAmount Decimal? @db.Decimal(10, 2)\n copayment Decimal @default(0.00) @db.Decimal(10, 2)\n adjustment Decimal @default(0.00) @db.Decimal(10, 2)\n status PaymentStatus @default(PENDING)\n notes String?\n icn String?\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n\n claim Claim? @relation(fields: [claimId], references: [id], onDelete: Cascade)\n patient Patient @relation(fields: [patientId], references: [id], onDelete: Cascade)\n updatedBy User? @relation(\"PaymentUpdatedBy\", fields: [updatedById], references: [id])\n npiProvider NpiProvider? @relation(fields: [npiProviderId], references: [id])\n serviceLineTransactions ServiceLineTransaction[]\n serviceLines ServiceLine[]\n commissionBatchItems CommissionBatchItem[]\n\n @@index([claimId])\n @@index([patientId])\n @@index([createdAt])\n}\n\nmodel ServiceLineTransaction {\n id Int @id @default(autoincrement())\n paymentId Int\n serviceLineId Int\n transactionId String?\n paidAmount Decimal @db.Decimal(10, 2)\n adjustedAmount Decimal @default(0.00) @db.Decimal(10, 2)\n method PaymentMethod\n receivedDate DateTime\n payerName String?\n notes String?\n createdAt DateTime @default(now())\n\n payment Payment @relation(fields: [paymentId], references: [id], onDelete: Cascade)\n serviceLine ServiceLine @relation(fields: [serviceLineId], references: [id], onDelete: Cascade)\n\n @@index([paymentId])\n @@index([serviceLineId])\n}\n\nenum PaymentStatus {\n PENDING\n PARTIALLY_PAID\n PAID\n OVERPAID\n DENIED\n VOID\n}\n\nenum PaymentMethod {\n EFT\n CHECK\n CASH\n CARD\n OTHER\n}\n\n// Database management page\nmodel DatabaseBackup {\n id Int @id @default(autoincrement())\n userId Int\n createdAt DateTime @default(now())\n\n user User @relation(fields: [userId], references: [id], onDelete: Cascade)\n\n @@index([userId])\n @@index([createdAt])\n}\n\nmodel BackupDestination {\n id Int @id @default(autoincrement())\n userId Int\n path String\n isActive Boolean @default(true)\n createdAt DateTime @default(now())\n\n user User @relation(fields: [userId], references: [id])\n}\n\nmodel Notification {\n id Int @id @default(autoincrement())\n userId Int\n type NotificationTypes\n message String\n createdAt DateTime @default(now())\n read Boolean @default(false)\n\n user User @relation(fields: [userId], references: [id], onDelete: Cascade)\n\n @@index([userId])\n @@index([createdAt])\n}\n\nenum NotificationTypes {\n BACKUP\n CLAIM\n PAYMENT\n ETC\n}\n\n// Cron job execution log\nmodel CronJobLog {\n id Int @id @default(autoincrement())\n jobName String // e.g. \"local-backup\", \"usb-backup\"\n status String // \"success\" | \"failed\" | \"skipped\"\n startedAt DateTime\n completedAt DateTime?\n durationMs Int?\n errorMessage String?\n\n @@index([jobName])\n @@index([startedAt])\n @@index([status])\n}\n\nmodel CloudFolder {\n id Int @id @default(autoincrement())\n userId Int\n name String\n parentId Int?\n patientId Int?\n parent CloudFolder? @relation(\"FolderChildren\", fields: [parentId], references: [id], onDelete: Cascade)\n children CloudFolder[] @relation(\"FolderChildren\")\n user User @relation(fields: [userId], references: [id])\n patient Patient? @relation(\"PatientCloudFolder\", fields: [patientId], references: [id], onDelete: SetNull)\n files CloudFile[]\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n\n @@unique([userId, parentId, name]) // prevents sibling folder name duplicates\n @@index([parentId])\n @@index([patientId])\n}\n\nmodel CloudFile {\n id Int @id @default(autoincrement())\n userId Int\n name String\n mimeType String?\n fileSize BigInt @db.BigInt\n folderId Int? // optional: null => root\n isComplete Boolean @default(false) // upload completed?\n totalChunks Int? // optional: expected number of chunks\n diskPath String? // relative path on disk under uploads/\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n user User @relation(fields: [userId], references: [id])\n folder CloudFolder? @relation(fields: [folderId], references: [id], onDelete: SetNull)\n\n chunks CloudFileChunk[]\n\n @@index([folderId])\n}\n\nmodel CloudFileChunk {\n id Int @id @default(autoincrement())\n fileId Int\n seq Int\n data Bytes\n createdAt DateTime @default(now())\n\n file CloudFile @relation(fields: [fileId], references: [id], onDelete: Cascade)\n\n @@unique([fileId, seq])\n @@index([fileId, seq])\n}\n\n// patient-connection-\nenum CommunicationChannel {\n sms\n voice\n}\n\nenum CommunicationDirection {\n outbound\n inbound\n}\n\nenum CommunicationStatus {\n queued\n sent\n delivered\n failed\n completed\n busy\n no_answer\n}\n\nenum CommunicationProvider {\n twilio\n telnyx\n}\n\nmodel Communication {\n id Int @id @default(autoincrement())\n patientId Int\n userId Int?\n\n channel CommunicationChannel\n direction CommunicationDirection\n status CommunicationStatus\n // Which platform produced twilioSid — twilio for dial-pad-originated calls,\n // telnyx for everything else (SMS, inbound/AI voice, staff-triggered outbound calls).\n provider CommunicationProvider @default(twilio)\n\n body String?\n callDuration Int?\n // Provider SID — Twilio MessageSid/CallSid, or Telnyx message/call id. See `provider`.\n twilioSid String?\n\n createdAt DateTime @default(now())\n\n // Relations\n patient Patient @relation(fields: [patientId], references: [id])\n user User? @relation(fields: [userId], references: [id])\n\n @@map(\"communications\")\n}\n\nmodel PatientDocument {\n id Int @id @default(autoincrement())\n patientId Int\n filename String\n originalName String\n mimeType String\n fileSize BigInt\n filePath String\n uploadedAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n patient Patient @relation(fields: [patientId], references: [id], onDelete: Cascade)\n\n @@index([patientId])\n @@index([uploadedAt])\n}\n\nmodel TwilioSettings {\n id Int @id @default(autoincrement())\n userId Int @unique\n accountSid String\n authToken String\n phoneNumber String\n // Vestigial — inbound voice moved to Telnyx (TelnyxSettings.greetingMessage). No longer\n // read/written; kept to avoid a destructive migration for a cosmetic cleanup.\n greetingMessage String?\n templates Json?\n\n user User @relation(fields: [userId], references: [id], onDelete: Cascade)\n\n @@map(\"twilio_settings\")\n}\n\nmodel TelnyxSettings {\n id Int @id @default(autoincrement())\n userId Int @unique\n apiKey String\n // Telnyx account SID (Mission Control Portal), required to place outbound\n // TeXML calls via POST /texml/Accounts/{accountSid}/Calls — separate from apiKey.\n accountSid String?\n phoneNumber String\n texmlApplicationId String?\n messagingProfileId String?\n webhookPublicKey String?\n greetingMessage String?\n\n user User @relation(fields: [userId], references: [id], onDelete: Cascade)\n\n @@map(\"telnyx_settings\")\n}\n\nmodel AiSettings {\n id Int @id @default(autoincrement())\n userId Int @unique\n apiKey String\n aiEnabled Boolean @default(true)\n openAiKey String @default(\"\")\n openAiEnabled Boolean @default(false)\n claudeAiKey String @default(\"\")\n claudeAiEnabled Boolean @default(false)\n claudeAiModel String @default(\"claude-haiku-4-5-20251001\")\n openAiModel String @default(\"gpt-5.2\")\n googleAiModel String @default(\"gemini-2.5-flash\")\n dentalMgmtKey String @default(\"\")\n dentalMgmtEnabled Boolean @default(false)\n afterHoursEnabled Boolean @default(true)\n openPhoneReply Boolean @default(false)\n\n user User @relation(fields: [userId], references: [id], onDelete: Cascade)\n\n @@map(\"ai_settings\")\n}\n\nmodel OfficeHours {\n id Int @id @default(autoincrement())\n userId Int @unique\n data Json\n\n user User @relation(fields: [userId], references: [id], onDelete: Cascade)\n\n @@map(\"office_hours\")\n}\n\nmodel OfficeContact {\n id Int @id @default(autoincrement())\n userId Int @unique\n /// Legal (registered) business name — ADA claim form items 48 and 56\n legalName String?\n /// Dental office name as the public knows it (DBA)\n officeName String?\n receptionistName String?\n dentistName String?\n phoneNumber String?\n email String?\n fax String?\n streetAddress String?\n city String?\n state String?\n zipCode String?\n /// Office (billing) NPI — ADA claim form items 48-51\n billingName String?\n billingNpi String?\n billingLicense String?\n billingTaxId String?\n\n user User @relation(fields: [userId], references: [id], onDelete: Cascade)\n\n @@map(\"office_contact\")\n}\n\nmodel InsuranceContact {\n id Int @id @default(autoincrement())\n userId Int\n name String\n phoneNumber String?\n createdAt DateTime @default(now())\n\n user User @relation(fields: [userId], references: [id], onDelete: Cascade)\n\n @@map(\"insurance_contact\")\n}\n\nmodel ProcedureTimeslot {\n id Int @id @default(autoincrement())\n userId Int @unique\n data Json\n\n user User @relation(fields: [userId], references: [id], onDelete: Cascade)\n\n @@map(\"procedure_timeslot\")\n}\n\nmodel PatientConversation {\n id Int @id @default(autoincrement())\n patientId Int @unique\n userId Int\n stage String @default(\"initial\")\n aiHandoff Boolean @default(true)\n updatedAt DateTime @updatedAt\n\n patient Patient @relation(fields: [patientId], references: [id], onDelete: Cascade)\n user User @relation(fields: [userId], references: [id], onDelete: Cascade)\n\n @@map(\"patient_conversation\")\n}\n\n// Snapshot of the MassHealth Service History table, replaced on each eligibility check\nmodel PatientServiceHistory {\n id Int @id @default(autoincrement())\n patientId Int\n procedureCode String\n description String?\n toothQuadArchSurface String?\n placeOfService String?\n serviceDate String? // as shown by the portal, e.g. 10/15/2026\n createdAt DateTime @default(now())\n\n patient Patient @relation(fields: [patientId], references: [id], onDelete: Cascade)\n\n @@index([patientId])\n @@map(\"patient_service_history\")\n}\n\n// Procedure lines of a pre-auth, read by Check PreAuth (Tufts SCO). Replaced per\n// pre-auth number on each check, so a patient keeps one set of lines per pre-auth.\nmodel PatientPreauthHistory {\n id Int @id @default(autoincrement())\n patientId Int\n preAuthNumber String\n submittedCode String\n toothQuadArchSurface String?\n paidAmount String? // \"Plan payment\" as shown by the portal, e.g. $564.00\n status String?\n createdAt DateTime @default(now())\n\n patient Patient @relation(fields: [patientId], references: [id], onDelete: Cascade)\n\n @@index([patientId])\n @@map(\"patient_preauth_history\")\n}\n\nmodel LabRxTemplate {\n id Int @id @default(autoincrement())\n userId Int\n name String\n labName String?\n labPhone String?\n labFax String?\n labAddress String?\n labAccount String?\n caseType String?\n material String?\n instructions String?\n sortOrder Int @default(0)\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n\n user User @relation(fields: [userId], references: [id], onDelete: Cascade)\n\n @@index([userId])\n @@map(\"lab_rx_template\")\n}\n\n// Commission tracking\nmodel CommissionBatch {\n id Int @id @default(autoincrement())\n npiProviderId Int\n totalCollection Decimal @db.Decimal(14, 2)\n commissionAmount Decimal @db.Decimal(14, 2)\n notes String?\n createdAt DateTime @default(now())\n\n npiProvider NpiProvider @relation(fields: [npiProviderId], references: [id])\n items CommissionBatchItem[]\n\n @@index([npiProviderId])\n}\n\nmodel CommissionBatchItem {\n id Int @id @default(autoincrement())\n commissionBatchId Int\n paymentId Int\n collectionAmount Decimal @db.Decimal(14, 2)\n\n commissionBatch CommissionBatch @relation(fields: [commissionBatchId], references: [id], onDelete: Cascade)\n payment Payment @relation(fields: [paymentId], references: [id])\n\n @@unique([commissionBatchId, paymentId])\n @@index([paymentId])\n}\n\nmodel SeleniumSettings {\n id Int @id @default(autoincrement())\n userId Int @unique\n paymentGroupId String @default(\"\")\n\n user User @relation(fields: [userId], references: [id], onDelete: Cascade)\n\n @@map(\"selenium_settings\")\n}\n"
+ "inlineSchema": "// This is your Prisma schema file,\n// learn more about it in the docs: https://pris.ly/d/prisma-schema\n\n// Looking for ways to speed up your queries, or scale easily with your serverless or edge functions?\n// Try Prisma Accelerate: https://pris.ly/cli/accelerate-init\n\ngenerator client {\n provider = \"prisma-client-js\"\n output = \"../generated/prisma\"\n}\n\ngenerator zod {\n provider = \"prisma-zod-generator\"\n output = \"../shared/\" // Zod schemas will be generated here inside `db/shared`\n}\n\ndatasource db {\n provider = \"postgresql\"\n}\n\nmodel User {\n id Int @id @default(autoincrement())\n username String @unique\n password String\n autoBackupEnabled Boolean @default(true)\n autoBackupHour Int @default(20)\n usbBackupEnabled Boolean @default(false)\n usbBackupHour Int @default(21)\n autoMhCheckEnabled Boolean @default(false)\n autoMhCheckDayOfWeek Int @default(1)\n autoMhCheckHour Int @default(13)\n patients Patient[]\n appointments Appointment[]\n staff Staff[]\n npiProviders NpiProvider[]\n claims Claim[]\n insuranceCredentials InsuranceCredential[]\n shoppingVendors ShoppingVendor[]\n updatedPayments Payment[] @relation(\"PaymentUpdatedBy\")\n backups DatabaseBackup[]\n backupDestinations BackupDestination[]\n notifications Notification[]\n cloudFolders CloudFolder[]\n cloudFiles CloudFile[]\n communications Communication[]\n twilioSettings TwilioSettings?\n telnyxSettings TelnyxSettings?\n aiSettings AiSettings?\n officeHours OfficeHours?\n officeContact OfficeContact?\n procedureTimeslot ProcedureTimeslot?\n insuranceContacts InsuranceContact[]\n patientConversations PatientConversation[]\n labRxTemplates LabRxTemplate[]\n seleniumSettings SeleniumSettings?\n}\n\nmodel Patient {\n id Int @id @default(autoincrement())\n firstName String\n lastName String\n dateOfBirth DateTime? @db.Date\n gender String\n phone String\n email String?\n address String?\n city String?\n state String? @default(\"MA\")\n zipCode String?\n insuranceProvider String?\n insuranceId String?\n groupNumber String?\n policyHolder String?\n policyHolderPatientId Int? // patient record of the policy holder, when picked from the DB\n policyHolderRelationship String? // ADA box 18: SELF | SPOUSE | DEPENDENT | OTHER\n allergies String?\n medicalConditions String?\n preferredLanguage String? @default(\"English\")\n status PatientStatus @default(UNKNOWN)\n remainingBenefit String?\n thirdPartyInsurance String?\n userId Int\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n user User @relation(fields: [userId], references: [id])\n appointments Appointment[]\n procedures AppointmentProcedure[]\n claims Claim[]\n groups PdfGroup[]\n payment Payment[]\n communications Communication[]\n documents PatientDocument[]\n conversation PatientConversation?\n cloudFolders CloudFolder[] @relation(\"PatientCloudFolder\")\n serviceHistory PatientServiceHistory[]\n preauthHistory PatientPreauthHistory[]\n\n @@index([insuranceId])\n @@index([createdAt])\n}\n\nenum PatientStatus {\n ACTIVE\n INACTIVE\n UNKNOWN\n PLAN_NOT_ACCEPTED\n}\n\nmodel Appointment {\n id Int @id @default(autoincrement())\n patientId Int\n userId Int\n staffId Int\n npiProviderId Int?\n title String\n date DateTime @db.Date\n startTime String // Store time as \"hh:mm\"\n endTime String // Store time as \"hh:mm\"\n type String // e.g., \"checkup\", \"cleaning\", \"filling\", etc.\n typeLocked Boolean @default(false) // true = user manually set; auto-sync will not overwrite\n notes String?\n procedureCodeNotes String?\n status String @default(\"scheduled\") // \"scheduled\", \"completed\", \"cancelled\", \"no-show\"\n movedByAi Boolean @default(false)\n createdAt DateTime @default(now())\n\n eligibilityStatus PatientStatus @default(UNKNOWN)\n\n patient Patient @relation(fields: [patientId], references: [id], onDelete: Cascade)\n user User @relation(fields: [userId], references: [id])\n staff Staff? @relation(fields: [staffId], references: [id])\n npiProvider NpiProvider? @relation(fields: [npiProviderId], references: [id])\n procedures AppointmentProcedure[]\n claims Claim[]\n files AppointmentFile[]\n\n @@index([patientId])\n @@index([date])\n}\n\nmodel AppointmentFile {\n id Int @id @default(autoincrement())\n appointmentId Int\n filename String\n mimeType String?\n filePath String?\n\n appointment Appointment @relation(fields: [appointmentId], references: [id], onDelete: Cascade)\n\n @@index([appointmentId])\n}\n\nmodel Staff {\n id Int @id @default(autoincrement())\n userId Int\n name String\n email String?\n role String // e.g., \"Dentist\", \"Hygienist\", \"Assistant\"\n phone String?\n createdAt DateTime @default(now())\n user User? @relation(fields: [userId], references: [id], onDelete: Cascade)\n appointments Appointment[]\n claims Claim[] @relation(\"ClaimStaff\")\n}\n\nmodel NpiProvider {\n id Int @id @default(autoincrement())\n userId Int\n npiNumber String\n providerName String\n /// State dental license (ADA claim form item 55)\n licenseNumber String?\n sortOrder Int @default(0)\n createdAt DateTime @default(now())\n\n user User @relation(fields: [userId], references: [id], onDelete: Cascade)\n claims Claim[]\n payments Payment[]\n commissionBatches CommissionBatch[]\n appointmentProcedures AppointmentProcedure[]\n appointments Appointment[]\n\n @@unique([userId, npiNumber])\n @@index([userId])\n}\n\nenum ProcedureSource {\n COMBO\n MANUAL\n}\n\nmodel AppointmentProcedure {\n id Int @id @default(autoincrement())\n appointmentId Int\n patientId Int\n npiProviderId Int?\n\n procedureCode String\n procedureLabel String?\n fee Decimal? @db.Decimal(10, 2)\n\n category String?\n\n toothNumber String?\n toothSurface String?\n oralCavityArea String?\n\n source ProcedureSource @default(MANUAL)\n comboKey String?\n\n createdAt DateTime @default(now())\n\n appointment Appointment @relation(fields: [appointmentId], references: [id], onDelete: Cascade)\n patient Patient @relation(fields: [patientId], references: [id], onDelete: Cascade)\n npiProvider NpiProvider? @relation(fields: [npiProviderId], references: [id])\n\n @@index([appointmentId])\n @@index([patientId])\n}\n\nmodel Claim {\n id Int @id @default(autoincrement())\n patientId Int\n /// @zod.number.int().nullable().optional()\n appointmentId Int?\n userId Int\n staffId Int\n patientName String\n memberId String\n dateOfBirth DateTime @db.Date\n remarks String\n missingTeethStatus MissingTeethStatus @default(No_missing)\n missingTeeth Json? // { \"T_14\": \"X\", \"T_G\": \"O\", ... }\n serviceDate DateTime\n insuranceProvider String // e.g., \"Delta MA\"\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n status ClaimStatus @default(PENDING)\n claimNumber String?\n preAuthNumber String?\n npiProviderId Int?\n\n patient Patient @relation(fields: [patientId], references: [id], onDelete: Cascade)\n appointment Appointment? @relation(fields: [appointmentId], references: [id], onDelete: Cascade)\n user User? @relation(fields: [userId], references: [id])\n staff Staff? @relation(\"ClaimStaff\", fields: [staffId], references: [id])\n npiProvider NpiProvider? @relation(fields: [npiProviderId], references: [id])\n\n serviceLines ServiceLine[]\n claimFiles ClaimFile[]\n payment Payment?\n}\n\nenum ClaimStatus {\n PENDING\n APPROVED\n CANCELLED\n REVIEW\n VOID\n PREAUTH\n DENIED\n}\n\nenum MissingTeethStatus {\n No_missing\n endentulous\n Yes_missing\n}\n\nmodel ServiceLine {\n id Int @id @default(autoincrement())\n claimId Int?\n paymentId Int?\n procedureCode String\n procedureDate DateTime @db.Date\n quad String?\n arch String?\n toothNumber String?\n toothSurface String?\n icn String?\n paidCode String?\n allowedAmount Decimal? @db.Decimal(10, 2)\n totalBilled Decimal @db.Decimal(10, 2)\n totalPaid Decimal @default(0.00) @db.Decimal(10, 2)\n totalAdjusted Decimal @default(0.00) @db.Decimal(10, 2)\n totalDue Decimal @default(0.00) @db.Decimal(10, 2)\n status ServiceLineStatus @default(UNPAID)\n\n claim Claim? @relation(fields: [claimId], references: [id], onDelete: Cascade)\n payment Payment? @relation(fields: [paymentId], references: [id], onDelete: Cascade)\n\n serviceLineTransactions ServiceLineTransaction[]\n}\n\nenum ServiceLineStatus {\n PENDING\n PARTIALLY_PAID\n PAID\n UNPAID\n ADJUSTED\n OVERPAID\n DENIED\n}\n\nmodel ClaimFile {\n id Int @id @default(autoincrement())\n claimId Int\n filename String\n mimeType String\n filePath String?\n\n claim Claim @relation(fields: [claimId], references: [id], onDelete: Cascade)\n}\n\nmodel InsuranceCredential {\n id Int @id @default(autoincrement())\n userId Int\n siteKey String\n username String\n password String\n\n user User @relation(fields: [userId], references: [id], onDelete: Cascade)\n\n @@unique([userId, siteKey])\n @@index([userId])\n}\n\nmodel ShoppingVendor {\n id Int @id @default(autoincrement())\n userId Int\n vendorName String\n websiteUrl String\n loginUsername String\n loginPassword String\n\n user User @relation(fields: [userId], references: [id], onDelete: Cascade)\n\n @@index([userId])\n}\n\nmodel PdfGroup {\n id Int @id @default(autoincrement())\n title String\n titleKey PdfTitleKey @default(OTHER)\n createdAt DateTime @default(now())\n patientId Int\n patient Patient @relation(fields: [patientId], references: [id], onDelete: Cascade)\n pdfs PdfFile[]\n\n @@index([patientId])\n @@index([titleKey])\n}\n\nmodel PdfFile {\n id Int @id @default(autoincrement())\n filename String\n pdfData Bytes\n uploadedAt DateTime @default(now())\n groupId Int\n group PdfGroup @relation(fields: [groupId], references: [id], onDelete: Cascade)\n\n @@index([groupId])\n}\n\nenum PdfTitleKey {\n INSURANCE_CLAIM\n INSURANCE_CLAIM_PREAUTH\n ELIGIBILITY_STATUS\n CLAIM_STATUS\n PREAUTH_APPROVAL\n OTHER\n}\n\nmodel Payment {\n id Int @id @default(autoincrement())\n claimId Int? @unique\n patientId Int\n userId Int\n updatedById Int?\n npiProviderId Int?\n totalBilled Decimal @db.Decimal(10, 2)\n totalPaid Decimal @default(0.00) @db.Decimal(10, 2)\n totalAdjusted Decimal @default(0.00) @db.Decimal(10, 2)\n totalDue Decimal @db.Decimal(10, 2)\n mhPaidAmount Decimal? @db.Decimal(10, 2)\n copayment Decimal @default(0.00) @db.Decimal(10, 2)\n adjustment Decimal @default(0.00) @db.Decimal(10, 2)\n status PaymentStatus @default(PENDING)\n notes String?\n icn String?\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n\n claim Claim? @relation(fields: [claimId], references: [id], onDelete: Cascade)\n patient Patient @relation(fields: [patientId], references: [id], onDelete: Cascade)\n updatedBy User? @relation(\"PaymentUpdatedBy\", fields: [updatedById], references: [id])\n npiProvider NpiProvider? @relation(fields: [npiProviderId], references: [id])\n serviceLineTransactions ServiceLineTransaction[]\n serviceLines ServiceLine[]\n commissionBatchItems CommissionBatchItem[]\n\n @@index([claimId])\n @@index([patientId])\n @@index([createdAt])\n}\n\nmodel ServiceLineTransaction {\n id Int @id @default(autoincrement())\n paymentId Int\n serviceLineId Int\n transactionId String?\n paidAmount Decimal @db.Decimal(10, 2)\n adjustedAmount Decimal @default(0.00) @db.Decimal(10, 2)\n method PaymentMethod\n receivedDate DateTime\n payerName String?\n notes String?\n createdAt DateTime @default(now())\n\n payment Payment @relation(fields: [paymentId], references: [id], onDelete: Cascade)\n serviceLine ServiceLine @relation(fields: [serviceLineId], references: [id], onDelete: Cascade)\n\n @@index([paymentId])\n @@index([serviceLineId])\n}\n\nenum PaymentStatus {\n PENDING\n PARTIALLY_PAID\n PAID\n OVERPAID\n DENIED\n VOID\n}\n\nenum PaymentMethod {\n EFT\n CHECK\n CASH\n CARD\n OTHER\n}\n\n// Database management page\nmodel DatabaseBackup {\n id Int @id @default(autoincrement())\n userId Int\n createdAt DateTime @default(now())\n\n user User @relation(fields: [userId], references: [id], onDelete: Cascade)\n\n @@index([userId])\n @@index([createdAt])\n}\n\nmodel BackupDestination {\n id Int @id @default(autoincrement())\n userId Int\n path String\n isActive Boolean @default(true)\n createdAt DateTime @default(now())\n\n user User @relation(fields: [userId], references: [id])\n}\n\nmodel Notification {\n id Int @id @default(autoincrement())\n userId Int\n type NotificationTypes\n message String\n createdAt DateTime @default(now())\n read Boolean @default(false)\n\n user User @relation(fields: [userId], references: [id], onDelete: Cascade)\n\n @@index([userId])\n @@index([createdAt])\n}\n\nenum NotificationTypes {\n BACKUP\n CLAIM\n PAYMENT\n ETC\n}\n\n// Cron job execution log\nmodel CronJobLog {\n id Int @id @default(autoincrement())\n jobName String // e.g. \"local-backup\", \"usb-backup\"\n status String // \"success\" | \"failed\" | \"skipped\"\n startedAt DateTime\n completedAt DateTime?\n durationMs Int?\n errorMessage String?\n\n @@index([jobName])\n @@index([startedAt])\n @@index([status])\n}\n\nmodel CloudFolder {\n id Int @id @default(autoincrement())\n userId Int\n name String\n parentId Int?\n patientId Int?\n parent CloudFolder? @relation(\"FolderChildren\", fields: [parentId], references: [id], onDelete: Cascade)\n children CloudFolder[] @relation(\"FolderChildren\")\n user User @relation(fields: [userId], references: [id])\n patient Patient? @relation(\"PatientCloudFolder\", fields: [patientId], references: [id], onDelete: SetNull)\n files CloudFile[]\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n\n @@unique([userId, parentId, name]) // prevents sibling folder name duplicates\n @@index([parentId])\n @@index([patientId])\n}\n\nmodel CloudFile {\n id Int @id @default(autoincrement())\n userId Int\n name String\n mimeType String?\n fileSize BigInt @db.BigInt\n folderId Int? // optional: null => root\n isComplete Boolean @default(false) // upload completed?\n totalChunks Int? // optional: expected number of chunks\n diskPath String? // relative path on disk under uploads/\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n user User @relation(fields: [userId], references: [id])\n folder CloudFolder? @relation(fields: [folderId], references: [id], onDelete: SetNull)\n\n chunks CloudFileChunk[]\n\n @@index([folderId])\n}\n\nmodel CloudFileChunk {\n id Int @id @default(autoincrement())\n fileId Int\n seq Int\n data Bytes\n createdAt DateTime @default(now())\n\n file CloudFile @relation(fields: [fileId], references: [id], onDelete: Cascade)\n\n @@unique([fileId, seq])\n @@index([fileId, seq])\n}\n\n// patient-connection-\nenum CommunicationChannel {\n sms\n voice\n}\n\nenum CommunicationDirection {\n outbound\n inbound\n}\n\nenum CommunicationStatus {\n queued\n sent\n delivered\n failed\n completed\n busy\n no_answer\n}\n\nenum CommunicationProvider {\n twilio\n telnyx\n}\n\nmodel Communication {\n id Int @id @default(autoincrement())\n patientId Int\n userId Int?\n\n channel CommunicationChannel\n direction CommunicationDirection\n status CommunicationStatus\n // Which platform produced twilioSid — twilio for dial-pad-originated calls,\n // telnyx for everything else (SMS, inbound/AI voice, staff-triggered outbound calls).\n provider CommunicationProvider @default(twilio)\n\n body String?\n callDuration Int?\n // Provider SID — Twilio MessageSid/CallSid, or Telnyx message/call id. See `provider`.\n twilioSid String?\n\n createdAt DateTime @default(now())\n\n // Relations\n patient Patient @relation(fields: [patientId], references: [id])\n user User? @relation(fields: [userId], references: [id])\n\n @@map(\"communications\")\n}\n\nmodel PatientDocument {\n id Int @id @default(autoincrement())\n patientId Int\n filename String\n originalName String\n mimeType String\n fileSize BigInt\n filePath String\n uploadedAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n patient Patient @relation(fields: [patientId], references: [id], onDelete: Cascade)\n\n @@index([patientId])\n @@index([uploadedAt])\n}\n\nmodel TwilioSettings {\n id Int @id @default(autoincrement())\n userId Int @unique\n accountSid String\n authToken String\n phoneNumber String\n // Vestigial — inbound voice moved to Telnyx (TelnyxSettings.greetingMessage). No longer\n // read/written; kept to avoid a destructive migration for a cosmetic cleanup.\n greetingMessage String?\n templates Json?\n\n user User @relation(fields: [userId], references: [id], onDelete: Cascade)\n\n @@map(\"twilio_settings\")\n}\n\nmodel TelnyxSettings {\n id Int @id @default(autoincrement())\n userId Int @unique\n apiKey String\n // Telnyx account SID (Mission Control Portal), required to place outbound\n // TeXML calls via POST /texml/Accounts/{accountSid}/Calls — separate from apiKey.\n accountSid String?\n phoneNumber String\n texmlApplicationId String?\n messagingProfileId String?\n webhookPublicKey String?\n greetingMessage String?\n\n user User @relation(fields: [userId], references: [id], onDelete: Cascade)\n\n @@map(\"telnyx_settings\")\n}\n\nmodel AiSettings {\n id Int @id @default(autoincrement())\n userId Int @unique\n apiKey String\n aiEnabled Boolean @default(true)\n openAiKey String @default(\"\")\n openAiEnabled Boolean @default(false)\n claudeAiKey String @default(\"\")\n claudeAiEnabled Boolean @default(false)\n claudeAiModel String @default(\"claude-haiku-4-5-20251001\")\n openAiModel String @default(\"gpt-5.2\")\n googleAiModel String @default(\"gemini-2.5-flash\")\n dentalMgmtKey String @default(\"\")\n dentalMgmtEnabled Boolean @default(false)\n afterHoursEnabled Boolean @default(true)\n openPhoneReply Boolean @default(false)\n\n user User @relation(fields: [userId], references: [id], onDelete: Cascade)\n\n @@map(\"ai_settings\")\n}\n\nmodel OfficeHours {\n id Int @id @default(autoincrement())\n userId Int @unique\n data Json\n\n user User @relation(fields: [userId], references: [id], onDelete: Cascade)\n\n @@map(\"office_hours\")\n}\n\nmodel OfficeContact {\n id Int @id @default(autoincrement())\n userId Int @unique\n /// Legal (registered) business name — ADA claim form items 48 and 56\n legalName String?\n /// Dental office name as the public knows it (DBA)\n officeName String?\n receptionistName String?\n dentistName String?\n phoneNumber String?\n email String?\n fax String?\n streetAddress String?\n city String?\n state String?\n zipCode String?\n /// Office (billing) NPI — ADA claim form items 48-51\n billingName String?\n billingNpi String?\n billingLicense String?\n billingTaxId String?\n\n user User @relation(fields: [userId], references: [id], onDelete: Cascade)\n\n @@map(\"office_contact\")\n}\n\nmodel InsuranceContact {\n id Int @id @default(autoincrement())\n userId Int\n name String\n phoneNumber String?\n createdAt DateTime @default(now())\n\n user User @relation(fields: [userId], references: [id], onDelete: Cascade)\n\n @@map(\"insurance_contact\")\n}\n\nmodel ProcedureTimeslot {\n id Int @id @default(autoincrement())\n userId Int @unique\n data Json\n\n user User @relation(fields: [userId], references: [id], onDelete: Cascade)\n\n @@map(\"procedure_timeslot\")\n}\n\nmodel PatientConversation {\n id Int @id @default(autoincrement())\n patientId Int @unique\n userId Int\n stage String @default(\"initial\")\n aiHandoff Boolean @default(true)\n updatedAt DateTime @updatedAt\n\n patient Patient @relation(fields: [patientId], references: [id], onDelete: Cascade)\n user User @relation(fields: [userId], references: [id], onDelete: Cascade)\n\n @@map(\"patient_conversation\")\n}\n\n// Snapshot of the MassHealth Service History table, replaced on each eligibility check\nmodel PatientServiceHistory {\n id Int @id @default(autoincrement())\n patientId Int\n procedureCode String\n description String?\n toothQuadArchSurface String?\n placeOfService String?\n serviceDate String? // as shown by the portal, e.g. 10/15/2026\n createdAt DateTime @default(now())\n\n patient Patient @relation(fields: [patientId], references: [id], onDelete: Cascade)\n\n @@index([patientId])\n @@map(\"patient_service_history\")\n}\n\n// Procedure lines of a pre-auth, read by Check PreAuth (Tufts SCO). Replaced per\n// pre-auth number on each check, so a patient keeps one set of lines per pre-auth.\nmodel PatientPreauthHistory {\n id Int @id @default(autoincrement())\n patientId Int\n preAuthNumber String\n submittedCode String\n toothQuadArchSurface String?\n paidAmount String? // \"Plan payment\" as shown by the portal, e.g. $564.00\n status String?\n createdAt DateTime @default(now())\n\n patient Patient @relation(fields: [patientId], references: [id], onDelete: Cascade)\n\n @@index([patientId])\n @@map(\"patient_preauth_history\")\n}\n\nmodel LabRxTemplate {\n id Int @id @default(autoincrement())\n userId Int\n name String\n labName String?\n labPhone String?\n labFax String?\n labAddress String?\n labAccount String?\n caseType String?\n material String?\n instructions String?\n sortOrder Int @default(0)\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n\n user User @relation(fields: [userId], references: [id], onDelete: Cascade)\n\n @@index([userId])\n @@map(\"lab_rx_template\")\n}\n\n// Commission tracking\nmodel CommissionBatch {\n id Int @id @default(autoincrement())\n npiProviderId Int\n totalCollection Decimal @db.Decimal(14, 2)\n commissionAmount Decimal @db.Decimal(14, 2)\n notes String?\n createdAt DateTime @default(now())\n\n npiProvider NpiProvider @relation(fields: [npiProviderId], references: [id])\n items CommissionBatchItem[]\n\n @@index([npiProviderId])\n}\n\nmodel CommissionBatchItem {\n id Int @id @default(autoincrement())\n commissionBatchId Int\n paymentId Int\n collectionAmount Decimal @db.Decimal(14, 2)\n\n commissionBatch CommissionBatch @relation(fields: [commissionBatchId], references: [id], onDelete: Cascade)\n payment Payment @relation(fields: [paymentId], references: [id])\n\n @@unique([commissionBatchId, paymentId])\n @@index([paymentId])\n}\n\nmodel SeleniumSettings {\n id Int @id @default(autoincrement())\n userId Int @unique\n paymentGroupId String @default(\"\")\n\n user User @relation(fields: [userId], references: [id], onDelete: Cascade)\n\n @@map(\"selenium_settings\")\n}\n"
}
config.runtimeDataModel = JSON.parse("{\"models\":{\"User\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"username\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"password\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"autoBackupEnabled\",\"kind\":\"scalar\",\"type\":\"Boolean\"},{\"name\":\"autoBackupHour\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"usbBackupEnabled\",\"kind\":\"scalar\",\"type\":\"Boolean\"},{\"name\":\"usbBackupHour\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"autoMhCheckEnabled\",\"kind\":\"scalar\",\"type\":\"Boolean\"},{\"name\":\"autoMhCheckDayOfWeek\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"autoMhCheckHour\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"patients\",\"kind\":\"object\",\"type\":\"Patient\",\"relationName\":\"PatientToUser\"},{\"name\":\"appointments\",\"kind\":\"object\",\"type\":\"Appointment\",\"relationName\":\"AppointmentToUser\"},{\"name\":\"staff\",\"kind\":\"object\",\"type\":\"Staff\",\"relationName\":\"StaffToUser\"},{\"name\":\"npiProviders\",\"kind\":\"object\",\"type\":\"NpiProvider\",\"relationName\":\"NpiProviderToUser\"},{\"name\":\"claims\",\"kind\":\"object\",\"type\":\"Claim\",\"relationName\":\"ClaimToUser\"},{\"name\":\"insuranceCredentials\",\"kind\":\"object\",\"type\":\"InsuranceCredential\",\"relationName\":\"InsuranceCredentialToUser\"},{\"name\":\"shoppingVendors\",\"kind\":\"object\",\"type\":\"ShoppingVendor\",\"relationName\":\"ShoppingVendorToUser\"},{\"name\":\"updatedPayments\",\"kind\":\"object\",\"type\":\"Payment\",\"relationName\":\"PaymentUpdatedBy\"},{\"name\":\"backups\",\"kind\":\"object\",\"type\":\"DatabaseBackup\",\"relationName\":\"DatabaseBackupToUser\"},{\"name\":\"backupDestinations\",\"kind\":\"object\",\"type\":\"BackupDestination\",\"relationName\":\"BackupDestinationToUser\"},{\"name\":\"notifications\",\"kind\":\"object\",\"type\":\"Notification\",\"relationName\":\"NotificationToUser\"},{\"name\":\"cloudFolders\",\"kind\":\"object\",\"type\":\"CloudFolder\",\"relationName\":\"CloudFolderToUser\"},{\"name\":\"cloudFiles\",\"kind\":\"object\",\"type\":\"CloudFile\",\"relationName\":\"CloudFileToUser\"},{\"name\":\"communications\",\"kind\":\"object\",\"type\":\"Communication\",\"relationName\":\"CommunicationToUser\"},{\"name\":\"twilioSettings\",\"kind\":\"object\",\"type\":\"TwilioSettings\",\"relationName\":\"TwilioSettingsToUser\"},{\"name\":\"telnyxSettings\",\"kind\":\"object\",\"type\":\"TelnyxSettings\",\"relationName\":\"TelnyxSettingsToUser\"},{\"name\":\"aiSettings\",\"kind\":\"object\",\"type\":\"AiSettings\",\"relationName\":\"AiSettingsToUser\"},{\"name\":\"officeHours\",\"kind\":\"object\",\"type\":\"OfficeHours\",\"relationName\":\"OfficeHoursToUser\"},{\"name\":\"officeContact\",\"kind\":\"object\",\"type\":\"OfficeContact\",\"relationName\":\"OfficeContactToUser\"},{\"name\":\"procedureTimeslot\",\"kind\":\"object\",\"type\":\"ProcedureTimeslot\",\"relationName\":\"ProcedureTimeslotToUser\"},{\"name\":\"insuranceContacts\",\"kind\":\"object\",\"type\":\"InsuranceContact\",\"relationName\":\"InsuranceContactToUser\"},{\"name\":\"patientConversations\",\"kind\":\"object\",\"type\":\"PatientConversation\",\"relationName\":\"PatientConversationToUser\"},{\"name\":\"labRxTemplates\",\"kind\":\"object\",\"type\":\"LabRxTemplate\",\"relationName\":\"LabRxTemplateToUser\"},{\"name\":\"seleniumSettings\",\"kind\":\"object\",\"type\":\"SeleniumSettings\",\"relationName\":\"SeleniumSettingsToUser\"}],\"dbName\":null},\"Patient\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"firstName\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"lastName\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"dateOfBirth\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"gender\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"phone\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"email\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"address\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"city\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"state\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"zipCode\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"insuranceProvider\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"insuranceId\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"groupNumber\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"policyHolder\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"policyHolderPatientId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"policyHolderRelationship\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"allergies\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"medicalConditions\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"preferredLanguage\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"status\",\"kind\":\"enum\",\"type\":\"PatientStatus\"},{\"name\":\"remainingBenefit\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"thirdPartyInsurance\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"userId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"user\",\"kind\":\"object\",\"type\":\"User\",\"relationName\":\"PatientToUser\"},{\"name\":\"appointments\",\"kind\":\"object\",\"type\":\"Appointment\",\"relationName\":\"AppointmentToPatient\"},{\"name\":\"procedures\",\"kind\":\"object\",\"type\":\"AppointmentProcedure\",\"relationName\":\"AppointmentProcedureToPatient\"},{\"name\":\"claims\",\"kind\":\"object\",\"type\":\"Claim\",\"relationName\":\"ClaimToPatient\"},{\"name\":\"groups\",\"kind\":\"object\",\"type\":\"PdfGroup\",\"relationName\":\"PatientToPdfGroup\"},{\"name\":\"payment\",\"kind\":\"object\",\"type\":\"Payment\",\"relationName\":\"PatientToPayment\"},{\"name\":\"communications\",\"kind\":\"object\",\"type\":\"Communication\",\"relationName\":\"CommunicationToPatient\"},{\"name\":\"documents\",\"kind\":\"object\",\"type\":\"PatientDocument\",\"relationName\":\"PatientToPatientDocument\"},{\"name\":\"conversation\",\"kind\":\"object\",\"type\":\"PatientConversation\",\"relationName\":\"PatientToPatientConversation\"},{\"name\":\"cloudFolders\",\"kind\":\"object\",\"type\":\"CloudFolder\",\"relationName\":\"PatientCloudFolder\"},{\"name\":\"serviceHistory\",\"kind\":\"object\",\"type\":\"PatientServiceHistory\",\"relationName\":\"PatientToPatientServiceHistory\"},{\"name\":\"preauthHistory\",\"kind\":\"object\",\"type\":\"PatientPreauthHistory\",\"relationName\":\"PatientToPatientPreauthHistory\"}],\"dbName\":null},\"Appointment\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"patientId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"userId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"staffId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"npiProviderId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"title\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"date\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"startTime\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"endTime\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"type\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"typeLocked\",\"kind\":\"scalar\",\"type\":\"Boolean\"},{\"name\":\"notes\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"procedureCodeNotes\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"status\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"movedByAi\",\"kind\":\"scalar\",\"type\":\"Boolean\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"eligibilityStatus\",\"kind\":\"enum\",\"type\":\"PatientStatus\"},{\"name\":\"patient\",\"kind\":\"object\",\"type\":\"Patient\",\"relationName\":\"AppointmentToPatient\"},{\"name\":\"user\",\"kind\":\"object\",\"type\":\"User\",\"relationName\":\"AppointmentToUser\"},{\"name\":\"staff\",\"kind\":\"object\",\"type\":\"Staff\",\"relationName\":\"AppointmentToStaff\"},{\"name\":\"npiProvider\",\"kind\":\"object\",\"type\":\"NpiProvider\",\"relationName\":\"AppointmentToNpiProvider\"},{\"name\":\"procedures\",\"kind\":\"object\",\"type\":\"AppointmentProcedure\",\"relationName\":\"AppointmentToAppointmentProcedure\"},{\"name\":\"claims\",\"kind\":\"object\",\"type\":\"Claim\",\"relationName\":\"AppointmentToClaim\"},{\"name\":\"files\",\"kind\":\"object\",\"type\":\"AppointmentFile\",\"relationName\":\"AppointmentToAppointmentFile\"}],\"dbName\":null},\"AppointmentFile\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"appointmentId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"filename\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"mimeType\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"filePath\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"appointment\",\"kind\":\"object\",\"type\":\"Appointment\",\"relationName\":\"AppointmentToAppointmentFile\"}],\"dbName\":null},\"Staff\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"userId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"name\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"email\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"role\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"phone\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"user\",\"kind\":\"object\",\"type\":\"User\",\"relationName\":\"StaffToUser\"},{\"name\":\"appointments\",\"kind\":\"object\",\"type\":\"Appointment\",\"relationName\":\"AppointmentToStaff\"},{\"name\":\"claims\",\"kind\":\"object\",\"type\":\"Claim\",\"relationName\":\"ClaimStaff\"}],\"dbName\":null},\"NpiProvider\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"userId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"npiNumber\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"providerName\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"licenseNumber\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"sortOrder\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"user\",\"kind\":\"object\",\"type\":\"User\",\"relationName\":\"NpiProviderToUser\"},{\"name\":\"claims\",\"kind\":\"object\",\"type\":\"Claim\",\"relationName\":\"ClaimToNpiProvider\"},{\"name\":\"payments\",\"kind\":\"object\",\"type\":\"Payment\",\"relationName\":\"NpiProviderToPayment\"},{\"name\":\"commissionBatches\",\"kind\":\"object\",\"type\":\"CommissionBatch\",\"relationName\":\"CommissionBatchToNpiProvider\"},{\"name\":\"appointmentProcedures\",\"kind\":\"object\",\"type\":\"AppointmentProcedure\",\"relationName\":\"AppointmentProcedureToNpiProvider\"},{\"name\":\"appointments\",\"kind\":\"object\",\"type\":\"Appointment\",\"relationName\":\"AppointmentToNpiProvider\"}],\"dbName\":null},\"AppointmentProcedure\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"appointmentId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"patientId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"npiProviderId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"procedureCode\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"procedureLabel\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"fee\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"category\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"toothNumber\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"toothSurface\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"oralCavityArea\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"source\",\"kind\":\"enum\",\"type\":\"ProcedureSource\"},{\"name\":\"comboKey\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"appointment\",\"kind\":\"object\",\"type\":\"Appointment\",\"relationName\":\"AppointmentToAppointmentProcedure\"},{\"name\":\"patient\",\"kind\":\"object\",\"type\":\"Patient\",\"relationName\":\"AppointmentProcedureToPatient\"},{\"name\":\"npiProvider\",\"kind\":\"object\",\"type\":\"NpiProvider\",\"relationName\":\"AppointmentProcedureToNpiProvider\"}],\"dbName\":null},\"Claim\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"patientId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"appointmentId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"userId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"staffId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"patientName\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"memberId\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"dateOfBirth\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"remarks\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"missingTeethStatus\",\"kind\":\"enum\",\"type\":\"MissingTeethStatus\"},{\"name\":\"missingTeeth\",\"kind\":\"scalar\",\"type\":\"Json\"},{\"name\":\"serviceDate\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"insuranceProvider\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"status\",\"kind\":\"enum\",\"type\":\"ClaimStatus\"},{\"name\":\"claimNumber\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"preAuthNumber\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"npiProviderId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"patient\",\"kind\":\"object\",\"type\":\"Patient\",\"relationName\":\"ClaimToPatient\"},{\"name\":\"appointment\",\"kind\":\"object\",\"type\":\"Appointment\",\"relationName\":\"AppointmentToClaim\"},{\"name\":\"user\",\"kind\":\"object\",\"type\":\"User\",\"relationName\":\"ClaimToUser\"},{\"name\":\"staff\",\"kind\":\"object\",\"type\":\"Staff\",\"relationName\":\"ClaimStaff\"},{\"name\":\"npiProvider\",\"kind\":\"object\",\"type\":\"NpiProvider\",\"relationName\":\"ClaimToNpiProvider\"},{\"name\":\"serviceLines\",\"kind\":\"object\",\"type\":\"ServiceLine\",\"relationName\":\"ClaimToServiceLine\"},{\"name\":\"claimFiles\",\"kind\":\"object\",\"type\":\"ClaimFile\",\"relationName\":\"ClaimToClaimFile\"},{\"name\":\"payment\",\"kind\":\"object\",\"type\":\"Payment\",\"relationName\":\"ClaimToPayment\"}],\"dbName\":null},\"ServiceLine\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"claimId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"paymentId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"procedureCode\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"procedureDate\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"quad\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"arch\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"toothNumber\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"toothSurface\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"icn\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"paidCode\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"allowedAmount\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"totalBilled\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"totalPaid\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"totalAdjusted\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"totalDue\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"status\",\"kind\":\"enum\",\"type\":\"ServiceLineStatus\"},{\"name\":\"claim\",\"kind\":\"object\",\"type\":\"Claim\",\"relationName\":\"ClaimToServiceLine\"},{\"name\":\"payment\",\"kind\":\"object\",\"type\":\"Payment\",\"relationName\":\"PaymentToServiceLine\"},{\"name\":\"serviceLineTransactions\",\"kind\":\"object\",\"type\":\"ServiceLineTransaction\",\"relationName\":\"ServiceLineToServiceLineTransaction\"}],\"dbName\":null},\"ClaimFile\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"claimId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"filename\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"mimeType\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"filePath\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"claim\",\"kind\":\"object\",\"type\":\"Claim\",\"relationName\":\"ClaimToClaimFile\"}],\"dbName\":null},\"InsuranceCredential\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"userId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"siteKey\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"username\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"password\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"user\",\"kind\":\"object\",\"type\":\"User\",\"relationName\":\"InsuranceCredentialToUser\"}],\"dbName\":null},\"ShoppingVendor\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"userId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"vendorName\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"websiteUrl\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"loginUsername\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"loginPassword\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"user\",\"kind\":\"object\",\"type\":\"User\",\"relationName\":\"ShoppingVendorToUser\"}],\"dbName\":null},\"PdfGroup\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"title\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"titleKey\",\"kind\":\"enum\",\"type\":\"PdfTitleKey\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"patientId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"patient\",\"kind\":\"object\",\"type\":\"Patient\",\"relationName\":\"PatientToPdfGroup\"},{\"name\":\"pdfs\",\"kind\":\"object\",\"type\":\"PdfFile\",\"relationName\":\"PdfFileToPdfGroup\"}],\"dbName\":null},\"PdfFile\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"filename\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"pdfData\",\"kind\":\"scalar\",\"type\":\"Bytes\"},{\"name\":\"uploadedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"groupId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"group\",\"kind\":\"object\",\"type\":\"PdfGroup\",\"relationName\":\"PdfFileToPdfGroup\"}],\"dbName\":null},\"Payment\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"claimId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"patientId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"userId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"updatedById\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"npiProviderId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"totalBilled\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"totalPaid\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"totalAdjusted\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"totalDue\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"mhPaidAmount\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"copayment\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"adjustment\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"status\",\"kind\":\"enum\",\"type\":\"PaymentStatus\"},{\"name\":\"notes\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"icn\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"claim\",\"kind\":\"object\",\"type\":\"Claim\",\"relationName\":\"ClaimToPayment\"},{\"name\":\"patient\",\"kind\":\"object\",\"type\":\"Patient\",\"relationName\":\"PatientToPayment\"},{\"name\":\"updatedBy\",\"kind\":\"object\",\"type\":\"User\",\"relationName\":\"PaymentUpdatedBy\"},{\"name\":\"npiProvider\",\"kind\":\"object\",\"type\":\"NpiProvider\",\"relationName\":\"NpiProviderToPayment\"},{\"name\":\"serviceLineTransactions\",\"kind\":\"object\",\"type\":\"ServiceLineTransaction\",\"relationName\":\"PaymentToServiceLineTransaction\"},{\"name\":\"serviceLines\",\"kind\":\"object\",\"type\":\"ServiceLine\",\"relationName\":\"PaymentToServiceLine\"},{\"name\":\"commissionBatchItems\",\"kind\":\"object\",\"type\":\"CommissionBatchItem\",\"relationName\":\"CommissionBatchItemToPayment\"}],\"dbName\":null},\"ServiceLineTransaction\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"paymentId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"serviceLineId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"transactionId\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"paidAmount\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"adjustedAmount\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"method\",\"kind\":\"enum\",\"type\":\"PaymentMethod\"},{\"name\":\"receivedDate\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"payerName\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"notes\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"payment\",\"kind\":\"object\",\"type\":\"Payment\",\"relationName\":\"PaymentToServiceLineTransaction\"},{\"name\":\"serviceLine\",\"kind\":\"object\",\"type\":\"ServiceLine\",\"relationName\":\"ServiceLineToServiceLineTransaction\"}],\"dbName\":null},\"DatabaseBackup\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"userId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"user\",\"kind\":\"object\",\"type\":\"User\",\"relationName\":\"DatabaseBackupToUser\"}],\"dbName\":null},\"BackupDestination\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"userId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"path\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"isActive\",\"kind\":\"scalar\",\"type\":\"Boolean\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"user\",\"kind\":\"object\",\"type\":\"User\",\"relationName\":\"BackupDestinationToUser\"}],\"dbName\":null},\"Notification\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"userId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"type\",\"kind\":\"enum\",\"type\":\"NotificationTypes\"},{\"name\":\"message\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"read\",\"kind\":\"scalar\",\"type\":\"Boolean\"},{\"name\":\"user\",\"kind\":\"object\",\"type\":\"User\",\"relationName\":\"NotificationToUser\"}],\"dbName\":null},\"CronJobLog\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"jobName\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"status\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"startedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"completedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"durationMs\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"errorMessage\",\"kind\":\"scalar\",\"type\":\"String\"}],\"dbName\":null},\"CloudFolder\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"userId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"name\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"parentId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"patientId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"parent\",\"kind\":\"object\",\"type\":\"CloudFolder\",\"relationName\":\"FolderChildren\"},{\"name\":\"children\",\"kind\":\"object\",\"type\":\"CloudFolder\",\"relationName\":\"FolderChildren\"},{\"name\":\"user\",\"kind\":\"object\",\"type\":\"User\",\"relationName\":\"CloudFolderToUser\"},{\"name\":\"patient\",\"kind\":\"object\",\"type\":\"Patient\",\"relationName\":\"PatientCloudFolder\"},{\"name\":\"files\",\"kind\":\"object\",\"type\":\"CloudFile\",\"relationName\":\"CloudFileToCloudFolder\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"}],\"dbName\":null},\"CloudFile\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"userId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"name\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"mimeType\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"fileSize\",\"kind\":\"scalar\",\"type\":\"BigInt\"},{\"name\":\"folderId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"isComplete\",\"kind\":\"scalar\",\"type\":\"Boolean\"},{\"name\":\"totalChunks\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"diskPath\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"user\",\"kind\":\"object\",\"type\":\"User\",\"relationName\":\"CloudFileToUser\"},{\"name\":\"folder\",\"kind\":\"object\",\"type\":\"CloudFolder\",\"relationName\":\"CloudFileToCloudFolder\"},{\"name\":\"chunks\",\"kind\":\"object\",\"type\":\"CloudFileChunk\",\"relationName\":\"CloudFileToCloudFileChunk\"}],\"dbName\":null},\"CloudFileChunk\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"fileId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"seq\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"data\",\"kind\":\"scalar\",\"type\":\"Bytes\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"file\",\"kind\":\"object\",\"type\":\"CloudFile\",\"relationName\":\"CloudFileToCloudFileChunk\"}],\"dbName\":null},\"Communication\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"patientId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"userId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"channel\",\"kind\":\"enum\",\"type\":\"CommunicationChannel\"},{\"name\":\"direction\",\"kind\":\"enum\",\"type\":\"CommunicationDirection\"},{\"name\":\"status\",\"kind\":\"enum\",\"type\":\"CommunicationStatus\"},{\"name\":\"provider\",\"kind\":\"enum\",\"type\":\"CommunicationProvider\"},{\"name\":\"body\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"callDuration\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"twilioSid\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"patient\",\"kind\":\"object\",\"type\":\"Patient\",\"relationName\":\"CommunicationToPatient\"},{\"name\":\"user\",\"kind\":\"object\",\"type\":\"User\",\"relationName\":\"CommunicationToUser\"}],\"dbName\":\"communications\"},\"PatientDocument\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"patientId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"filename\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"originalName\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"mimeType\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"fileSize\",\"kind\":\"scalar\",\"type\":\"BigInt\"},{\"name\":\"filePath\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"uploadedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"patient\",\"kind\":\"object\",\"type\":\"Patient\",\"relationName\":\"PatientToPatientDocument\"}],\"dbName\":null},\"TwilioSettings\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"userId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"accountSid\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"authToken\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"phoneNumber\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"greetingMessage\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"templates\",\"kind\":\"scalar\",\"type\":\"Json\"},{\"name\":\"user\",\"kind\":\"object\",\"type\":\"User\",\"relationName\":\"TwilioSettingsToUser\"}],\"dbName\":\"twilio_settings\"},\"TelnyxSettings\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"userId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"apiKey\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"accountSid\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"phoneNumber\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"texmlApplicationId\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"messagingProfileId\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"webhookPublicKey\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"greetingMessage\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"user\",\"kind\":\"object\",\"type\":\"User\",\"relationName\":\"TelnyxSettingsToUser\"}],\"dbName\":\"telnyx_settings\"},\"AiSettings\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"userId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"apiKey\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"aiEnabled\",\"kind\":\"scalar\",\"type\":\"Boolean\"},{\"name\":\"openAiKey\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"openAiEnabled\",\"kind\":\"scalar\",\"type\":\"Boolean\"},{\"name\":\"claudeAiKey\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"claudeAiEnabled\",\"kind\":\"scalar\",\"type\":\"Boolean\"},{\"name\":\"claudeAiModel\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"openAiModel\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"googleAiModel\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"dentalMgmtKey\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"dentalMgmtEnabled\",\"kind\":\"scalar\",\"type\":\"Boolean\"},{\"name\":\"afterHoursEnabled\",\"kind\":\"scalar\",\"type\":\"Boolean\"},{\"name\":\"openPhoneReply\",\"kind\":\"scalar\",\"type\":\"Boolean\"},{\"name\":\"user\",\"kind\":\"object\",\"type\":\"User\",\"relationName\":\"AiSettingsToUser\"}],\"dbName\":\"ai_settings\"},\"OfficeHours\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"userId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"data\",\"kind\":\"scalar\",\"type\":\"Json\"},{\"name\":\"user\",\"kind\":\"object\",\"type\":\"User\",\"relationName\":\"OfficeHoursToUser\"}],\"dbName\":\"office_hours\"},\"OfficeContact\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"userId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"legalName\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"officeName\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"receptionistName\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"dentistName\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"phoneNumber\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"email\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"fax\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"streetAddress\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"city\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"state\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"zipCode\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"billingName\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"billingNpi\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"billingLicense\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"billingTaxId\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"user\",\"kind\":\"object\",\"type\":\"User\",\"relationName\":\"OfficeContactToUser\"}],\"dbName\":\"office_contact\"},\"InsuranceContact\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"userId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"name\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"phoneNumber\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"user\",\"kind\":\"object\",\"type\":\"User\",\"relationName\":\"InsuranceContactToUser\"}],\"dbName\":\"insurance_contact\"},\"ProcedureTimeslot\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"userId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"data\",\"kind\":\"scalar\",\"type\":\"Json\"},{\"name\":\"user\",\"kind\":\"object\",\"type\":\"User\",\"relationName\":\"ProcedureTimeslotToUser\"}],\"dbName\":\"procedure_timeslot\"},\"PatientConversation\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"patientId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"userId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"stage\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"aiHandoff\",\"kind\":\"scalar\",\"type\":\"Boolean\"},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"patient\",\"kind\":\"object\",\"type\":\"Patient\",\"relationName\":\"PatientToPatientConversation\"},{\"name\":\"user\",\"kind\":\"object\",\"type\":\"User\",\"relationName\":\"PatientConversationToUser\"}],\"dbName\":\"patient_conversation\"},\"PatientServiceHistory\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"patientId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"procedureCode\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"description\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"toothQuadArchSurface\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"placeOfService\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"serviceDate\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"patient\",\"kind\":\"object\",\"type\":\"Patient\",\"relationName\":\"PatientToPatientServiceHistory\"}],\"dbName\":\"patient_service_history\"},\"PatientPreauthHistory\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"patientId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"preAuthNumber\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"submittedCode\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"toothQuadArchSurface\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"paidAmount\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"status\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"patient\",\"kind\":\"object\",\"type\":\"Patient\",\"relationName\":\"PatientToPatientPreauthHistory\"}],\"dbName\":\"patient_preauth_history\"},\"LabRxTemplate\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"userId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"name\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"labName\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"labPhone\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"labFax\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"labAddress\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"labAccount\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"caseType\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"material\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"instructions\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"sortOrder\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"user\",\"kind\":\"object\",\"type\":\"User\",\"relationName\":\"LabRxTemplateToUser\"}],\"dbName\":\"lab_rx_template\"},\"CommissionBatch\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"npiProviderId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"totalCollection\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"commissionAmount\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"notes\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"npiProvider\",\"kind\":\"object\",\"type\":\"NpiProvider\",\"relationName\":\"CommissionBatchToNpiProvider\"},{\"name\":\"items\",\"kind\":\"object\",\"type\":\"CommissionBatchItem\",\"relationName\":\"CommissionBatchToCommissionBatchItem\"}],\"dbName\":null},\"CommissionBatchItem\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"commissionBatchId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"paymentId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"collectionAmount\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"commissionBatch\",\"kind\":\"object\",\"type\":\"CommissionBatch\",\"relationName\":\"CommissionBatchToCommissionBatchItem\"},{\"name\":\"payment\",\"kind\":\"object\",\"type\":\"Payment\",\"relationName\":\"CommissionBatchItemToPayment\"}],\"dbName\":null},\"SeleniumSettings\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"userId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"paymentGroupId\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"user\",\"kind\":\"object\",\"type\":\"User\",\"relationName\":\"SeleniumSettingsToUser\"}],\"dbName\":\"selenium_settings\"}},\"enums\":{},\"types\":{}}")
diff --git a/packages/db/generated/prisma/index-browser.js b/packages/db/generated/prisma/index-browser.js
index e8cea936..1d0f54e9 100644
--- a/packages/db/generated/prisma/index-browser.js
+++ b/packages/db/generated/prisma/index-browser.js
@@ -639,7 +639,8 @@ exports.ClaimStatus = exports.$Enums.ClaimStatus = {
CANCELLED: 'CANCELLED',
REVIEW: 'REVIEW',
VOID: 'VOID',
- PREAUTH: 'PREAUTH'
+ PREAUTH: 'PREAUTH',
+ DENIED: 'DENIED'
};
exports.ServiceLineStatus = exports.$Enums.ServiceLineStatus = {
diff --git a/packages/db/generated/prisma/index.d.ts b/packages/db/generated/prisma/index.d.ts
index 90401373..224777cd 100644
--- a/packages/db/generated/prisma/index.d.ts
+++ b/packages/db/generated/prisma/index.d.ts
@@ -237,7 +237,8 @@ export const ClaimStatus: {
CANCELLED: 'CANCELLED',
REVIEW: 'REVIEW',
VOID: 'VOID',
- PREAUTH: 'PREAUTH'
+ PREAUTH: 'PREAUTH',
+ DENIED: 'DENIED'
};
export type ClaimStatus = (typeof ClaimStatus)[keyof typeof ClaimStatus]
diff --git a/packages/db/generated/prisma/index.js b/packages/db/generated/prisma/index.js
index f0354c64..a28d62a9 100644
--- a/packages/db/generated/prisma/index.js
+++ b/packages/db/generated/prisma/index.js
@@ -606,7 +606,8 @@ exports.ClaimStatus = exports.$Enums.ClaimStatus = {
CANCELLED: 'CANCELLED',
REVIEW: 'REVIEW',
VOID: 'VOID',
- PREAUTH: 'PREAUTH'
+ PREAUTH: 'PREAUTH',
+ DENIED: 'DENIED'
};
exports.MissingTeethStatus = exports.$Enums.MissingTeethStatus = {
@@ -732,7 +733,7 @@ const config = {
"clientVersion": "7.4.1",
"engineVersion": "55ae170b1ced7fc6ed07a15f110549408c501bb3",
"activeProvider": "postgresql",
- "inlineSchema": "// This is your Prisma schema file,\n// learn more about it in the docs: https://pris.ly/d/prisma-schema\n\n// Looking for ways to speed up your queries, or scale easily with your serverless or edge functions?\n// Try Prisma Accelerate: https://pris.ly/cli/accelerate-init\n\ngenerator client {\n provider = \"prisma-client-js\"\n output = \"../generated/prisma\"\n}\n\ngenerator zod {\n provider = \"prisma-zod-generator\"\n output = \"../shared/\" // Zod schemas will be generated here inside `db/shared`\n}\n\ndatasource db {\n provider = \"postgresql\"\n}\n\nmodel User {\n id Int @id @default(autoincrement())\n username String @unique\n password String\n autoBackupEnabled Boolean @default(true)\n autoBackupHour Int @default(20)\n usbBackupEnabled Boolean @default(false)\n usbBackupHour Int @default(21)\n autoMhCheckEnabled Boolean @default(false)\n autoMhCheckDayOfWeek Int @default(1)\n autoMhCheckHour Int @default(13)\n patients Patient[]\n appointments Appointment[]\n staff Staff[]\n npiProviders NpiProvider[]\n claims Claim[]\n insuranceCredentials InsuranceCredential[]\n shoppingVendors ShoppingVendor[]\n updatedPayments Payment[] @relation(\"PaymentUpdatedBy\")\n backups DatabaseBackup[]\n backupDestinations BackupDestination[]\n notifications Notification[]\n cloudFolders CloudFolder[]\n cloudFiles CloudFile[]\n communications Communication[]\n twilioSettings TwilioSettings?\n telnyxSettings TelnyxSettings?\n aiSettings AiSettings?\n officeHours OfficeHours?\n officeContact OfficeContact?\n procedureTimeslot ProcedureTimeslot?\n insuranceContacts InsuranceContact[]\n patientConversations PatientConversation[]\n labRxTemplates LabRxTemplate[]\n seleniumSettings SeleniumSettings?\n}\n\nmodel Patient {\n id Int @id @default(autoincrement())\n firstName String\n lastName String\n dateOfBirth DateTime? @db.Date\n gender String\n phone String\n email String?\n address String?\n city String?\n state String? @default(\"MA\")\n zipCode String?\n insuranceProvider String?\n insuranceId String?\n groupNumber String?\n policyHolder String?\n policyHolderPatientId Int? // patient record of the policy holder, when picked from the DB\n policyHolderRelationship String? // ADA box 18: SELF | SPOUSE | DEPENDENT | OTHER\n allergies String?\n medicalConditions String?\n preferredLanguage String? @default(\"English\")\n status PatientStatus @default(UNKNOWN)\n remainingBenefit String?\n thirdPartyInsurance String?\n userId Int\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n user User @relation(fields: [userId], references: [id])\n appointments Appointment[]\n procedures AppointmentProcedure[]\n claims Claim[]\n groups PdfGroup[]\n payment Payment[]\n communications Communication[]\n documents PatientDocument[]\n conversation PatientConversation?\n cloudFolders CloudFolder[] @relation(\"PatientCloudFolder\")\n serviceHistory PatientServiceHistory[]\n preauthHistory PatientPreauthHistory[]\n\n @@index([insuranceId])\n @@index([createdAt])\n}\n\nenum PatientStatus {\n ACTIVE\n INACTIVE\n UNKNOWN\n PLAN_NOT_ACCEPTED\n}\n\nmodel Appointment {\n id Int @id @default(autoincrement())\n patientId Int\n userId Int\n staffId Int\n npiProviderId Int?\n title String\n date DateTime @db.Date\n startTime String // Store time as \"hh:mm\"\n endTime String // Store time as \"hh:mm\"\n type String // e.g., \"checkup\", \"cleaning\", \"filling\", etc.\n typeLocked Boolean @default(false) // true = user manually set; auto-sync will not overwrite\n notes String?\n procedureCodeNotes String?\n status String @default(\"scheduled\") // \"scheduled\", \"completed\", \"cancelled\", \"no-show\"\n movedByAi Boolean @default(false)\n createdAt DateTime @default(now())\n\n eligibilityStatus PatientStatus @default(UNKNOWN)\n\n patient Patient @relation(fields: [patientId], references: [id], onDelete: Cascade)\n user User @relation(fields: [userId], references: [id])\n staff Staff? @relation(fields: [staffId], references: [id])\n npiProvider NpiProvider? @relation(fields: [npiProviderId], references: [id])\n procedures AppointmentProcedure[]\n claims Claim[]\n files AppointmentFile[]\n\n @@index([patientId])\n @@index([date])\n}\n\nmodel AppointmentFile {\n id Int @id @default(autoincrement())\n appointmentId Int\n filename String\n mimeType String?\n filePath String?\n\n appointment Appointment @relation(fields: [appointmentId], references: [id], onDelete: Cascade)\n\n @@index([appointmentId])\n}\n\nmodel Staff {\n id Int @id @default(autoincrement())\n userId Int\n name String\n email String?\n role String // e.g., \"Dentist\", \"Hygienist\", \"Assistant\"\n phone String?\n createdAt DateTime @default(now())\n user User? @relation(fields: [userId], references: [id], onDelete: Cascade)\n appointments Appointment[]\n claims Claim[] @relation(\"ClaimStaff\")\n}\n\nmodel NpiProvider {\n id Int @id @default(autoincrement())\n userId Int\n npiNumber String\n providerName String\n /// State dental license (ADA claim form item 55)\n licenseNumber String?\n sortOrder Int @default(0)\n createdAt DateTime @default(now())\n\n user User @relation(fields: [userId], references: [id], onDelete: Cascade)\n claims Claim[]\n payments Payment[]\n commissionBatches CommissionBatch[]\n appointmentProcedures AppointmentProcedure[]\n appointments Appointment[]\n\n @@unique([userId, npiNumber])\n @@index([userId])\n}\n\nenum ProcedureSource {\n COMBO\n MANUAL\n}\n\nmodel AppointmentProcedure {\n id Int @id @default(autoincrement())\n appointmentId Int\n patientId Int\n npiProviderId Int?\n\n procedureCode String\n procedureLabel String?\n fee Decimal? @db.Decimal(10, 2)\n\n category String?\n\n toothNumber String?\n toothSurface String?\n oralCavityArea String?\n\n source ProcedureSource @default(MANUAL)\n comboKey String?\n\n createdAt DateTime @default(now())\n\n appointment Appointment @relation(fields: [appointmentId], references: [id], onDelete: Cascade)\n patient Patient @relation(fields: [patientId], references: [id], onDelete: Cascade)\n npiProvider NpiProvider? @relation(fields: [npiProviderId], references: [id])\n\n @@index([appointmentId])\n @@index([patientId])\n}\n\nmodel Claim {\n id Int @id @default(autoincrement())\n patientId Int\n /// @zod.number.int().nullable().optional()\n appointmentId Int?\n userId Int\n staffId Int\n patientName String\n memberId String\n dateOfBirth DateTime @db.Date\n remarks String\n missingTeethStatus MissingTeethStatus @default(No_missing)\n missingTeeth Json? // { \"T_14\": \"X\", \"T_G\": \"O\", ... }\n serviceDate DateTime\n insuranceProvider String // e.g., \"Delta MA\"\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n status ClaimStatus @default(PENDING)\n claimNumber String?\n preAuthNumber String?\n npiProviderId Int?\n\n patient Patient @relation(fields: [patientId], references: [id], onDelete: Cascade)\n appointment Appointment? @relation(fields: [appointmentId], references: [id], onDelete: Cascade)\n user User? @relation(fields: [userId], references: [id])\n staff Staff? @relation(\"ClaimStaff\", fields: [staffId], references: [id])\n npiProvider NpiProvider? @relation(fields: [npiProviderId], references: [id])\n\n serviceLines ServiceLine[]\n claimFiles ClaimFile[]\n payment Payment?\n}\n\nenum ClaimStatus {\n PENDING\n APPROVED\n CANCELLED\n REVIEW\n VOID\n PREAUTH\n}\n\nenum MissingTeethStatus {\n No_missing\n endentulous\n Yes_missing\n}\n\nmodel ServiceLine {\n id Int @id @default(autoincrement())\n claimId Int?\n paymentId Int?\n procedureCode String\n procedureDate DateTime @db.Date\n quad String?\n arch String?\n toothNumber String?\n toothSurface String?\n icn String?\n paidCode String?\n allowedAmount Decimal? @db.Decimal(10, 2)\n totalBilled Decimal @db.Decimal(10, 2)\n totalPaid Decimal @default(0.00) @db.Decimal(10, 2)\n totalAdjusted Decimal @default(0.00) @db.Decimal(10, 2)\n totalDue Decimal @default(0.00) @db.Decimal(10, 2)\n status ServiceLineStatus @default(UNPAID)\n\n claim Claim? @relation(fields: [claimId], references: [id], onDelete: Cascade)\n payment Payment? @relation(fields: [paymentId], references: [id], onDelete: Cascade)\n\n serviceLineTransactions ServiceLineTransaction[]\n}\n\nenum ServiceLineStatus {\n PENDING\n PARTIALLY_PAID\n PAID\n UNPAID\n ADJUSTED\n OVERPAID\n DENIED\n}\n\nmodel ClaimFile {\n id Int @id @default(autoincrement())\n claimId Int\n filename String\n mimeType String\n filePath String?\n\n claim Claim @relation(fields: [claimId], references: [id], onDelete: Cascade)\n}\n\nmodel InsuranceCredential {\n id Int @id @default(autoincrement())\n userId Int\n siteKey String\n username String\n password String\n\n user User @relation(fields: [userId], references: [id], onDelete: Cascade)\n\n @@unique([userId, siteKey])\n @@index([userId])\n}\n\nmodel ShoppingVendor {\n id Int @id @default(autoincrement())\n userId Int\n vendorName String\n websiteUrl String\n loginUsername String\n loginPassword String\n\n user User @relation(fields: [userId], references: [id], onDelete: Cascade)\n\n @@index([userId])\n}\n\nmodel PdfGroup {\n id Int @id @default(autoincrement())\n title String\n titleKey PdfTitleKey @default(OTHER)\n createdAt DateTime @default(now())\n patientId Int\n patient Patient @relation(fields: [patientId], references: [id], onDelete: Cascade)\n pdfs PdfFile[]\n\n @@index([patientId])\n @@index([titleKey])\n}\n\nmodel PdfFile {\n id Int @id @default(autoincrement())\n filename String\n pdfData Bytes\n uploadedAt DateTime @default(now())\n groupId Int\n group PdfGroup @relation(fields: [groupId], references: [id], onDelete: Cascade)\n\n @@index([groupId])\n}\n\nenum PdfTitleKey {\n INSURANCE_CLAIM\n INSURANCE_CLAIM_PREAUTH\n ELIGIBILITY_STATUS\n CLAIM_STATUS\n PREAUTH_APPROVAL\n OTHER\n}\n\nmodel Payment {\n id Int @id @default(autoincrement())\n claimId Int? @unique\n patientId Int\n userId Int\n updatedById Int?\n npiProviderId Int?\n totalBilled Decimal @db.Decimal(10, 2)\n totalPaid Decimal @default(0.00) @db.Decimal(10, 2)\n totalAdjusted Decimal @default(0.00) @db.Decimal(10, 2)\n totalDue Decimal @db.Decimal(10, 2)\n mhPaidAmount Decimal? @db.Decimal(10, 2)\n copayment Decimal @default(0.00) @db.Decimal(10, 2)\n adjustment Decimal @default(0.00) @db.Decimal(10, 2)\n status PaymentStatus @default(PENDING)\n notes String?\n icn String?\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n\n claim Claim? @relation(fields: [claimId], references: [id], onDelete: Cascade)\n patient Patient @relation(fields: [patientId], references: [id], onDelete: Cascade)\n updatedBy User? @relation(\"PaymentUpdatedBy\", fields: [updatedById], references: [id])\n npiProvider NpiProvider? @relation(fields: [npiProviderId], references: [id])\n serviceLineTransactions ServiceLineTransaction[]\n serviceLines ServiceLine[]\n commissionBatchItems CommissionBatchItem[]\n\n @@index([claimId])\n @@index([patientId])\n @@index([createdAt])\n}\n\nmodel ServiceLineTransaction {\n id Int @id @default(autoincrement())\n paymentId Int\n serviceLineId Int\n transactionId String?\n paidAmount Decimal @db.Decimal(10, 2)\n adjustedAmount Decimal @default(0.00) @db.Decimal(10, 2)\n method PaymentMethod\n receivedDate DateTime\n payerName String?\n notes String?\n createdAt DateTime @default(now())\n\n payment Payment @relation(fields: [paymentId], references: [id], onDelete: Cascade)\n serviceLine ServiceLine @relation(fields: [serviceLineId], references: [id], onDelete: Cascade)\n\n @@index([paymentId])\n @@index([serviceLineId])\n}\n\nenum PaymentStatus {\n PENDING\n PARTIALLY_PAID\n PAID\n OVERPAID\n DENIED\n VOID\n}\n\nenum PaymentMethod {\n EFT\n CHECK\n CASH\n CARD\n OTHER\n}\n\n// Database management page\nmodel DatabaseBackup {\n id Int @id @default(autoincrement())\n userId Int\n createdAt DateTime @default(now())\n\n user User @relation(fields: [userId], references: [id], onDelete: Cascade)\n\n @@index([userId])\n @@index([createdAt])\n}\n\nmodel BackupDestination {\n id Int @id @default(autoincrement())\n userId Int\n path String\n isActive Boolean @default(true)\n createdAt DateTime @default(now())\n\n user User @relation(fields: [userId], references: [id])\n}\n\nmodel Notification {\n id Int @id @default(autoincrement())\n userId Int\n type NotificationTypes\n message String\n createdAt DateTime @default(now())\n read Boolean @default(false)\n\n user User @relation(fields: [userId], references: [id], onDelete: Cascade)\n\n @@index([userId])\n @@index([createdAt])\n}\n\nenum NotificationTypes {\n BACKUP\n CLAIM\n PAYMENT\n ETC\n}\n\n// Cron job execution log\nmodel CronJobLog {\n id Int @id @default(autoincrement())\n jobName String // e.g. \"local-backup\", \"usb-backup\"\n status String // \"success\" | \"failed\" | \"skipped\"\n startedAt DateTime\n completedAt DateTime?\n durationMs Int?\n errorMessage String?\n\n @@index([jobName])\n @@index([startedAt])\n @@index([status])\n}\n\nmodel CloudFolder {\n id Int @id @default(autoincrement())\n userId Int\n name String\n parentId Int?\n patientId Int?\n parent CloudFolder? @relation(\"FolderChildren\", fields: [parentId], references: [id], onDelete: Cascade)\n children CloudFolder[] @relation(\"FolderChildren\")\n user User @relation(fields: [userId], references: [id])\n patient Patient? @relation(\"PatientCloudFolder\", fields: [patientId], references: [id], onDelete: SetNull)\n files CloudFile[]\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n\n @@unique([userId, parentId, name]) // prevents sibling folder name duplicates\n @@index([parentId])\n @@index([patientId])\n}\n\nmodel CloudFile {\n id Int @id @default(autoincrement())\n userId Int\n name String\n mimeType String?\n fileSize BigInt @db.BigInt\n folderId Int? // optional: null => root\n isComplete Boolean @default(false) // upload completed?\n totalChunks Int? // optional: expected number of chunks\n diskPath String? // relative path on disk under uploads/\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n user User @relation(fields: [userId], references: [id])\n folder CloudFolder? @relation(fields: [folderId], references: [id], onDelete: SetNull)\n\n chunks CloudFileChunk[]\n\n @@index([folderId])\n}\n\nmodel CloudFileChunk {\n id Int @id @default(autoincrement())\n fileId Int\n seq Int\n data Bytes\n createdAt DateTime @default(now())\n\n file CloudFile @relation(fields: [fileId], references: [id], onDelete: Cascade)\n\n @@unique([fileId, seq])\n @@index([fileId, seq])\n}\n\n// patient-connection-\nenum CommunicationChannel {\n sms\n voice\n}\n\nenum CommunicationDirection {\n outbound\n inbound\n}\n\nenum CommunicationStatus {\n queued\n sent\n delivered\n failed\n completed\n busy\n no_answer\n}\n\nenum CommunicationProvider {\n twilio\n telnyx\n}\n\nmodel Communication {\n id Int @id @default(autoincrement())\n patientId Int\n userId Int?\n\n channel CommunicationChannel\n direction CommunicationDirection\n status CommunicationStatus\n // Which platform produced twilioSid — twilio for dial-pad-originated calls,\n // telnyx for everything else (SMS, inbound/AI voice, staff-triggered outbound calls).\n provider CommunicationProvider @default(twilio)\n\n body String?\n callDuration Int?\n // Provider SID — Twilio MessageSid/CallSid, or Telnyx message/call id. See `provider`.\n twilioSid String?\n\n createdAt DateTime @default(now())\n\n // Relations\n patient Patient @relation(fields: [patientId], references: [id])\n user User? @relation(fields: [userId], references: [id])\n\n @@map(\"communications\")\n}\n\nmodel PatientDocument {\n id Int @id @default(autoincrement())\n patientId Int\n filename String\n originalName String\n mimeType String\n fileSize BigInt\n filePath String\n uploadedAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n patient Patient @relation(fields: [patientId], references: [id], onDelete: Cascade)\n\n @@index([patientId])\n @@index([uploadedAt])\n}\n\nmodel TwilioSettings {\n id Int @id @default(autoincrement())\n userId Int @unique\n accountSid String\n authToken String\n phoneNumber String\n // Vestigial — inbound voice moved to Telnyx (TelnyxSettings.greetingMessage). No longer\n // read/written; kept to avoid a destructive migration for a cosmetic cleanup.\n greetingMessage String?\n templates Json?\n\n user User @relation(fields: [userId], references: [id], onDelete: Cascade)\n\n @@map(\"twilio_settings\")\n}\n\nmodel TelnyxSettings {\n id Int @id @default(autoincrement())\n userId Int @unique\n apiKey String\n // Telnyx account SID (Mission Control Portal), required to place outbound\n // TeXML calls via POST /texml/Accounts/{accountSid}/Calls — separate from apiKey.\n accountSid String?\n phoneNumber String\n texmlApplicationId String?\n messagingProfileId String?\n webhookPublicKey String?\n greetingMessage String?\n\n user User @relation(fields: [userId], references: [id], onDelete: Cascade)\n\n @@map(\"telnyx_settings\")\n}\n\nmodel AiSettings {\n id Int @id @default(autoincrement())\n userId Int @unique\n apiKey String\n aiEnabled Boolean @default(true)\n openAiKey String @default(\"\")\n openAiEnabled Boolean @default(false)\n claudeAiKey String @default(\"\")\n claudeAiEnabled Boolean @default(false)\n claudeAiModel String @default(\"claude-haiku-4-5-20251001\")\n openAiModel String @default(\"gpt-5.2\")\n googleAiModel String @default(\"gemini-2.5-flash\")\n dentalMgmtKey String @default(\"\")\n dentalMgmtEnabled Boolean @default(false)\n afterHoursEnabled Boolean @default(true)\n openPhoneReply Boolean @default(false)\n\n user User @relation(fields: [userId], references: [id], onDelete: Cascade)\n\n @@map(\"ai_settings\")\n}\n\nmodel OfficeHours {\n id Int @id @default(autoincrement())\n userId Int @unique\n data Json\n\n user User @relation(fields: [userId], references: [id], onDelete: Cascade)\n\n @@map(\"office_hours\")\n}\n\nmodel OfficeContact {\n id Int @id @default(autoincrement())\n userId Int @unique\n /// Legal (registered) business name — ADA claim form items 48 and 56\n legalName String?\n /// Dental office name as the public knows it (DBA)\n officeName String?\n receptionistName String?\n dentistName String?\n phoneNumber String?\n email String?\n fax String?\n streetAddress String?\n city String?\n state String?\n zipCode String?\n /// Office (billing) NPI — ADA claim form items 48-51\n billingName String?\n billingNpi String?\n billingLicense String?\n billingTaxId String?\n\n user User @relation(fields: [userId], references: [id], onDelete: Cascade)\n\n @@map(\"office_contact\")\n}\n\nmodel InsuranceContact {\n id Int @id @default(autoincrement())\n userId Int\n name String\n phoneNumber String?\n createdAt DateTime @default(now())\n\n user User @relation(fields: [userId], references: [id], onDelete: Cascade)\n\n @@map(\"insurance_contact\")\n}\n\nmodel ProcedureTimeslot {\n id Int @id @default(autoincrement())\n userId Int @unique\n data Json\n\n user User @relation(fields: [userId], references: [id], onDelete: Cascade)\n\n @@map(\"procedure_timeslot\")\n}\n\nmodel PatientConversation {\n id Int @id @default(autoincrement())\n patientId Int @unique\n userId Int\n stage String @default(\"initial\")\n aiHandoff Boolean @default(true)\n updatedAt DateTime @updatedAt\n\n patient Patient @relation(fields: [patientId], references: [id], onDelete: Cascade)\n user User @relation(fields: [userId], references: [id], onDelete: Cascade)\n\n @@map(\"patient_conversation\")\n}\n\n// Snapshot of the MassHealth Service History table, replaced on each eligibility check\nmodel PatientServiceHistory {\n id Int @id @default(autoincrement())\n patientId Int\n procedureCode String\n description String?\n toothQuadArchSurface String?\n placeOfService String?\n serviceDate String? // as shown by the portal, e.g. 10/15/2026\n createdAt DateTime @default(now())\n\n patient Patient @relation(fields: [patientId], references: [id], onDelete: Cascade)\n\n @@index([patientId])\n @@map(\"patient_service_history\")\n}\n\n// Procedure lines of a pre-auth, read by Check PreAuth (Tufts SCO). Replaced per\n// pre-auth number on each check, so a patient keeps one set of lines per pre-auth.\nmodel PatientPreauthHistory {\n id Int @id @default(autoincrement())\n patientId Int\n preAuthNumber String\n submittedCode String\n toothQuadArchSurface String?\n paidAmount String? // \"Plan payment\" as shown by the portal, e.g. $564.00\n status String?\n createdAt DateTime @default(now())\n\n patient Patient @relation(fields: [patientId], references: [id], onDelete: Cascade)\n\n @@index([patientId])\n @@map(\"patient_preauth_history\")\n}\n\nmodel LabRxTemplate {\n id Int @id @default(autoincrement())\n userId Int\n name String\n labName String?\n labPhone String?\n labFax String?\n labAddress String?\n labAccount String?\n caseType String?\n material String?\n instructions String?\n sortOrder Int @default(0)\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n\n user User @relation(fields: [userId], references: [id], onDelete: Cascade)\n\n @@index([userId])\n @@map(\"lab_rx_template\")\n}\n\n// Commission tracking\nmodel CommissionBatch {\n id Int @id @default(autoincrement())\n npiProviderId Int\n totalCollection Decimal @db.Decimal(14, 2)\n commissionAmount Decimal @db.Decimal(14, 2)\n notes String?\n createdAt DateTime @default(now())\n\n npiProvider NpiProvider @relation(fields: [npiProviderId], references: [id])\n items CommissionBatchItem[]\n\n @@index([npiProviderId])\n}\n\nmodel CommissionBatchItem {\n id Int @id @default(autoincrement())\n commissionBatchId Int\n paymentId Int\n collectionAmount Decimal @db.Decimal(14, 2)\n\n commissionBatch CommissionBatch @relation(fields: [commissionBatchId], references: [id], onDelete: Cascade)\n payment Payment @relation(fields: [paymentId], references: [id])\n\n @@unique([commissionBatchId, paymentId])\n @@index([paymentId])\n}\n\nmodel SeleniumSettings {\n id Int @id @default(autoincrement())\n userId Int @unique\n paymentGroupId String @default(\"\")\n\n user User @relation(fields: [userId], references: [id], onDelete: Cascade)\n\n @@map(\"selenium_settings\")\n}\n"
+ "inlineSchema": "// This is your Prisma schema file,\n// learn more about it in the docs: https://pris.ly/d/prisma-schema\n\n// Looking for ways to speed up your queries, or scale easily with your serverless or edge functions?\n// Try Prisma Accelerate: https://pris.ly/cli/accelerate-init\n\ngenerator client {\n provider = \"prisma-client-js\"\n output = \"../generated/prisma\"\n}\n\ngenerator zod {\n provider = \"prisma-zod-generator\"\n output = \"../shared/\" // Zod schemas will be generated here inside `db/shared`\n}\n\ndatasource db {\n provider = \"postgresql\"\n}\n\nmodel User {\n id Int @id @default(autoincrement())\n username String @unique\n password String\n autoBackupEnabled Boolean @default(true)\n autoBackupHour Int @default(20)\n usbBackupEnabled Boolean @default(false)\n usbBackupHour Int @default(21)\n autoMhCheckEnabled Boolean @default(false)\n autoMhCheckDayOfWeek Int @default(1)\n autoMhCheckHour Int @default(13)\n patients Patient[]\n appointments Appointment[]\n staff Staff[]\n npiProviders NpiProvider[]\n claims Claim[]\n insuranceCredentials InsuranceCredential[]\n shoppingVendors ShoppingVendor[]\n updatedPayments Payment[] @relation(\"PaymentUpdatedBy\")\n backups DatabaseBackup[]\n backupDestinations BackupDestination[]\n notifications Notification[]\n cloudFolders CloudFolder[]\n cloudFiles CloudFile[]\n communications Communication[]\n twilioSettings TwilioSettings?\n telnyxSettings TelnyxSettings?\n aiSettings AiSettings?\n officeHours OfficeHours?\n officeContact OfficeContact?\n procedureTimeslot ProcedureTimeslot?\n insuranceContacts InsuranceContact[]\n patientConversations PatientConversation[]\n labRxTemplates LabRxTemplate[]\n seleniumSettings SeleniumSettings?\n}\n\nmodel Patient {\n id Int @id @default(autoincrement())\n firstName String\n lastName String\n dateOfBirth DateTime? @db.Date\n gender String\n phone String\n email String?\n address String?\n city String?\n state String? @default(\"MA\")\n zipCode String?\n insuranceProvider String?\n insuranceId String?\n groupNumber String?\n policyHolder String?\n policyHolderPatientId Int? // patient record of the policy holder, when picked from the DB\n policyHolderRelationship String? // ADA box 18: SELF | SPOUSE | DEPENDENT | OTHER\n allergies String?\n medicalConditions String?\n preferredLanguage String? @default(\"English\")\n status PatientStatus @default(UNKNOWN)\n remainingBenefit String?\n thirdPartyInsurance String?\n userId Int\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n user User @relation(fields: [userId], references: [id])\n appointments Appointment[]\n procedures AppointmentProcedure[]\n claims Claim[]\n groups PdfGroup[]\n payment Payment[]\n communications Communication[]\n documents PatientDocument[]\n conversation PatientConversation?\n cloudFolders CloudFolder[] @relation(\"PatientCloudFolder\")\n serviceHistory PatientServiceHistory[]\n preauthHistory PatientPreauthHistory[]\n\n @@index([insuranceId])\n @@index([createdAt])\n}\n\nenum PatientStatus {\n ACTIVE\n INACTIVE\n UNKNOWN\n PLAN_NOT_ACCEPTED\n}\n\nmodel Appointment {\n id Int @id @default(autoincrement())\n patientId Int\n userId Int\n staffId Int\n npiProviderId Int?\n title String\n date DateTime @db.Date\n startTime String // Store time as \"hh:mm\"\n endTime String // Store time as \"hh:mm\"\n type String // e.g., \"checkup\", \"cleaning\", \"filling\", etc.\n typeLocked Boolean @default(false) // true = user manually set; auto-sync will not overwrite\n notes String?\n procedureCodeNotes String?\n status String @default(\"scheduled\") // \"scheduled\", \"completed\", \"cancelled\", \"no-show\"\n movedByAi Boolean @default(false)\n createdAt DateTime @default(now())\n\n eligibilityStatus PatientStatus @default(UNKNOWN)\n\n patient Patient @relation(fields: [patientId], references: [id], onDelete: Cascade)\n user User @relation(fields: [userId], references: [id])\n staff Staff? @relation(fields: [staffId], references: [id])\n npiProvider NpiProvider? @relation(fields: [npiProviderId], references: [id])\n procedures AppointmentProcedure[]\n claims Claim[]\n files AppointmentFile[]\n\n @@index([patientId])\n @@index([date])\n}\n\nmodel AppointmentFile {\n id Int @id @default(autoincrement())\n appointmentId Int\n filename String\n mimeType String?\n filePath String?\n\n appointment Appointment @relation(fields: [appointmentId], references: [id], onDelete: Cascade)\n\n @@index([appointmentId])\n}\n\nmodel Staff {\n id Int @id @default(autoincrement())\n userId Int\n name String\n email String?\n role String // e.g., \"Dentist\", \"Hygienist\", \"Assistant\"\n phone String?\n createdAt DateTime @default(now())\n user User? @relation(fields: [userId], references: [id], onDelete: Cascade)\n appointments Appointment[]\n claims Claim[] @relation(\"ClaimStaff\")\n}\n\nmodel NpiProvider {\n id Int @id @default(autoincrement())\n userId Int\n npiNumber String\n providerName String\n /// State dental license (ADA claim form item 55)\n licenseNumber String?\n sortOrder Int @default(0)\n createdAt DateTime @default(now())\n\n user User @relation(fields: [userId], references: [id], onDelete: Cascade)\n claims Claim[]\n payments Payment[]\n commissionBatches CommissionBatch[]\n appointmentProcedures AppointmentProcedure[]\n appointments Appointment[]\n\n @@unique([userId, npiNumber])\n @@index([userId])\n}\n\nenum ProcedureSource {\n COMBO\n MANUAL\n}\n\nmodel AppointmentProcedure {\n id Int @id @default(autoincrement())\n appointmentId Int\n patientId Int\n npiProviderId Int?\n\n procedureCode String\n procedureLabel String?\n fee Decimal? @db.Decimal(10, 2)\n\n category String?\n\n toothNumber String?\n toothSurface String?\n oralCavityArea String?\n\n source ProcedureSource @default(MANUAL)\n comboKey String?\n\n createdAt DateTime @default(now())\n\n appointment Appointment @relation(fields: [appointmentId], references: [id], onDelete: Cascade)\n patient Patient @relation(fields: [patientId], references: [id], onDelete: Cascade)\n npiProvider NpiProvider? @relation(fields: [npiProviderId], references: [id])\n\n @@index([appointmentId])\n @@index([patientId])\n}\n\nmodel Claim {\n id Int @id @default(autoincrement())\n patientId Int\n /// @zod.number.int().nullable().optional()\n appointmentId Int?\n userId Int\n staffId Int\n patientName String\n memberId String\n dateOfBirth DateTime @db.Date\n remarks String\n missingTeethStatus MissingTeethStatus @default(No_missing)\n missingTeeth Json? // { \"T_14\": \"X\", \"T_G\": \"O\", ... }\n serviceDate DateTime\n insuranceProvider String // e.g., \"Delta MA\"\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n status ClaimStatus @default(PENDING)\n claimNumber String?\n preAuthNumber String?\n npiProviderId Int?\n\n patient Patient @relation(fields: [patientId], references: [id], onDelete: Cascade)\n appointment Appointment? @relation(fields: [appointmentId], references: [id], onDelete: Cascade)\n user User? @relation(fields: [userId], references: [id])\n staff Staff? @relation(\"ClaimStaff\", fields: [staffId], references: [id])\n npiProvider NpiProvider? @relation(fields: [npiProviderId], references: [id])\n\n serviceLines ServiceLine[]\n claimFiles ClaimFile[]\n payment Payment?\n}\n\nenum ClaimStatus {\n PENDING\n APPROVED\n CANCELLED\n REVIEW\n VOID\n PREAUTH\n DENIED\n}\n\nenum MissingTeethStatus {\n No_missing\n endentulous\n Yes_missing\n}\n\nmodel ServiceLine {\n id Int @id @default(autoincrement())\n claimId Int?\n paymentId Int?\n procedureCode String\n procedureDate DateTime @db.Date\n quad String?\n arch String?\n toothNumber String?\n toothSurface String?\n icn String?\n paidCode String?\n allowedAmount Decimal? @db.Decimal(10, 2)\n totalBilled Decimal @db.Decimal(10, 2)\n totalPaid Decimal @default(0.00) @db.Decimal(10, 2)\n totalAdjusted Decimal @default(0.00) @db.Decimal(10, 2)\n totalDue Decimal @default(0.00) @db.Decimal(10, 2)\n status ServiceLineStatus @default(UNPAID)\n\n claim Claim? @relation(fields: [claimId], references: [id], onDelete: Cascade)\n payment Payment? @relation(fields: [paymentId], references: [id], onDelete: Cascade)\n\n serviceLineTransactions ServiceLineTransaction[]\n}\n\nenum ServiceLineStatus {\n PENDING\n PARTIALLY_PAID\n PAID\n UNPAID\n ADJUSTED\n OVERPAID\n DENIED\n}\n\nmodel ClaimFile {\n id Int @id @default(autoincrement())\n claimId Int\n filename String\n mimeType String\n filePath String?\n\n claim Claim @relation(fields: [claimId], references: [id], onDelete: Cascade)\n}\n\nmodel InsuranceCredential {\n id Int @id @default(autoincrement())\n userId Int\n siteKey String\n username String\n password String\n\n user User @relation(fields: [userId], references: [id], onDelete: Cascade)\n\n @@unique([userId, siteKey])\n @@index([userId])\n}\n\nmodel ShoppingVendor {\n id Int @id @default(autoincrement())\n userId Int\n vendorName String\n websiteUrl String\n loginUsername String\n loginPassword String\n\n user User @relation(fields: [userId], references: [id], onDelete: Cascade)\n\n @@index([userId])\n}\n\nmodel PdfGroup {\n id Int @id @default(autoincrement())\n title String\n titleKey PdfTitleKey @default(OTHER)\n createdAt DateTime @default(now())\n patientId Int\n patient Patient @relation(fields: [patientId], references: [id], onDelete: Cascade)\n pdfs PdfFile[]\n\n @@index([patientId])\n @@index([titleKey])\n}\n\nmodel PdfFile {\n id Int @id @default(autoincrement())\n filename String\n pdfData Bytes\n uploadedAt DateTime @default(now())\n groupId Int\n group PdfGroup @relation(fields: [groupId], references: [id], onDelete: Cascade)\n\n @@index([groupId])\n}\n\nenum PdfTitleKey {\n INSURANCE_CLAIM\n INSURANCE_CLAIM_PREAUTH\n ELIGIBILITY_STATUS\n CLAIM_STATUS\n PREAUTH_APPROVAL\n OTHER\n}\n\nmodel Payment {\n id Int @id @default(autoincrement())\n claimId Int? @unique\n patientId Int\n userId Int\n updatedById Int?\n npiProviderId Int?\n totalBilled Decimal @db.Decimal(10, 2)\n totalPaid Decimal @default(0.00) @db.Decimal(10, 2)\n totalAdjusted Decimal @default(0.00) @db.Decimal(10, 2)\n totalDue Decimal @db.Decimal(10, 2)\n mhPaidAmount Decimal? @db.Decimal(10, 2)\n copayment Decimal @default(0.00) @db.Decimal(10, 2)\n adjustment Decimal @default(0.00) @db.Decimal(10, 2)\n status PaymentStatus @default(PENDING)\n notes String?\n icn String?\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n\n claim Claim? @relation(fields: [claimId], references: [id], onDelete: Cascade)\n patient Patient @relation(fields: [patientId], references: [id], onDelete: Cascade)\n updatedBy User? @relation(\"PaymentUpdatedBy\", fields: [updatedById], references: [id])\n npiProvider NpiProvider? @relation(fields: [npiProviderId], references: [id])\n serviceLineTransactions ServiceLineTransaction[]\n serviceLines ServiceLine[]\n commissionBatchItems CommissionBatchItem[]\n\n @@index([claimId])\n @@index([patientId])\n @@index([createdAt])\n}\n\nmodel ServiceLineTransaction {\n id Int @id @default(autoincrement())\n paymentId Int\n serviceLineId Int\n transactionId String?\n paidAmount Decimal @db.Decimal(10, 2)\n adjustedAmount Decimal @default(0.00) @db.Decimal(10, 2)\n method PaymentMethod\n receivedDate DateTime\n payerName String?\n notes String?\n createdAt DateTime @default(now())\n\n payment Payment @relation(fields: [paymentId], references: [id], onDelete: Cascade)\n serviceLine ServiceLine @relation(fields: [serviceLineId], references: [id], onDelete: Cascade)\n\n @@index([paymentId])\n @@index([serviceLineId])\n}\n\nenum PaymentStatus {\n PENDING\n PARTIALLY_PAID\n PAID\n OVERPAID\n DENIED\n VOID\n}\n\nenum PaymentMethod {\n EFT\n CHECK\n CASH\n CARD\n OTHER\n}\n\n// Database management page\nmodel DatabaseBackup {\n id Int @id @default(autoincrement())\n userId Int\n createdAt DateTime @default(now())\n\n user User @relation(fields: [userId], references: [id], onDelete: Cascade)\n\n @@index([userId])\n @@index([createdAt])\n}\n\nmodel BackupDestination {\n id Int @id @default(autoincrement())\n userId Int\n path String\n isActive Boolean @default(true)\n createdAt DateTime @default(now())\n\n user User @relation(fields: [userId], references: [id])\n}\n\nmodel Notification {\n id Int @id @default(autoincrement())\n userId Int\n type NotificationTypes\n message String\n createdAt DateTime @default(now())\n read Boolean @default(false)\n\n user User @relation(fields: [userId], references: [id], onDelete: Cascade)\n\n @@index([userId])\n @@index([createdAt])\n}\n\nenum NotificationTypes {\n BACKUP\n CLAIM\n PAYMENT\n ETC\n}\n\n// Cron job execution log\nmodel CronJobLog {\n id Int @id @default(autoincrement())\n jobName String // e.g. \"local-backup\", \"usb-backup\"\n status String // \"success\" | \"failed\" | \"skipped\"\n startedAt DateTime\n completedAt DateTime?\n durationMs Int?\n errorMessage String?\n\n @@index([jobName])\n @@index([startedAt])\n @@index([status])\n}\n\nmodel CloudFolder {\n id Int @id @default(autoincrement())\n userId Int\n name String\n parentId Int?\n patientId Int?\n parent CloudFolder? @relation(\"FolderChildren\", fields: [parentId], references: [id], onDelete: Cascade)\n children CloudFolder[] @relation(\"FolderChildren\")\n user User @relation(fields: [userId], references: [id])\n patient Patient? @relation(\"PatientCloudFolder\", fields: [patientId], references: [id], onDelete: SetNull)\n files CloudFile[]\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n\n @@unique([userId, parentId, name]) // prevents sibling folder name duplicates\n @@index([parentId])\n @@index([patientId])\n}\n\nmodel CloudFile {\n id Int @id @default(autoincrement())\n userId Int\n name String\n mimeType String?\n fileSize BigInt @db.BigInt\n folderId Int? // optional: null => root\n isComplete Boolean @default(false) // upload completed?\n totalChunks Int? // optional: expected number of chunks\n diskPath String? // relative path on disk under uploads/\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n user User @relation(fields: [userId], references: [id])\n folder CloudFolder? @relation(fields: [folderId], references: [id], onDelete: SetNull)\n\n chunks CloudFileChunk[]\n\n @@index([folderId])\n}\n\nmodel CloudFileChunk {\n id Int @id @default(autoincrement())\n fileId Int\n seq Int\n data Bytes\n createdAt DateTime @default(now())\n\n file CloudFile @relation(fields: [fileId], references: [id], onDelete: Cascade)\n\n @@unique([fileId, seq])\n @@index([fileId, seq])\n}\n\n// patient-connection-\nenum CommunicationChannel {\n sms\n voice\n}\n\nenum CommunicationDirection {\n outbound\n inbound\n}\n\nenum CommunicationStatus {\n queued\n sent\n delivered\n failed\n completed\n busy\n no_answer\n}\n\nenum CommunicationProvider {\n twilio\n telnyx\n}\n\nmodel Communication {\n id Int @id @default(autoincrement())\n patientId Int\n userId Int?\n\n channel CommunicationChannel\n direction CommunicationDirection\n status CommunicationStatus\n // Which platform produced twilioSid — twilio for dial-pad-originated calls,\n // telnyx for everything else (SMS, inbound/AI voice, staff-triggered outbound calls).\n provider CommunicationProvider @default(twilio)\n\n body String?\n callDuration Int?\n // Provider SID — Twilio MessageSid/CallSid, or Telnyx message/call id. See `provider`.\n twilioSid String?\n\n createdAt DateTime @default(now())\n\n // Relations\n patient Patient @relation(fields: [patientId], references: [id])\n user User? @relation(fields: [userId], references: [id])\n\n @@map(\"communications\")\n}\n\nmodel PatientDocument {\n id Int @id @default(autoincrement())\n patientId Int\n filename String\n originalName String\n mimeType String\n fileSize BigInt\n filePath String\n uploadedAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n patient Patient @relation(fields: [patientId], references: [id], onDelete: Cascade)\n\n @@index([patientId])\n @@index([uploadedAt])\n}\n\nmodel TwilioSettings {\n id Int @id @default(autoincrement())\n userId Int @unique\n accountSid String\n authToken String\n phoneNumber String\n // Vestigial — inbound voice moved to Telnyx (TelnyxSettings.greetingMessage). No longer\n // read/written; kept to avoid a destructive migration for a cosmetic cleanup.\n greetingMessage String?\n templates Json?\n\n user User @relation(fields: [userId], references: [id], onDelete: Cascade)\n\n @@map(\"twilio_settings\")\n}\n\nmodel TelnyxSettings {\n id Int @id @default(autoincrement())\n userId Int @unique\n apiKey String\n // Telnyx account SID (Mission Control Portal), required to place outbound\n // TeXML calls via POST /texml/Accounts/{accountSid}/Calls — separate from apiKey.\n accountSid String?\n phoneNumber String\n texmlApplicationId String?\n messagingProfileId String?\n webhookPublicKey String?\n greetingMessage String?\n\n user User @relation(fields: [userId], references: [id], onDelete: Cascade)\n\n @@map(\"telnyx_settings\")\n}\n\nmodel AiSettings {\n id Int @id @default(autoincrement())\n userId Int @unique\n apiKey String\n aiEnabled Boolean @default(true)\n openAiKey String @default(\"\")\n openAiEnabled Boolean @default(false)\n claudeAiKey String @default(\"\")\n claudeAiEnabled Boolean @default(false)\n claudeAiModel String @default(\"claude-haiku-4-5-20251001\")\n openAiModel String @default(\"gpt-5.2\")\n googleAiModel String @default(\"gemini-2.5-flash\")\n dentalMgmtKey String @default(\"\")\n dentalMgmtEnabled Boolean @default(false)\n afterHoursEnabled Boolean @default(true)\n openPhoneReply Boolean @default(false)\n\n user User @relation(fields: [userId], references: [id], onDelete: Cascade)\n\n @@map(\"ai_settings\")\n}\n\nmodel OfficeHours {\n id Int @id @default(autoincrement())\n userId Int @unique\n data Json\n\n user User @relation(fields: [userId], references: [id], onDelete: Cascade)\n\n @@map(\"office_hours\")\n}\n\nmodel OfficeContact {\n id Int @id @default(autoincrement())\n userId Int @unique\n /// Legal (registered) business name — ADA claim form items 48 and 56\n legalName String?\n /// Dental office name as the public knows it (DBA)\n officeName String?\n receptionistName String?\n dentistName String?\n phoneNumber String?\n email String?\n fax String?\n streetAddress String?\n city String?\n state String?\n zipCode String?\n /// Office (billing) NPI — ADA claim form items 48-51\n billingName String?\n billingNpi String?\n billingLicense String?\n billingTaxId String?\n\n user User @relation(fields: [userId], references: [id], onDelete: Cascade)\n\n @@map(\"office_contact\")\n}\n\nmodel InsuranceContact {\n id Int @id @default(autoincrement())\n userId Int\n name String\n phoneNumber String?\n createdAt DateTime @default(now())\n\n user User @relation(fields: [userId], references: [id], onDelete: Cascade)\n\n @@map(\"insurance_contact\")\n}\n\nmodel ProcedureTimeslot {\n id Int @id @default(autoincrement())\n userId Int @unique\n data Json\n\n user User @relation(fields: [userId], references: [id], onDelete: Cascade)\n\n @@map(\"procedure_timeslot\")\n}\n\nmodel PatientConversation {\n id Int @id @default(autoincrement())\n patientId Int @unique\n userId Int\n stage String @default(\"initial\")\n aiHandoff Boolean @default(true)\n updatedAt DateTime @updatedAt\n\n patient Patient @relation(fields: [patientId], references: [id], onDelete: Cascade)\n user User @relation(fields: [userId], references: [id], onDelete: Cascade)\n\n @@map(\"patient_conversation\")\n}\n\n// Snapshot of the MassHealth Service History table, replaced on each eligibility check\nmodel PatientServiceHistory {\n id Int @id @default(autoincrement())\n patientId Int\n procedureCode String\n description String?\n toothQuadArchSurface String?\n placeOfService String?\n serviceDate String? // as shown by the portal, e.g. 10/15/2026\n createdAt DateTime @default(now())\n\n patient Patient @relation(fields: [patientId], references: [id], onDelete: Cascade)\n\n @@index([patientId])\n @@map(\"patient_service_history\")\n}\n\n// Procedure lines of a pre-auth, read by Check PreAuth (Tufts SCO). Replaced per\n// pre-auth number on each check, so a patient keeps one set of lines per pre-auth.\nmodel PatientPreauthHistory {\n id Int @id @default(autoincrement())\n patientId Int\n preAuthNumber String\n submittedCode String\n toothQuadArchSurface String?\n paidAmount String? // \"Plan payment\" as shown by the portal, e.g. $564.00\n status String?\n createdAt DateTime @default(now())\n\n patient Patient @relation(fields: [patientId], references: [id], onDelete: Cascade)\n\n @@index([patientId])\n @@map(\"patient_preauth_history\")\n}\n\nmodel LabRxTemplate {\n id Int @id @default(autoincrement())\n userId Int\n name String\n labName String?\n labPhone String?\n labFax String?\n labAddress String?\n labAccount String?\n caseType String?\n material String?\n instructions String?\n sortOrder Int @default(0)\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n\n user User @relation(fields: [userId], references: [id], onDelete: Cascade)\n\n @@index([userId])\n @@map(\"lab_rx_template\")\n}\n\n// Commission tracking\nmodel CommissionBatch {\n id Int @id @default(autoincrement())\n npiProviderId Int\n totalCollection Decimal @db.Decimal(14, 2)\n commissionAmount Decimal @db.Decimal(14, 2)\n notes String?\n createdAt DateTime @default(now())\n\n npiProvider NpiProvider @relation(fields: [npiProviderId], references: [id])\n items CommissionBatchItem[]\n\n @@index([npiProviderId])\n}\n\nmodel CommissionBatchItem {\n id Int @id @default(autoincrement())\n commissionBatchId Int\n paymentId Int\n collectionAmount Decimal @db.Decimal(14, 2)\n\n commissionBatch CommissionBatch @relation(fields: [commissionBatchId], references: [id], onDelete: Cascade)\n payment Payment @relation(fields: [paymentId], references: [id])\n\n @@unique([commissionBatchId, paymentId])\n @@index([paymentId])\n}\n\nmodel SeleniumSettings {\n id Int @id @default(autoincrement())\n userId Int @unique\n paymentGroupId String @default(\"\")\n\n user User @relation(fields: [userId], references: [id], onDelete: Cascade)\n\n @@map(\"selenium_settings\")\n}\n"
}
config.runtimeDataModel = JSON.parse("{\"models\":{\"User\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"username\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"password\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"autoBackupEnabled\",\"kind\":\"scalar\",\"type\":\"Boolean\"},{\"name\":\"autoBackupHour\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"usbBackupEnabled\",\"kind\":\"scalar\",\"type\":\"Boolean\"},{\"name\":\"usbBackupHour\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"autoMhCheckEnabled\",\"kind\":\"scalar\",\"type\":\"Boolean\"},{\"name\":\"autoMhCheckDayOfWeek\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"autoMhCheckHour\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"patients\",\"kind\":\"object\",\"type\":\"Patient\",\"relationName\":\"PatientToUser\"},{\"name\":\"appointments\",\"kind\":\"object\",\"type\":\"Appointment\",\"relationName\":\"AppointmentToUser\"},{\"name\":\"staff\",\"kind\":\"object\",\"type\":\"Staff\",\"relationName\":\"StaffToUser\"},{\"name\":\"npiProviders\",\"kind\":\"object\",\"type\":\"NpiProvider\",\"relationName\":\"NpiProviderToUser\"},{\"name\":\"claims\",\"kind\":\"object\",\"type\":\"Claim\",\"relationName\":\"ClaimToUser\"},{\"name\":\"insuranceCredentials\",\"kind\":\"object\",\"type\":\"InsuranceCredential\",\"relationName\":\"InsuranceCredentialToUser\"},{\"name\":\"shoppingVendors\",\"kind\":\"object\",\"type\":\"ShoppingVendor\",\"relationName\":\"ShoppingVendorToUser\"},{\"name\":\"updatedPayments\",\"kind\":\"object\",\"type\":\"Payment\",\"relationName\":\"PaymentUpdatedBy\"},{\"name\":\"backups\",\"kind\":\"object\",\"type\":\"DatabaseBackup\",\"relationName\":\"DatabaseBackupToUser\"},{\"name\":\"backupDestinations\",\"kind\":\"object\",\"type\":\"BackupDestination\",\"relationName\":\"BackupDestinationToUser\"},{\"name\":\"notifications\",\"kind\":\"object\",\"type\":\"Notification\",\"relationName\":\"NotificationToUser\"},{\"name\":\"cloudFolders\",\"kind\":\"object\",\"type\":\"CloudFolder\",\"relationName\":\"CloudFolderToUser\"},{\"name\":\"cloudFiles\",\"kind\":\"object\",\"type\":\"CloudFile\",\"relationName\":\"CloudFileToUser\"},{\"name\":\"communications\",\"kind\":\"object\",\"type\":\"Communication\",\"relationName\":\"CommunicationToUser\"},{\"name\":\"twilioSettings\",\"kind\":\"object\",\"type\":\"TwilioSettings\",\"relationName\":\"TwilioSettingsToUser\"},{\"name\":\"telnyxSettings\",\"kind\":\"object\",\"type\":\"TelnyxSettings\",\"relationName\":\"TelnyxSettingsToUser\"},{\"name\":\"aiSettings\",\"kind\":\"object\",\"type\":\"AiSettings\",\"relationName\":\"AiSettingsToUser\"},{\"name\":\"officeHours\",\"kind\":\"object\",\"type\":\"OfficeHours\",\"relationName\":\"OfficeHoursToUser\"},{\"name\":\"officeContact\",\"kind\":\"object\",\"type\":\"OfficeContact\",\"relationName\":\"OfficeContactToUser\"},{\"name\":\"procedureTimeslot\",\"kind\":\"object\",\"type\":\"ProcedureTimeslot\",\"relationName\":\"ProcedureTimeslotToUser\"},{\"name\":\"insuranceContacts\",\"kind\":\"object\",\"type\":\"InsuranceContact\",\"relationName\":\"InsuranceContactToUser\"},{\"name\":\"patientConversations\",\"kind\":\"object\",\"type\":\"PatientConversation\",\"relationName\":\"PatientConversationToUser\"},{\"name\":\"labRxTemplates\",\"kind\":\"object\",\"type\":\"LabRxTemplate\",\"relationName\":\"LabRxTemplateToUser\"},{\"name\":\"seleniumSettings\",\"kind\":\"object\",\"type\":\"SeleniumSettings\",\"relationName\":\"SeleniumSettingsToUser\"}],\"dbName\":null},\"Patient\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"firstName\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"lastName\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"dateOfBirth\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"gender\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"phone\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"email\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"address\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"city\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"state\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"zipCode\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"insuranceProvider\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"insuranceId\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"groupNumber\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"policyHolder\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"policyHolderPatientId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"policyHolderRelationship\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"allergies\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"medicalConditions\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"preferredLanguage\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"status\",\"kind\":\"enum\",\"type\":\"PatientStatus\"},{\"name\":\"remainingBenefit\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"thirdPartyInsurance\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"userId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"user\",\"kind\":\"object\",\"type\":\"User\",\"relationName\":\"PatientToUser\"},{\"name\":\"appointments\",\"kind\":\"object\",\"type\":\"Appointment\",\"relationName\":\"AppointmentToPatient\"},{\"name\":\"procedures\",\"kind\":\"object\",\"type\":\"AppointmentProcedure\",\"relationName\":\"AppointmentProcedureToPatient\"},{\"name\":\"claims\",\"kind\":\"object\",\"type\":\"Claim\",\"relationName\":\"ClaimToPatient\"},{\"name\":\"groups\",\"kind\":\"object\",\"type\":\"PdfGroup\",\"relationName\":\"PatientToPdfGroup\"},{\"name\":\"payment\",\"kind\":\"object\",\"type\":\"Payment\",\"relationName\":\"PatientToPayment\"},{\"name\":\"communications\",\"kind\":\"object\",\"type\":\"Communication\",\"relationName\":\"CommunicationToPatient\"},{\"name\":\"documents\",\"kind\":\"object\",\"type\":\"PatientDocument\",\"relationName\":\"PatientToPatientDocument\"},{\"name\":\"conversation\",\"kind\":\"object\",\"type\":\"PatientConversation\",\"relationName\":\"PatientToPatientConversation\"},{\"name\":\"cloudFolders\",\"kind\":\"object\",\"type\":\"CloudFolder\",\"relationName\":\"PatientCloudFolder\"},{\"name\":\"serviceHistory\",\"kind\":\"object\",\"type\":\"PatientServiceHistory\",\"relationName\":\"PatientToPatientServiceHistory\"},{\"name\":\"preauthHistory\",\"kind\":\"object\",\"type\":\"PatientPreauthHistory\",\"relationName\":\"PatientToPatientPreauthHistory\"}],\"dbName\":null},\"Appointment\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"patientId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"userId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"staffId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"npiProviderId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"title\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"date\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"startTime\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"endTime\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"type\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"typeLocked\",\"kind\":\"scalar\",\"type\":\"Boolean\"},{\"name\":\"notes\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"procedureCodeNotes\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"status\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"movedByAi\",\"kind\":\"scalar\",\"type\":\"Boolean\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"eligibilityStatus\",\"kind\":\"enum\",\"type\":\"PatientStatus\"},{\"name\":\"patient\",\"kind\":\"object\",\"type\":\"Patient\",\"relationName\":\"AppointmentToPatient\"},{\"name\":\"user\",\"kind\":\"object\",\"type\":\"User\",\"relationName\":\"AppointmentToUser\"},{\"name\":\"staff\",\"kind\":\"object\",\"type\":\"Staff\",\"relationName\":\"AppointmentToStaff\"},{\"name\":\"npiProvider\",\"kind\":\"object\",\"type\":\"NpiProvider\",\"relationName\":\"AppointmentToNpiProvider\"},{\"name\":\"procedures\",\"kind\":\"object\",\"type\":\"AppointmentProcedure\",\"relationName\":\"AppointmentToAppointmentProcedure\"},{\"name\":\"claims\",\"kind\":\"object\",\"type\":\"Claim\",\"relationName\":\"AppointmentToClaim\"},{\"name\":\"files\",\"kind\":\"object\",\"type\":\"AppointmentFile\",\"relationName\":\"AppointmentToAppointmentFile\"}],\"dbName\":null},\"AppointmentFile\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"appointmentId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"filename\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"mimeType\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"filePath\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"appointment\",\"kind\":\"object\",\"type\":\"Appointment\",\"relationName\":\"AppointmentToAppointmentFile\"}],\"dbName\":null},\"Staff\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"userId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"name\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"email\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"role\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"phone\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"user\",\"kind\":\"object\",\"type\":\"User\",\"relationName\":\"StaffToUser\"},{\"name\":\"appointments\",\"kind\":\"object\",\"type\":\"Appointment\",\"relationName\":\"AppointmentToStaff\"},{\"name\":\"claims\",\"kind\":\"object\",\"type\":\"Claim\",\"relationName\":\"ClaimStaff\"}],\"dbName\":null},\"NpiProvider\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"userId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"npiNumber\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"providerName\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"licenseNumber\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"sortOrder\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"user\",\"kind\":\"object\",\"type\":\"User\",\"relationName\":\"NpiProviderToUser\"},{\"name\":\"claims\",\"kind\":\"object\",\"type\":\"Claim\",\"relationName\":\"ClaimToNpiProvider\"},{\"name\":\"payments\",\"kind\":\"object\",\"type\":\"Payment\",\"relationName\":\"NpiProviderToPayment\"},{\"name\":\"commissionBatches\",\"kind\":\"object\",\"type\":\"CommissionBatch\",\"relationName\":\"CommissionBatchToNpiProvider\"},{\"name\":\"appointmentProcedures\",\"kind\":\"object\",\"type\":\"AppointmentProcedure\",\"relationName\":\"AppointmentProcedureToNpiProvider\"},{\"name\":\"appointments\",\"kind\":\"object\",\"type\":\"Appointment\",\"relationName\":\"AppointmentToNpiProvider\"}],\"dbName\":null},\"AppointmentProcedure\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"appointmentId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"patientId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"npiProviderId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"procedureCode\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"procedureLabel\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"fee\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"category\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"toothNumber\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"toothSurface\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"oralCavityArea\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"source\",\"kind\":\"enum\",\"type\":\"ProcedureSource\"},{\"name\":\"comboKey\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"appointment\",\"kind\":\"object\",\"type\":\"Appointment\",\"relationName\":\"AppointmentToAppointmentProcedure\"},{\"name\":\"patient\",\"kind\":\"object\",\"type\":\"Patient\",\"relationName\":\"AppointmentProcedureToPatient\"},{\"name\":\"npiProvider\",\"kind\":\"object\",\"type\":\"NpiProvider\",\"relationName\":\"AppointmentProcedureToNpiProvider\"}],\"dbName\":null},\"Claim\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"patientId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"appointmentId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"userId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"staffId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"patientName\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"memberId\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"dateOfBirth\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"remarks\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"missingTeethStatus\",\"kind\":\"enum\",\"type\":\"MissingTeethStatus\"},{\"name\":\"missingTeeth\",\"kind\":\"scalar\",\"type\":\"Json\"},{\"name\":\"serviceDate\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"insuranceProvider\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"status\",\"kind\":\"enum\",\"type\":\"ClaimStatus\"},{\"name\":\"claimNumber\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"preAuthNumber\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"npiProviderId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"patient\",\"kind\":\"object\",\"type\":\"Patient\",\"relationName\":\"ClaimToPatient\"},{\"name\":\"appointment\",\"kind\":\"object\",\"type\":\"Appointment\",\"relationName\":\"AppointmentToClaim\"},{\"name\":\"user\",\"kind\":\"object\",\"type\":\"User\",\"relationName\":\"ClaimToUser\"},{\"name\":\"staff\",\"kind\":\"object\",\"type\":\"Staff\",\"relationName\":\"ClaimStaff\"},{\"name\":\"npiProvider\",\"kind\":\"object\",\"type\":\"NpiProvider\",\"relationName\":\"ClaimToNpiProvider\"},{\"name\":\"serviceLines\",\"kind\":\"object\",\"type\":\"ServiceLine\",\"relationName\":\"ClaimToServiceLine\"},{\"name\":\"claimFiles\",\"kind\":\"object\",\"type\":\"ClaimFile\",\"relationName\":\"ClaimToClaimFile\"},{\"name\":\"payment\",\"kind\":\"object\",\"type\":\"Payment\",\"relationName\":\"ClaimToPayment\"}],\"dbName\":null},\"ServiceLine\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"claimId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"paymentId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"procedureCode\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"procedureDate\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"quad\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"arch\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"toothNumber\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"toothSurface\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"icn\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"paidCode\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"allowedAmount\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"totalBilled\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"totalPaid\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"totalAdjusted\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"totalDue\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"status\",\"kind\":\"enum\",\"type\":\"ServiceLineStatus\"},{\"name\":\"claim\",\"kind\":\"object\",\"type\":\"Claim\",\"relationName\":\"ClaimToServiceLine\"},{\"name\":\"payment\",\"kind\":\"object\",\"type\":\"Payment\",\"relationName\":\"PaymentToServiceLine\"},{\"name\":\"serviceLineTransactions\",\"kind\":\"object\",\"type\":\"ServiceLineTransaction\",\"relationName\":\"ServiceLineToServiceLineTransaction\"}],\"dbName\":null},\"ClaimFile\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"claimId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"filename\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"mimeType\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"filePath\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"claim\",\"kind\":\"object\",\"type\":\"Claim\",\"relationName\":\"ClaimToClaimFile\"}],\"dbName\":null},\"InsuranceCredential\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"userId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"siteKey\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"username\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"password\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"user\",\"kind\":\"object\",\"type\":\"User\",\"relationName\":\"InsuranceCredentialToUser\"}],\"dbName\":null},\"ShoppingVendor\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"userId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"vendorName\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"websiteUrl\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"loginUsername\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"loginPassword\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"user\",\"kind\":\"object\",\"type\":\"User\",\"relationName\":\"ShoppingVendorToUser\"}],\"dbName\":null},\"PdfGroup\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"title\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"titleKey\",\"kind\":\"enum\",\"type\":\"PdfTitleKey\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"patientId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"patient\",\"kind\":\"object\",\"type\":\"Patient\",\"relationName\":\"PatientToPdfGroup\"},{\"name\":\"pdfs\",\"kind\":\"object\",\"type\":\"PdfFile\",\"relationName\":\"PdfFileToPdfGroup\"}],\"dbName\":null},\"PdfFile\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"filename\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"pdfData\",\"kind\":\"scalar\",\"type\":\"Bytes\"},{\"name\":\"uploadedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"groupId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"group\",\"kind\":\"object\",\"type\":\"PdfGroup\",\"relationName\":\"PdfFileToPdfGroup\"}],\"dbName\":null},\"Payment\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"claimId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"patientId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"userId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"updatedById\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"npiProviderId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"totalBilled\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"totalPaid\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"totalAdjusted\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"totalDue\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"mhPaidAmount\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"copayment\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"adjustment\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"status\",\"kind\":\"enum\",\"type\":\"PaymentStatus\"},{\"name\":\"notes\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"icn\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"claim\",\"kind\":\"object\",\"type\":\"Claim\",\"relationName\":\"ClaimToPayment\"},{\"name\":\"patient\",\"kind\":\"object\",\"type\":\"Patient\",\"relationName\":\"PatientToPayment\"},{\"name\":\"updatedBy\",\"kind\":\"object\",\"type\":\"User\",\"relationName\":\"PaymentUpdatedBy\"},{\"name\":\"npiProvider\",\"kind\":\"object\",\"type\":\"NpiProvider\",\"relationName\":\"NpiProviderToPayment\"},{\"name\":\"serviceLineTransactions\",\"kind\":\"object\",\"type\":\"ServiceLineTransaction\",\"relationName\":\"PaymentToServiceLineTransaction\"},{\"name\":\"serviceLines\",\"kind\":\"object\",\"type\":\"ServiceLine\",\"relationName\":\"PaymentToServiceLine\"},{\"name\":\"commissionBatchItems\",\"kind\":\"object\",\"type\":\"CommissionBatchItem\",\"relationName\":\"CommissionBatchItemToPayment\"}],\"dbName\":null},\"ServiceLineTransaction\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"paymentId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"serviceLineId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"transactionId\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"paidAmount\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"adjustedAmount\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"method\",\"kind\":\"enum\",\"type\":\"PaymentMethod\"},{\"name\":\"receivedDate\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"payerName\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"notes\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"payment\",\"kind\":\"object\",\"type\":\"Payment\",\"relationName\":\"PaymentToServiceLineTransaction\"},{\"name\":\"serviceLine\",\"kind\":\"object\",\"type\":\"ServiceLine\",\"relationName\":\"ServiceLineToServiceLineTransaction\"}],\"dbName\":null},\"DatabaseBackup\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"userId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"user\",\"kind\":\"object\",\"type\":\"User\",\"relationName\":\"DatabaseBackupToUser\"}],\"dbName\":null},\"BackupDestination\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"userId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"path\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"isActive\",\"kind\":\"scalar\",\"type\":\"Boolean\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"user\",\"kind\":\"object\",\"type\":\"User\",\"relationName\":\"BackupDestinationToUser\"}],\"dbName\":null},\"Notification\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"userId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"type\",\"kind\":\"enum\",\"type\":\"NotificationTypes\"},{\"name\":\"message\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"read\",\"kind\":\"scalar\",\"type\":\"Boolean\"},{\"name\":\"user\",\"kind\":\"object\",\"type\":\"User\",\"relationName\":\"NotificationToUser\"}],\"dbName\":null},\"CronJobLog\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"jobName\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"status\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"startedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"completedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"durationMs\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"errorMessage\",\"kind\":\"scalar\",\"type\":\"String\"}],\"dbName\":null},\"CloudFolder\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"userId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"name\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"parentId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"patientId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"parent\",\"kind\":\"object\",\"type\":\"CloudFolder\",\"relationName\":\"FolderChildren\"},{\"name\":\"children\",\"kind\":\"object\",\"type\":\"CloudFolder\",\"relationName\":\"FolderChildren\"},{\"name\":\"user\",\"kind\":\"object\",\"type\":\"User\",\"relationName\":\"CloudFolderToUser\"},{\"name\":\"patient\",\"kind\":\"object\",\"type\":\"Patient\",\"relationName\":\"PatientCloudFolder\"},{\"name\":\"files\",\"kind\":\"object\",\"type\":\"CloudFile\",\"relationName\":\"CloudFileToCloudFolder\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"}],\"dbName\":null},\"CloudFile\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"userId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"name\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"mimeType\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"fileSize\",\"kind\":\"scalar\",\"type\":\"BigInt\"},{\"name\":\"folderId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"isComplete\",\"kind\":\"scalar\",\"type\":\"Boolean\"},{\"name\":\"totalChunks\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"diskPath\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"user\",\"kind\":\"object\",\"type\":\"User\",\"relationName\":\"CloudFileToUser\"},{\"name\":\"folder\",\"kind\":\"object\",\"type\":\"CloudFolder\",\"relationName\":\"CloudFileToCloudFolder\"},{\"name\":\"chunks\",\"kind\":\"object\",\"type\":\"CloudFileChunk\",\"relationName\":\"CloudFileToCloudFileChunk\"}],\"dbName\":null},\"CloudFileChunk\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"fileId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"seq\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"data\",\"kind\":\"scalar\",\"type\":\"Bytes\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"file\",\"kind\":\"object\",\"type\":\"CloudFile\",\"relationName\":\"CloudFileToCloudFileChunk\"}],\"dbName\":null},\"Communication\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"patientId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"userId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"channel\",\"kind\":\"enum\",\"type\":\"CommunicationChannel\"},{\"name\":\"direction\",\"kind\":\"enum\",\"type\":\"CommunicationDirection\"},{\"name\":\"status\",\"kind\":\"enum\",\"type\":\"CommunicationStatus\"},{\"name\":\"provider\",\"kind\":\"enum\",\"type\":\"CommunicationProvider\"},{\"name\":\"body\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"callDuration\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"twilioSid\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"patient\",\"kind\":\"object\",\"type\":\"Patient\",\"relationName\":\"CommunicationToPatient\"},{\"name\":\"user\",\"kind\":\"object\",\"type\":\"User\",\"relationName\":\"CommunicationToUser\"}],\"dbName\":\"communications\"},\"PatientDocument\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"patientId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"filename\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"originalName\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"mimeType\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"fileSize\",\"kind\":\"scalar\",\"type\":\"BigInt\"},{\"name\":\"filePath\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"uploadedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"patient\",\"kind\":\"object\",\"type\":\"Patient\",\"relationName\":\"PatientToPatientDocument\"}],\"dbName\":null},\"TwilioSettings\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"userId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"accountSid\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"authToken\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"phoneNumber\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"greetingMessage\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"templates\",\"kind\":\"scalar\",\"type\":\"Json\"},{\"name\":\"user\",\"kind\":\"object\",\"type\":\"User\",\"relationName\":\"TwilioSettingsToUser\"}],\"dbName\":\"twilio_settings\"},\"TelnyxSettings\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"userId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"apiKey\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"accountSid\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"phoneNumber\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"texmlApplicationId\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"messagingProfileId\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"webhookPublicKey\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"greetingMessage\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"user\",\"kind\":\"object\",\"type\":\"User\",\"relationName\":\"TelnyxSettingsToUser\"}],\"dbName\":\"telnyx_settings\"},\"AiSettings\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"userId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"apiKey\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"aiEnabled\",\"kind\":\"scalar\",\"type\":\"Boolean\"},{\"name\":\"openAiKey\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"openAiEnabled\",\"kind\":\"scalar\",\"type\":\"Boolean\"},{\"name\":\"claudeAiKey\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"claudeAiEnabled\",\"kind\":\"scalar\",\"type\":\"Boolean\"},{\"name\":\"claudeAiModel\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"openAiModel\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"googleAiModel\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"dentalMgmtKey\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"dentalMgmtEnabled\",\"kind\":\"scalar\",\"type\":\"Boolean\"},{\"name\":\"afterHoursEnabled\",\"kind\":\"scalar\",\"type\":\"Boolean\"},{\"name\":\"openPhoneReply\",\"kind\":\"scalar\",\"type\":\"Boolean\"},{\"name\":\"user\",\"kind\":\"object\",\"type\":\"User\",\"relationName\":\"AiSettingsToUser\"}],\"dbName\":\"ai_settings\"},\"OfficeHours\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"userId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"data\",\"kind\":\"scalar\",\"type\":\"Json\"},{\"name\":\"user\",\"kind\":\"object\",\"type\":\"User\",\"relationName\":\"OfficeHoursToUser\"}],\"dbName\":\"office_hours\"},\"OfficeContact\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"userId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"legalName\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"officeName\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"receptionistName\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"dentistName\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"phoneNumber\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"email\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"fax\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"streetAddress\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"city\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"state\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"zipCode\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"billingName\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"billingNpi\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"billingLicense\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"billingTaxId\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"user\",\"kind\":\"object\",\"type\":\"User\",\"relationName\":\"OfficeContactToUser\"}],\"dbName\":\"office_contact\"},\"InsuranceContact\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"userId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"name\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"phoneNumber\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"user\",\"kind\":\"object\",\"type\":\"User\",\"relationName\":\"InsuranceContactToUser\"}],\"dbName\":\"insurance_contact\"},\"ProcedureTimeslot\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"userId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"data\",\"kind\":\"scalar\",\"type\":\"Json\"},{\"name\":\"user\",\"kind\":\"object\",\"type\":\"User\",\"relationName\":\"ProcedureTimeslotToUser\"}],\"dbName\":\"procedure_timeslot\"},\"PatientConversation\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"patientId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"userId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"stage\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"aiHandoff\",\"kind\":\"scalar\",\"type\":\"Boolean\"},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"patient\",\"kind\":\"object\",\"type\":\"Patient\",\"relationName\":\"PatientToPatientConversation\"},{\"name\":\"user\",\"kind\":\"object\",\"type\":\"User\",\"relationName\":\"PatientConversationToUser\"}],\"dbName\":\"patient_conversation\"},\"PatientServiceHistory\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"patientId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"procedureCode\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"description\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"toothQuadArchSurface\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"placeOfService\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"serviceDate\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"patient\",\"kind\":\"object\",\"type\":\"Patient\",\"relationName\":\"PatientToPatientServiceHistory\"}],\"dbName\":\"patient_service_history\"},\"PatientPreauthHistory\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"patientId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"preAuthNumber\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"submittedCode\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"toothQuadArchSurface\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"paidAmount\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"status\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"patient\",\"kind\":\"object\",\"type\":\"Patient\",\"relationName\":\"PatientToPatientPreauthHistory\"}],\"dbName\":\"patient_preauth_history\"},\"LabRxTemplate\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"userId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"name\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"labName\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"labPhone\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"labFax\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"labAddress\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"labAccount\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"caseType\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"material\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"instructions\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"sortOrder\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"user\",\"kind\":\"object\",\"type\":\"User\",\"relationName\":\"LabRxTemplateToUser\"}],\"dbName\":\"lab_rx_template\"},\"CommissionBatch\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"npiProviderId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"totalCollection\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"commissionAmount\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"notes\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"npiProvider\",\"kind\":\"object\",\"type\":\"NpiProvider\",\"relationName\":\"CommissionBatchToNpiProvider\"},{\"name\":\"items\",\"kind\":\"object\",\"type\":\"CommissionBatchItem\",\"relationName\":\"CommissionBatchToCommissionBatchItem\"}],\"dbName\":null},\"CommissionBatchItem\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"commissionBatchId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"paymentId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"collectionAmount\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"commissionBatch\",\"kind\":\"object\",\"type\":\"CommissionBatch\",\"relationName\":\"CommissionBatchToCommissionBatchItem\"},{\"name\":\"payment\",\"kind\":\"object\",\"type\":\"Payment\",\"relationName\":\"CommissionBatchItemToPayment\"}],\"dbName\":null},\"SeleniumSettings\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"userId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"paymentGroupId\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"user\",\"kind\":\"object\",\"type\":\"User\",\"relationName\":\"SeleniumSettingsToUser\"}],\"dbName\":\"selenium_settings\"}},\"enums\":{},\"types\":{}}")
diff --git a/packages/db/generated/prisma/package.json b/packages/db/generated/prisma/package.json
index 5c509c3c..3621af30 100644
--- a/packages/db/generated/prisma/package.json
+++ b/packages/db/generated/prisma/package.json
@@ -1,5 +1,5 @@
{
- "name": "prisma-client-32b9f11a0c5c7afdeeb154c1948bfe50de9e1462e57080389ada2ebd794fa5e4",
+ "name": "prisma-client-5ef9a1d7eab38844c979ecf827cfa9b9b5ebfdee813a113aab886483d3d210c6",
"main": "index.js",
"types": "index.d.ts",
"browser": "default.js",
diff --git a/packages/db/generated/prisma/schema.prisma b/packages/db/generated/prisma/schema.prisma
index f2894b69..74e2a934 100755
--- a/packages/db/generated/prisma/schema.prisma
+++ b/packages/db/generated/prisma/schema.prisma
@@ -258,6 +258,7 @@ enum ClaimStatus {
REVIEW
VOID
PREAUTH
+ DENIED
}
enum MissingTeethStatus {
diff --git a/packages/db/prisma/migrations/20261110000000_add_claim_status_denied/migration.sql b/packages/db/prisma/migrations/20261110000000_add_claim_status_denied/migration.sql
new file mode 100644
index 00000000..7949f03a
--- /dev/null
+++ b/packages/db/prisma/migrations/20261110000000_add_claim_status_denied/migration.sql
@@ -0,0 +1,2 @@
+-- AlterEnum
+ALTER TYPE "ClaimStatus" ADD VALUE 'DENIED';
diff --git a/packages/db/prisma/schema.prisma b/packages/db/prisma/schema.prisma
index c4a9ab38..e818ff09 100755
--- a/packages/db/prisma/schema.prisma
+++ b/packages/db/prisma/schema.prisma
@@ -259,6 +259,7 @@ enum ClaimStatus {
REVIEW
VOID
PREAUTH
+ DENIED
}
enum MissingTeethStatus {
diff --git a/packages/db/shared/.prisma-zod-generator-manifest.json b/packages/db/shared/.prisma-zod-generator-manifest.json
index 82410156..e8403241 100755
--- a/packages/db/shared/.prisma-zod-generator-manifest.json
+++ b/packages/db/shared/.prisma-zod-generator-manifest.json
@@ -1,7 +1,7 @@
{
"version": "1.0",
"generatorVersion": "1.0.0",
- "generatedAt": "2026-11-09T16:51:33.389Z",
+ "generatedAt": "2026-11-10T15:57:34.274Z",
"outputPath": "/home/ee/Desktop/DentalManagement09/packages/db/shared",
"files": [
"schemas/enums/TransactionIsolationLevel.schema.ts",
diff --git a/packages/db/shared/schemas/enums/ClaimStatus.schema.ts b/packages/db/shared/schemas/enums/ClaimStatus.schema.ts
index 884792fc..bbe5808b 100644
--- a/packages/db/shared/schemas/enums/ClaimStatus.schema.ts
+++ b/packages/db/shared/schemas/enums/ClaimStatus.schema.ts
@@ -1,5 +1,5 @@
import * as z from 'zod';
-export const ClaimStatusSchema = z.enum(['PENDING', 'APPROVED', 'CANCELLED', 'REVIEW', 'VOID', 'PREAUTH'])
+export const ClaimStatusSchema = z.enum(['PENDING', 'APPROVED', 'CANCELLED', 'REVIEW', 'VOID', 'PREAUTH', 'DENIED'])
export type ClaimStatus = z.infer;
\ No newline at end of file
|