import { Item } from '../../../models';
import { Category } from '../../categories/models/category-domain.model';

export type Product = Item;
export type ProductCategory = Category;
export type ProductSort = 'relevance' | 'price_asc' | 'price_desc' | 'popular' | 'rating' | 'latest';

export interface ProductFilters {
  categoryIDs?: number[];
  minPrice?: number;
  maxPrice?: number;
  tag?: string;
  badges?: string[];
  inStockOnly?: boolean;
}

export interface ProductListQuery extends ProductFilters {
  count?: number;
  skip?: number;
  sort?: ProductSort;
}

export interface ProductSearchQuery extends ProductListQuery {
  search: string;
}

export interface ProductListResult {
  items: Product[];
  total: number;
  count: number;
  skip: number;
}

export interface RelatedProductsQuery {
  productID: number;
  categoryID?: number;
  count?: number;
}

export interface RelatedProductCollection {
  id: string;
  title: string;
  titles?: Record<string, string>;
  productIDs: number[];
}

export interface ProductVariantSelection {
  [groupKey: string]: string;
}
