export type PddMockProduct = {
  id: string
  title: string
  image: string
  tags: string[]
  price: number
  salesText: string
  seedText: string
}

const imagePool: string[] = [
  '/static/images/product/p1.jpg',
  '/static/images/product/p2.jpg',
  '/static/images/product/p3.jpg',
  '/static/images/product/p4.jpg',
  '/static/images/default-product.png',
  '/static/images/product/p1.jpg',
  '/static/images/product/p2.jpg',
  '/static/images/product/p3.jpg'
]

const titlePool: string[] = [
  '老钱风针织短袖Polo衫显瘦百搭',
  '垂感阔腿牛仔裤女春夏高腰显腿长',
  '新疆吊干杏整箱新鲜脆甜当季水果',
  '便携充电宝22.5W快充小巧大容量',
  '冰丝凉感防晒外套轻薄透气户外通勤',
  '无线蓝牙耳机半入耳长续航降噪',
  '儿童速干T恤夏季吸汗透气套装',
  '加厚纯棉四件套亲肤柔软不易起球',
  '懒人沙发单人阳台小户型云朵坐垫',
  '大容量收纳箱家用衣物整理带滑轮',
  '原切牛排家庭装鲜嫩多汁煎烤皆宜',
  '法式轻奢玻璃水杯高颜值办公室耐热'
]

const tagsPool: string[][] = [
  ['billion_subsidy', 'delivery_48h'],
  ['official_subsidy', 'pay_later'],
  ['billion_subsidy'],
  ['delivery_48h', 'pay_later'],
  ['official_subsidy'],
  ['billion_subsidy', 'official_subsidy']
]

const salesPool: string[] = [
  '全店已售90万+',
  '全店已售32万+',
  '全店已售11万+',
  '全店已售5.6万+',
  '全店已售2900+'
]

const seedPool: string[] = [
  '超10万人种草',
  '回头客都在买',
  '直播间同款热卖',
  '近2万人加购',
  '收藏量持续上涨'
]

function buildMockProduct(index: number): PddMockProduct {
  const image = imagePool[index % imagePool.length]
  const title = titlePool[index % titlePool.length]
  const tags = tagsPool[index % tagsPool.length]
  const salesText = salesPool[index % salesPool.length]
  const seedText = seedPool[index % seedPool.length]
  const basePrice = 19.9 + (index % 7) * 13.3 + Math.floor(index / 3)

  return {
    id: 'pdd-mock-' + index,
    title,
    image,
    tags,
    price: basePrice,
    salesText,
    seedText
  }
}

export function createPddMockProducts(total: number = 80): PddMockProduct[] {
  const list: PddMockProduct[] = []
  for (let i = 0; i < total; i++) {
    list.push(buildMockProduct(i))
  }
  return list
}
