// 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"
  previewFeatures = ["typedSql"]
}

generator json {
  provider = "prisma-json-types-generator"
}

datasource db {
  provider = "postgresql"
}

model Contact {
  id          String    @id @default(uuid()) @db.Uuid
  firstName   String    @db.VarChar(255)
  lastName    String?   @db.VarChar(255)
  description String?   @db.VarChar(255)
  avatar      String    @default("/avatars/placeholder.png") @db.VarChar(255)
  /// [ContactInfo]
  contactInfo Json      @default("[]") @db.JsonB
  favorite    Boolean   @default(false) @db.Boolean
  meetings    Meeting[]
  tags        Tag[]
}

model Meeting {
  id          String   @id @default(uuid()) @db.Uuid
  title       String
  description String?
  date        DateTime
  // Komt overeen met CONTRAINT FK_Meeting_Contact FOREIGN KEY (contactId) REFERENCES Contact(id) ON DELETE CASCADE
  contact     Contact  @relation(fields: [contactId], references: [id], onDelete: Cascade)
  contactId   String   @db.Uuid
}

model Tag {
  id          String    @id @default(uuid()) @db.Uuid
  name        String
  description String?
  contacts    Contact[]
}
