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

model User {
  id        Int      @id @default(autoincrement())
  createdAt DateTime @default(now())
  email     String   @unique
  passwordHash String
  firstname String
  surname   String
  // pfpUrl String
  role      Role     @default(USER)
}

model Earthquake {
  id        Int      @id @default(autoincrement())
  createdAt DateTime @default(now())
  updatedAt DateTime @updatedAt
  code String @unique
  name      String   @db.VarChar(255)
  date      DateTime 
  location String
  longitude String
  latitude String
  magnitude Float 
  depth Float
  casualties Int

  creator    User?    @relation(fields: [creatorId], references: [id])
  creatorId  Int?

  observatory    Observatory?    @relation(fields: [observatoryId], references: [id])
  observatoryId  Int? 
}

model Observatory {
    id Int @id @default(autoincrement()) 
}

enum Role {
  USER
  ADMIN
}