/**
 * Shared cart types for client and server
 * These types mirror the server-side types from server/utils/cart-helpers.ts
 */

/**
 * Cart item with product details and computed subtotal
 */
export interface CartItemWithProduct {
  id: string
  cartId: string
  productId: string
  quantity: number
  addedAt: Date
  product: {
    id: string
    name: string
    description: string | null
    price: string
    stockQuantity: number
    active: boolean
    category: string | null
    imageUrl: string | null
    navProductId: string
  }
  subtotal: number
}

/**
 * Cart summary with items and totals
 */
export interface CartSummary {
  cart: {
    id: string
    userId: string | null
    sessionId: string
    createdAt: Date
    updatedAt: Date
  }
  items: CartItemWithProduct[]
  total: number
  itemCount: number
  removedItems?: string[] // Names of products that were removed due to unavailability
}
