import type { IProductCardProps } from '@/components/pages/products/productCard/productCard.d';
import { productCategoriesData } from '../../data';
import {
  ghazaghiCategoryProducts,
  ghermezCategoryProducts,
  semiromCategoryProducts,
  zardCategoryProducts,
} from './productsSeparatedByCode';

export const productsRelatedByCategory = {
  '1': ghazaghiCategoryProducts,
  '2': ghermezCategoryProducts,
  '3': zardCategoryProducts,
  '40': semiromCategoryProducts,
};

// Helper to generate 50 products for a category
export function generateProductsForCategory(
  categoryId: string,
): IProductCardProps[] {
  // @ts-ignore
  const relatedProducts = (productsRelatedByCategory[categoryId] ||
    []) as IProductCardProps[];

  return Array.from(relatedProducts, (related, i) => ({
    ...related,
    id: `${categoryId}-${i + 1}`,
    title: `${related.model}`,
    imageSrc: `/images/product${(i % 4) + 1}.png`,
  }));
}
