datasource db {
    url      = DATABASE_URL
    provider = DIALECT
}

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

model User {
    user_id   String   @unique
    name      String
    thumbnail String?
    metadata  Json?
    createdAt DateTime @default(now())
    updatedAt DateTime @updatedAt
    sender    Chat[]   @relation("sender")
    receiver  Chat[]   @relation("receiver")
}

model Chat {
    id          String   @id @default(uuid())
    sender      User     @relation("sender", fields: [sender_id], references: [user_id])
    receiver    User     @relation("receiver", fields: [receiver_id], references: [user_id])
    message     String
    sender_id   String
    receiver_id String
    metadata    Json?
    seen        Boolean  @default(false)
    createdAt   DateTime @default(now())
    updatedAt   DateTime @updatedAt
}