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

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

model Order {
  id          String @id @default(cuid())
  orderNumber String @unique

  // Product
  product    String  // "samarreta" | "mitjons" | "pack"
  sizeTshirt String? // S | M | L | XL | XXL | 3XL
  sizeSocks  String? // XXS | XS | S | M | L | XL

  // Pricing
  baseAmount     Float
  shippingAmount Float @default(0)
  totalAmount    Float

  // Customer data
  nom      String
  cognoms  String
  telefon  String
  email    String

  // Shipping address (required for Correos, optional for pickup)
  adreca     String?
  codiPostal String?
  poblacio   String?
  provincia  String?

  // Delivery method
  shipping String // "correos" | "recollida"

  // Payment
  stripeSessionId String? @unique
  stripePaymentId String?
  status          String  @default("PENDING")
  // PENDING | PAID | PREPARING | SHIPPED | DELIVERED | CANCELLED

  notes String?

  createdAt DateTime @default(now())
  updatedAt DateTime @updatedAt
}
