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

// Looking for ways to speed up your queries, or scale easily with your serverless or edge functions?
// Try Prisma Accelerate: https://pris.ly/cli/accelerate-init

generator client {
  provider = "prisma-client"
  output   = "../src/generated/prisma"
}

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

model Project {
  id          String   @id @default(uuid())
  title       String
  slug        String   @unique
  status      ProjectStatus @default(DRAFT)
  contentJson Json
  createdAt   DateTime @default(now())
  updatedAt   DateTime @updatedAt

  assets      Asset[]
}

model Asset {
  id        String   @id @default(uuid())
  project   Project  @relation(fields: [projectId], references: [id], onDelete: Cascade)
  projectId String
  kind      String
  url       String
  hash      String?
  meta      Json?
  createdAt DateTime @default(now())
}

enum ProjectStatus {
  DRAFT
  PUBLISHED
  ARCHIVED
}
