enum Currency {
  UAH
}

model Store {
  id                   Int                    @id @default(autoincrement())
  uuid                 String?                @unique @default(uuid()) @db.VarChar(255)
  active               Boolean?               @default(false)
  slug                 String?                @unique @db.VarChar(255)
  image                String?                @db.VarChar(512)
  currency             Currency?              @default(UAH)
  storeLocale          StoreLocale[]
  categoriesOnPruducts CategoriesOnProducts[]
  createdAt            DateTime               @default(now()) @map("created_at") @db.Timestamp(3)
  updatedAt            DateTime?              @default(dbgenerated("NULL DEFAULT NULL ON UPDATE current_timestamp(3)")) @map("updated_at") @db.Timestamp(3)

  @@map("stores")
}

model StoreLocale {
  id           Int      @id @default(autoincrement())
  store        Store    @relation(fields: [storeId], references: [id], onDelete: Cascade)
  storeId      Int      @map("store_id")
  lang         Lang     @default(uk)
  status       Boolean? @default(true)
  title        String   @db.VarChar(384)
  slug         String?  @db.VarChar(384)
  motto        String?  @map("motto")
  shortTitle   String?  @map("short_title")
  description  String?  @db.Text
  content      String?  @db.MediumText
  extendedData Json?    @map("extended_data") @db.Json
  meta         Meta?    @relation(fields: [metaId], references: [id])
  metaId       Int?     @map("meta_id")

  @@unique([storeId, slug, lang])
  @@map("store_locale")
}
