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

generator client {
  provider = "prisma-client-js"
  // output   = "./generated/client"
}

model User {
  id                String   @id @default(cuid())
  username          String   @unique
  password          String
  displayName       String
  createdAt         DateTime @default(now())
  updatedAt         DateTime @updatedAt

  Session           Session[]
  UserPreferences   UserPreferences?
}

model Session {
  id        String @id
  userId    String
  expiresAt DateTime

  user      User @relation(references: [id], fields: [userId], onDelete: Cascade)

  @@index([userId])
}

model UserPreferences {
  userId              String  @id
  toggleInputHotkey   String? @default("")
  toggleOutputHotkey  String? @default("")
  volumes             Json?   @default("{}")

  user                User    @relation(fields: [userId], references: [id], onDelete: Cascade)
}