export const CATEGORIES = ["Celulares", "Informática", "Áudio", "Moda", "Casa"] as const;
export type Category = (typeof CATEGORIES)[number];
export type AttrValue = string | number | boolean;

/** Produto como o frontend consome. Em produção vem da API; o componente visual só conhece este formato. */
export interface Product {
  id: number;
  title: string;
  priceCents: number;
  originalPriceCents?: number;
  installments: number;
  rating: number;
  reviews: number;
  freeShipping: boolean;
  eta?: string;
  verified?: boolean;
  badge?: string;
  /** Foto real. Se vazio, o card usa a ilustração `art`. */
  imageUrl?: string | null;
  /** srcset gerado pelo script de importação (400/800/1200 px). */
  imageSrcSet?: string | null;
  art: string;
  brand: string;
  cat: Category;
  attrs: Record<string, AttrValue>;
}

export interface CartItem { id: number; q: number }
export interface Order {
  id: string; date: string; status: 0 | 1 | 2 | 3; items: CartItem[]; total: number; pay: string;
}
export type SortKey = "rel" | "pa" | "pd" | "vend" | "nota" | "novo";
export interface SearchState {
  q: string; c: string; t: string[]; brand: string[];
  pmin: number | null; pmax: number | null;
  free: boolean; offer: boolean; ver: boolean; rating: number;
  attr: Record<string, string[]>; sort: SortKey; view: "grid" | "list"; n: number;
}
