generator client {
  provider = "prisma-client-js"
}

datasource db {
  provider = "sqlite"
  url      = env("DATABASE_URL")
}

model Client {
  id          String    @id @default(cuid())
  name        String
  email       String?   @unique
  phone       String?
  company     String?
  website     String?
  clientNotes String?
  createdAt   DateTime  @default(now())
  updatedAt   DateTime  @updatedAt
  bookings    Booking[]
}

model Booking {
  id          String    @id @default(cuid())
  clientId    String
  title       String?
  description String?
  notes       String?
  location    String?
  startDate   DateTime?
  endDate     DateTime?
  startTime   String?
  endTime     String?
  duration    Float?
  hourlyRate  Float?
  flatRate    Float?
  totalAmount Float?
  status      String    @default("new")
  source      String?
  createdAt   DateTime  @default(now())
  updatedAt   DateTime  @updatedAt
  client      Client     @relation(fields: [clientId], references: [id])
}

model Config {
  id                   String   @id @default(cuid())
  companyName          String?
  companyAddress       String?
  companyPhone         String?
  companyEmail         String?
  logoUrl              String?
  bankName             String?
  bankAddress          String?
  bankPhone            String?
  bankAccount          String?
  bankRouting          String?
  bankWire             String?
  servicesPerformed    String?
  contactHandle        String?
  includeTerms         Boolean?
  terms                String?
  serverUrl            String?  @default("http://127.0.0.1")
  serverPort           String?  @default("3000")
  dbProvider           String?  @default("local_prisma_sqlite")
  dbPath               String?  @default("../data/leedz_invoicer.sqlite")
  mcpHost              String?  @default("127.0.0.1")
  mcpPort              String?  @default("3001")
  llmApiKey            String?
  llmProvider          String?  @default("claude-opus-4-1-20250805")
  llmBaseUrl           String?  @default("https://api.anthropic.com")
  llmAnthropicVersion  String?  @default("2023-06-01")
  llmMaxTokens         Int?     @default(1024)
  businessDescription  String?
  createdAt            DateTime @default(now())
  updatedAt            DateTime @updatedAt
}
