/**
 * 图片测试数据
 * 用于测试不同尺寸图片的展示效果
 */

export interface TestImageData {
  id: string
  url: string
  width: number
  height: number
  type: 'large' | 'small' | 'tiny'
  description: string
}

// 测试图片数据（使用placeholder图片服务）
export const TEST_IMAGES: TestImageData[] = [
  // 大图测试 - 宽图
  {
    id: 'large-wide-1',
    url: 'https://picsum.photos/800/400?random=1',
    width: 800,
    height: 400,
    type: 'large',
    description: '大图-宽图 (800×400, 比例2:1)',
  },
  {
    id: 'large-wide-2',
    url: 'https://picsum.photos/1200/300?random=2',
    width: 1200,
    height: 300,
    type: 'large',
    description: '大图-超宽图 (1200×300, 比例4:1)',
  },

  // 大图测试 - 高图
  {
    id: 'large-tall-1',
    url: 'https://picsum.photos/400/800?random=3',
    width: 400,
    height: 800,
    type: 'large',
    description: '大图-高图 (400×800, 比例1:2)',
  },
  {
    id: 'large-tall-2',
    url: 'https://picsum.photos/300/1200?random=4',
    width: 300,
    height: 1200,
    type: 'large',
    description: '大图-超高图 (300×1200, 比例1:4)',
  },

  // 大图测试 - 正方形
  {
    id: 'large-square',
    url: 'https://picsum.photos/600/600?random=5',
    width: 600,
    height: 600,
    type: 'large',
    description: '大图-正方形 (600×600, 比例1:1)',
  },

  // 小图测试
  {
    id: 'small-wide',
    url: 'https://picsum.photos/300/200?random=6',
    width: 300,
    height: 200,
    type: 'small',
    description: '小图-宽图 (300×200, 比例1.5:1)',
  },
  {
    id: 'small-tall',
    url: 'https://picsum.photos/200/300?random=7',
    width: 200,
    height: 300,
    type: 'small',
    description: '小图-高图 (200×300, 比例2:3)',
  },
  {
    id: 'small-square',
    url: 'https://picsum.photos/250/250?random=8',
    width: 250,
    height: 250,
    type: 'small',
    description: '小图-正方形 (250×250, 比例1:1)',
  },

  // 超小图测试
  {
    id: 'tiny-wide',
    url: 'https://picsum.photos/60/30?random=9',
    width: 60,
    height: 30,
    type: 'tiny',
    description: '超小图-宽图 (60×30, 比例2:1)',
  },
  {
    id: 'tiny-tall',
    url: 'https://picsum.photos/30/60?random=10',
    width: 30,
    height: 60,
    type: 'tiny',
    description: '超小图-高图 (30×60, 比例1:2)',
  },
  {
    id: 'tiny-square',
    url: 'https://picsum.photos/40/40?random=11',
    width: 40,
    height: 40,
    type: 'tiny',
    description: '超小图-正方形 (40×40, 比例1:1)',
  },

  // 极端比例测试
  {
    id: 'extreme-wide',
    url: 'https://picsum.photos/900/100?random=12',
    width: 900,
    height: 100,
    type: 'large',
    description: '极端宽图 (900×100, 比例9:1, 应被限制到21:9)',
  },
  {
    id: 'extreme-tall',
    url: 'https://picsum.photos/100/900?random=13',
    width: 100,
    height: 900,
    type: 'large',
    description: '极端高图 (100×900, 比例1:9, 应被限制到9:21)',
  },
]

/**
 * 根据类型过滤测试图片
 */
export function getTestImagesByType(type: 'large' | 'small' | 'tiny'): TestImageData[] {
  return TEST_IMAGES.filter((img) => img.type === type)
}

/**
 * 获取随机测试图片
 */
export function getRandomTestImage(): TestImageData {
  return TEST_IMAGES[Math.floor(Math.random() * TEST_IMAGES.length)]
}

/**
 * 获取指定数量的随机测试图片
 */
export function getRandomTestImages(count: number): TestImageData[] {
  const shuffled = [...TEST_IMAGES].sort(() => 0.5 - Math.random())
  return shuffled.slice(0, count)
}
