All files / varjoliitokauppa types.ts

0% Statements 0/0
0% Branches 0/0
0% Functions 0/0
0% Lines 0/0

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115                                                                                                                                                                                                                                     
export interface ColorVariant {
  name: string;
  hex: string;
  stock: number;
}
 
export interface SizeVariant {
  name: string;
  stock: number; // used when sizes-only; ignored when colorStocks present
  colorStocks?: { colorName: string; stock: number }[]; // per-color stock when product has both sizes + colors
}
 
export interface Product {
  id: string;
  name: string;
  price: number;
  salePrice?: number;
  category: string;
  subcategory: string;
  shortDescription: string;
  description: string;
  images: string[];
  isNew?: boolean;
  isUsed?: boolean;
  condition?: string; // For used items
  stock: number; // Total stock or stock for non-color products
  brand?: string;
  specs?: Record<string, string>;
  colors?: ColorVariant[] | null; // Color variants with individual stock
  sizes?: SizeVariant[] | null; // Size variants with individual stock
}
 
export interface CategoryNode {
  name: string;
  subcategories?: string[];
}
 
export interface CartItem extends Product {
  quantity: number;
  selectedColor?: string | null; // Selected color name (if product has color variants)
  selectedSize?: string | null; // Selected size name (if product has size variants)
}
 
export interface Review {
  id: string;
  author: string;
  rating: number; // 1-5
  text: string;
  status: 'pending' | 'approved' | 'rejected';
  date: string;
  productId?: string | null;
}
 
export interface AdminReview extends Review {
  product?: Product | null;
  createdAt: Date;
  updatedAt: Date;
}
 
export interface Order {
  id: string;
  customer: {
    name: string;
    email: string;
    phone: string;
    address: string;
    city: string;
    zip: string;
    notes?: string;
  };
  items: CartItem[];
  total: number;
  status: 'pending' | 'processing' | 'shipped' | 'delivered' | 'cancelled';
  shippingMethod: string;
  date: string;
}
 
export interface AdminOrder {
  id: string;
  customerName: string;
  customerEmail: string;
  customerPhone: string;
  customerAddress: string;
  customerCity: string;
  customerZip: string;
  notes?: string | null;
  total: number;
  status: 'pending' | 'processing' | 'shipped' | 'delivered' | 'cancelled';
  shippingMethod: string;
  createdAt: Date;
  items?: {
    id: string;
    quantity: number;
    price: number;
    selectedColor?: string | null;
    selectedSize?: string | null;
    product: Product;
  }[];
}
 
export interface CategoryImage {
  id: string;
  categoryName: string;
  imageUrl: string;
  createdAt: Date;
  updatedAt: Date;
}
 
export type FilterState = {
  category: string;
  subcategory: string;
  minPrice: number;
  maxPrice: number;
  sort: 'newest' | 'priceAsc' | 'priceDesc' | 'popular';
};