generator client {
  provider      = "prisma-client-js"
  binaryTargets = ["native", "rhel-openssl-1.0.x"]
}

datasource db {
  provider = "postgresql"
  url = env("DATABASE_PRISMA_URL")
  directUrl = env("DATABASE_URL_NON_POOLING")
}

model User {
  id Int @id @default(autoincrement())

  username      String @unique
  passwordHash  String
  userAuthToken String @unique

  createdAt DateTime @default(now())
  updatedAt DateTime @updatedAt
  Timer     Timer?

  @@map("user")
}

model Timer {
  id                   Int     @id @default(autoincrement())
  user_id              Int     @unique
  breakInterval        Int     @default(20)
  miniBreakDuration    Int     @default(20)
  longBreakDuration    Int     @default(5)
  soundEnabled         Boolean @default(true)
  notificationsEnabled Boolean @default(true)

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

  @@index([user_id])
  @@map("Timer")
}
