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

datasource db {
  provider = "postgresql"
}

enum Role {
  ADMIN
  USER
}

model User {
  id        String    @id @default(cuid())
  name      String?
  email     String    @unique
  password  String?
  role      Role      @default(USER)
  createdAt DateTime  @default(now())
  updatedAt DateTime  @updatedAt
  deletedAt DateTime?
  accounts  Account[]
  sessions  Session[]
}

model Account {
  id                String  @id @default(cuid())
  userId            String
  type              String
  provider          String
  providerAccountId String
  refresh_token     String? @db.Text
  access_token      String? @db.Text
  expires_at        Int?
  token_type        String?
  scope             String?
  id_token          String? @db.Text
  session_state     String?

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

  @@unique([provider, providerAccountId])
}

model Session {
  id           String   @id @default(cuid())
  sessionToken String   @unique
  userId       String
  expires      DateTime
  user         User     @relation(fields: [userId], references: [id], onDelete: Cascade)
}

model VerificationToken {
  identifier String
  token      String   @unique
  expires    DateTime

  @@unique([identifier, token])
}

enum RoomType {
  STUDIO_1_0
  SUITE_1_1
}

model Room {
  id            String        @id @default(cuid())
  slug          String        @unique
  type          RoomType
  nameTr        String
  nameEn        String
  nameDe        String
  descriptionTr String
  descriptionEn String
  descriptionDe String
  capacity      Int
  price         Int?
  imageUrl      String?
  images        String[]
  amenities     String[]
  available     Boolean       @default(true)
  featured      Boolean       @default(false)
  createdAt     DateTime      @default(now())
  updatedAt     DateTime      @updatedAt
  deletedAt     DateTime?
  reservations  Reservation[]
}

enum ReservationStatus {
  PENDING
  CONFIRMED
  CANCELLED
}

model Reservation {
  id        String            @id @default(cuid())
  roomId    String
  room      Room              @relation(fields: [roomId], references: [id])
  checkIn   DateTime
  checkOut  DateTime
  adults    Int
  children  Int               @default(0)
  fullName  String
  email     String
  phone     String
  message   String?
  status    ReservationStatus @default(PENDING)
  createdAt DateTime          @default(now())
  updatedAt DateTime          @updatedAt
  deletedAt DateTime?
}

model ContactMessage {
  id        String    @id @default(cuid())
  fullName  String
  email     String
  phone     String
  message   String    @db.Text
  read      Boolean   @default(false)
  createdAt DateTime  @default(now())
  updatedAt DateTime  @updatedAt
  deletedAt DateTime?
}

model Gallery {
  id        String   @id @default(cuid())
  url       String
  category  String?
  createdAt DateTime @default(now())
  updatedAt DateTime @updatedAt
}
