model Account {
    id                 Int       @id @default(autoincrement())
    compoundId         String    @unique @map(name: "compound_id")
    userId             Int       @map(name: "user_id")
    providerType       String    @map(name: "provider_type")
    providerId         String    @map(name: "provider_id")
    providerAccountId  String    @map(name: "provider_account_id")
    refreshToken       String?   @map(name: "refresh_token")
    accessToken        String?   @map(name: "access_token")
    accessTokenExpires DateTime? @map(name: "access_token_expires")
    createdAt          DateTime  @default(now()) @map(name: "created_at")
    updatedAt          DateTime  @default(now()) @map(name: "updated_at")

    @@index([providerAccountId], name: "providerAccountId")
    @@index([providerId], name: "providerId")
    @@index([userId], name: "userId")
    @@map(name: "accounts")
}

model Session {
    id           Int      @id @default(autoincrement())
    userId       Int      @map(name: "user_id")
    expires      DateTime
    sessionToken String   @unique @map(name: "session_token")
    accessToken  String   @unique @map(name: "access_token")
    createdAt    DateTime @default(now()) @map(name: "created_at")
    updatedAt    DateTime @default(now()) @map(name: "updated_at")

    @@map(name: "sessions")
}

model VerificationRequest {
    id         Int      @id @default(autoincrement())
    identifier String
    token      String   @unique
    expires    DateTime
    createdAt  DateTime @default(now()) @map(name: "created_at")
    updatedAt  DateTime @default(now()) @map(name: "updated_at")

    @@map(name: "verification_requests")
}

model OAuthToken {
    id          Int      @id @default(autoincrement())
    userId      String   @map(name: "user_id")
    clientId    String   @map(name: "client_id")
    accessToken String   @unique @map(name: "access_token")
    createdAt   DateTime @default(now()) @map(name: "created_at")
    updatedAt   DateTime @default(now()) @map(name: "updated_at")

    // relations:
    user User @relation(fields: [userId], references: [id]) // Beziehung zu User

    @@map(name: "oauth_tokens")
}
