export const WISHLIST_PATH = "/wishlist";

export type StockStatus = "in_stock" | "low_stock" | "out_of_stock" | "unavailable";

export const STOCK_STATUS_CONFIG: Record<
  StockStatus,
  { label: string; colorClass: string }
> = {
  in_stock: { label: "In Stock", colorClass: "bg-green-50 text-green-700" },
  low_stock: { label: "Low Stock", colorClass: "bg-[#fde8c8] text-[#b36a10]" },
  out_of_stock: {
    label: "Out of Stock",
    colorClass: "bg-[#fce0da] text-[var(--coral)]",
  },
  unavailable: { label: "Unavailable", colorClass: "bg-gray-100 text-gray-500" },
};

const LOW_STOCK_THRESHOLD = 5;

export function getStockStatus(
  productStatus?: string,
  stockQuantity?: number,
): StockStatus {
  if (!productStatus || productStatus !== "active") return "unavailable";
  if (stockQuantity === undefined || stockQuantity === 0) return "out_of_stock";
  if (stockQuantity <= LOW_STOCK_THRESHOLD) return "low_stock";
  return "in_stock";
}
