// This is your Prisma schema file,
// learn more about it in the docs: https://pris.ly/d/prisma-schema

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

datasource db {
  provider          = "postgresql"
  url               = env("DATABASE_URL")
  shadowDatabaseUrl = env("SHADOW_DATABASE_URL")
}

model FaucetConfig {
  id        Int      @id @default(autoincrement())
  amount    Int      @default(1)
  createdAt DateTime @default(now())
  updatedAt DateTime @updatedAt
}

model FaucetDrawRecord {
  id        Int      @id @default(autoincrement())
  address   String   @unique
  drawTime  DateTime
  createdAt DateTime @default(now())
  updatedAt DateTime @updatedAt
}

model Account {
  id                       String  @id @default(cuid())
  userId                   String
  type                     String
  provider                 String
  providerAccountId        String
  refresh_token            String? @db.Text
  refresh_token_expires_in Int?
  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 User {
  id            String    @id @default(cuid())
  name          String?
  email         String?   @unique
  emailVerified DateTime?
  image         String?
  role          String?
  accounts      Account[]
  sessions      Session[]
}

model VerificationToken {
  identifier String
  token      String   @unique
  expires    DateTime

  @@unique([identifier, token])
}

model NoahNFT {
  id          Int      @id @default(autoincrement())
  owner       String?
  tokenId     Int?
  metadataUri String
  name        String
  description String
  image       String
  externalUri String
  attributes  Json
  creator     String
  createdAt   DateTime @default(now())
  updatedAt   DateTime @updatedAt
}

model CreatorRequest {
  id        Int      @id @default(autoincrement())
  address   String
  name      String
  email     String
  reason    String
  status    String   @default("pending")
  createdAt DateTime @default(now())
  updatedAt DateTime @updatedAt
}

model NFTSync {
  id              Int      @id @default(autoincrement())
  fromBlockNumber Int
  toBlockNumber   Int
  timeConsumed    Int
  createdAt       DateTime @default(now())
  updatedAt       DateTime @updatedAt
}
