import { GoogleCategory } from '@/types/catalog';

export const GOOGLE_CATEGORIES: GoogleCategory[] = [
  { id: '1', name: 'Animals & Pet Supplies', full_path: 'Animals & Pet Supplies', path: 'Animals & Pet Supplies' },
  { id: '2', name: 'Bird Supplies', full_path: 'Animals & Pet Supplies > Bird Supplies', path: 'Animals & Pet Supplies > Bird Supplies' },
  { id: '3', name: 'Cat Supplies', full_path: 'Animals & Pet Supplies > Cat Supplies', path: 'Animals & Pet Supplies > Cat Supplies' },
  { id: '4', name: 'Dog Supplies', full_path: 'Animals & Pet Supplies > Dog Supplies', path: 'Animals & Pet Supplies > Dog Supplies' },
  { id: '5', name: 'Fish Supplies', full_path: 'Animals & Pet Supplies > Fish Supplies', path: 'Animals & Pet Supplies > Fish Supplies' },
  { id: '6', name: 'Pet Food', full_path: 'Animals & Pet Supplies > Pet Food', path: 'Animals & Pet Supplies > Pet Food' },
  { id: '7', name: 'Pet Toys', full_path: 'Animals & Pet Supplies > Pet Toys', path: 'Animals & Pet Supplies > Pet Toys' },
  { id: '8', name: 'Pet Apparel', full_path: 'Animals & Pet Supplies > Pet Apparel', path: 'Animals & Pet Supplies > Pet Apparel' },
  { id: '166', name: 'Apparel & Accessories', full_path: 'Apparel & Accessories', path: 'Apparel & Accessories' },
  { id: '167', name: 'Clothing', full_path: 'Apparel & Accessories > Clothing', path: 'Apparel & Accessories > Clothing' },
  { id: '212', name: 'Dresses', full_path: 'Apparel & Accessories > Clothing > Dresses', path: 'Apparel & Accessories > Clothing > Dresses' },
  { id: '207', name: 'Shirts & Tops', full_path: 'Apparel & Accessories > Clothing > Shirts & Tops', path: 'Apparel & Accessories > Clothing > Shirts & Tops' },
  { id: '204', name: 'Pants', full_path: 'Apparel & Accessories > Clothing > Pants', path: 'Apparel & Accessories > Clothing > Pants' },
  { id: '213', name: 'Skirts', full_path: 'Apparel & Accessories > Clothing > Skirts', path: 'Apparel & Accessories > Clothing > Skirts' },
  { id: '203', name: 'Outerwear & Jackets', full_path: 'Apparel & Accessories > Clothing > Outerwear', path: 'Apparel & Accessories > Clothing > Outerwear' },
  { id: '211', name: 'Swimwear', full_path: 'Apparel & Accessories > Clothing > Swimwear', path: 'Apparel & Accessories > Clothing > Swimwear' },
  { id: '208', name: 'Underwear & Socks', full_path: 'Apparel & Accessories > Clothing > Underwear & Socks', path: 'Apparel & Accessories > Clothing > Underwear & Socks' },
  { id: '187', name: 'Shoes', full_path: 'Apparel & Accessories > Shoes', path: 'Apparel & Accessories > Shoes' },
  { id: '169', name: 'Handbags & Wallets', full_path: 'Apparel & Accessories > Handbags & Wallets', path: 'Apparel & Accessories > Handbags & Wallets' },
  { id: '188', name: 'Jewelry & Watches', full_path: 'Apparel & Accessories > Jewelry & Watches', path: 'Apparel & Accessories > Jewelry & Watches' },
  { id: '178', name: 'Sunglasses & Eyewear', full_path: 'Apparel & Accessories > Sunglasses & Eyewear', path: 'Apparel & Accessories > Sunglasses & Eyewear' },
  { id: '536', name: 'Baby & Toddler', full_path: 'Baby & Toddler', path: 'Baby & Toddler' },
  { id: '542', name: 'Baby Toys & Activity', full_path: 'Baby & Toddler > Baby Toys & Activity', path: 'Baby & Toddler > Baby Toys & Activity' },
  { id: '537', name: 'Baby Clothing', full_path: 'Baby & Toddler > Baby Clothing', path: 'Baby & Toddler > Baby Clothing' },
  { id: '562', name: 'Diapering', full_path: 'Baby & Toddler > Diapering', path: 'Baby & Toddler > Diapering' },
  { id: '566', name: 'Nursing & Feeding', full_path: 'Baby & Toddler > Nursing & Feeding', path: 'Baby & Toddler > Nursing & Feeding' },
  { id: '469', name: 'Health & Beauty', full_path: 'Health & Beauty', path: 'Health & Beauty' },
  { id: '473', name: 'Personal Care', full_path: 'Health & Beauty > Personal Care', path: 'Health & Beauty > Personal Care' },
  { id: '479', name: 'Skin Care', full_path: 'Health & Beauty > Personal Care > Skin Care', path: 'Health & Beauty > Personal Care > Skin Care' },
  { id: '484', name: 'Hair Care', full_path: 'Health & Beauty > Personal Care > Hair Care', path: 'Health & Beauty > Personal Care > Hair Care' },
  { id: '477', name: 'Cosmetics & Makeup', full_path: 'Health & Beauty > Personal Care > Cosmetics', path: 'Health & Beauty > Personal Care > Cosmetics' },
  { id: '500', name: 'Vitamins & Supplements', full_path: 'Health & Beauty > Health Care > Vitamins & Supplements', path: 'Health & Beauty > Health Care > Vitamins & Supplements' },
  { id: '537', name: 'Home & Garden', full_path: 'Home & Garden', path: 'Home & Garden' },
  { id: '550', name: 'Decor & Accents', full_path: 'Home & Garden > Decor', path: 'Home & Garden > Decor' },
  { id: '632', name: 'Furniture', full_path: 'Home & Garden > Furniture', path: 'Home & Garden > Furniture' },
  { id: '654', name: 'Bedding & Linens', full_path: 'Home & Garden > Linens & Bedding', path: 'Home & Garden > Linens & Bedding' },
  { id: '672', name: 'Kitchen & Dining', full_path: 'Home & Garden > Kitchen & Dining', path: 'Home & Garden > Kitchen & Dining' },
  { id: '694', name: 'Lighting', full_path: 'Home & Garden > Lighting', path: 'Home & Garden > Lighting' },
  { id: '710', name: 'Lawn & Garden', full_path: 'Home & Garden > Lawn & Garden', path: 'Home & Garden > Lawn & Garden' },
  { id: '222', name: 'Electronics', full_path: 'Electronics', path: 'Electronics' },
  { id: '266', name: 'Audio & Headphones', full_path: 'Electronics > Audio', path: 'Electronics > Audio' },
  { id: '267', name: 'Computers & Laptops', full_path: 'Electronics > Computers', path: 'Electronics > Computers' },
  { id: '270', name: 'Mobile Phones & Accessories', full_path: 'Electronics > Communications > Telephony', path: 'Electronics > Communications > Telephony' },
  { id: '272', name: 'Video Games & Consoles', full_path: 'Electronics > Video Game Consoles', path: 'Electronics > Video Game Consoles' },
  { id: '988', name: 'Sporting Goods', full_path: 'Sporting Goods', path: 'Sporting Goods' },
  { id: '990', name: 'Athletics & Fitness', full_path: 'Sporting Goods > Exercise & Fitness', path: 'Sporting Goods > Exercise & Fitness' },
  { id: '995', name: 'Outdoor Recreation & Camping', full_path: 'Sporting Goods > Outdoor Recreation', path: 'Sporting Goods > Outdoor Recreation' },
  { id: '1002', name: 'Cycling & Bikes', full_path: 'Sporting Goods > Cycling', path: 'Sporting Goods > Cycling' },
  { id: '1239', name: 'Toys & Games', full_path: 'Toys & Games', path: 'Toys & Games' },
  { id: '1240', name: 'Action Figures & Dolls', full_path: 'Toys & Games > Dolls, Playsets & Toy Figures', path: 'Toys & Games > Dolls, Playsets & Toy Figures' },
  { id: '1241', name: 'Puzzles & Board Games', full_path: 'Toys & Games > Games & Puzzles', path: 'Toys & Games > Games & Puzzles' },
  { id: '422', name: 'Food, Beverages & Tobacco', full_path: 'Food, Beverages & Tobacco', path: 'Food, Beverages & Tobacco' },
  { id: '423', name: 'Beverages & Coffee', full_path: 'Food, Beverages & Tobacco > Beverages', path: 'Food, Beverages & Tobacco > Beverages' },
  { id: '424', name: 'Gourmet Food & Snacks', full_path: 'Food, Beverages & Tobacco > Food Items', path: 'Food, Beverages & Tobacco > Food Items' },
  { id: '888', name: 'Vehicles & Parts', full_path: 'Vehicles & Parts', path: 'Vehicles & Parts' },
  { id: '889', name: 'Automotive Parts & Accessories', full_path: 'Vehicles & Parts > Vehicle Parts & Accessories', path: 'Vehicles & Parts > Vehicle Parts & Accessories' },
  { id: '600', name: 'Business & Industrial', full_path: 'Business & Industrial', path: 'Business & Industrial' },
  { id: '601', name: 'Office Supplies', full_path: 'Office Supplies', path: 'Office Supplies' },
  { id: '780', name: 'Hardware & Tools', full_path: 'Hardware', path: 'Hardware' },
  { id: '850', name: 'Luggage & Bags', full_path: 'Luggage & Bags', path: 'Luggage & Bags' },
];

export function searchGoogleCategories(query: string, limit: number = 30): GoogleCategory[] {
  const q = query.trim().toLowerCase();
  if (!q) return GOOGLE_CATEGORIES.slice(0, limit);
  return GOOGLE_CATEGORIES.filter(
    (c) =>
      c.name.toLowerCase().includes(q) ||
      c.full_path.toLowerCase().includes(q) ||
      (c.path && c.path.toLowerCase().includes(q)) ||
      c.id === q
  ).slice(0, limit);
}
