// 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"
}

model categories {
  id         Int      @id @default(autoincrement())
  name       String   @db.VarChar(100)
  name_tr    String   @db.Text
  slug       String   @db.VarChar(100)
  order_num  Int?     @default(0)
  status     Int?       @default(1) @db.SmallInt
  created_at DateTime   @default(now()) @db.Timestamp(0)
  products   products[]
}

model products {
  id                Int         @id @default(autoincrement())
  category_id       Int?
  category          categories? @relation(fields: [category_id], references: [id])
  name              String      @db.VarChar(255)
  name_tr           String   @db.VarChar(255)
  slug              String   @db.VarChar(255)
  short_description String?  @db.VarChar(255)
  description       String?  @db.Text
  description_tr    String   @db.Text
  price             Decimal  @db.Decimal(10, 2)
  image_url         String?  @db.VarChar(255)
  status            Int?     @default(1) @db.SmallInt
  created_at        DateTime @default(now()) @db.Timestamp(0)
  updated_at        DateTime @default(now()) @updatedAt @db.Timestamp(0)
}

model users {
  id            Int      @id @default(autoincrement())
  username      String   @unique @db.VarChar(50)
  password_hash String   @db.VarChar(255)
  role          String   @default("admin") @db.VarChar(50)
  created_at    DateTime @default(now()) @db.Timestamp(0)
  updated_at    DateTime @default(now()) @updatedAt @db.Timestamp(0)
}

model settings {
  key           String   @id @db.VarChar(100)
  value         String   @db.Text
  updated_at    DateTime @default(now()) @updatedAt @db.Timestamp(0)
}
