/**
 * 按用途产品展示接口
 * @returns 按用途分类的产品数据
 */
export default defineEventHandler(async (event) => {
  // 获取查询参数中的语言设置
  const query = getQuery(event);
  const lang = query.lang || 'ja'; // 默认使用日语
  
  // 模拟数据
  const usageList = [
    {
      id: 1,
      name: lang === 'zh' ? '外接存储转换' : '外付けストレージ化',
      products: [
        {
          id: 1,
          title: 'Hanye Q60-2TST3',
          description: '2TB SSD UP TO 550MB/s',
          image: 'https://picsum.photos/300/300?random=1',
          link: '/products/1'
        },
        {
          id: 2,
          title: 'Hanye Q60-4TST3',
          description: '4TB SSD UP TO 550MB/s',
          image: 'https://picsum.photos/300/300?random=2',
          link: '/products/2'
        },
        {
          id: 3,
          title: 'Hanye Q60-8TST3',
          description: '8TB SSD UP TO 550MB/s',
          image: 'https://picsum.photos/300/300?random=3',
          link: '/products/3'
        },
        {
          id: 4,
          title: 'Hanye Q60-16TST3',
          description: '16TB SSD UP TO 550MB/s',
          image: 'https://picsum.photos/300/300?random=4',
          link: '/products/4'
        },
        {
          id: 5,
          title: 'Hanye Q60-32TST3',
          description: '32TB SSD UP TO 550MB/s',
          image: 'https://picsum.photos/300/300?random=5',
          link: '/products/5'
        }
      ]
    },
    {
      id: 2,
      name: lang === 'zh' ? 'PC加速' : 'PC高速化',
      products: [
        {
          id: 4,
          title: 'Hanye Q60-2TST3',
          description: '2TB SSD UP TO 550MB/s',
          image: 'https://picsum.photos/300/300?random=4',
          link: '/products/4'
        },
        {
          id: 5,
          title: 'Hanye Q60-4TST3',
          description: '4TB SSD UP TO 550MB/s',
          image: 'https://picsum.photos/300/300?random=5',
          link: '/products/5'
        },
        {
          id: 6,
          title: 'Hanye Q60-8TST3',
          description: '8TB SSD UP TO 550MB/s',
          image: 'https://picsum.photos/300/300?random=6',
          link: '/products/6'
        }
      ]
    },
    {
      id: 3,
      name: lang === 'zh' ? '数据备份' : 'データバックアップ',
      products: [
        {
          id: 7,
          title: 'Hanye Q60-2TST3',
          description: '2TB SSD UP TO 550MB/s',
          image: 'https://picsum.photos/300/300?random=7',
          link: '/products/7'
        },
        {
          id: 8,
          title: 'Hanye Q60-4TST3',
          description: '4TB SSD UP TO 550MB/s',
          image: 'https://picsum.photos/300/300?random=8',
          link: '/products/8'
        },
        {
          id: 9,
          title: 'Hanye Q60-8TST3',
          description: '8TB SSD UP TO 550MB/s',
          image: 'https://picsum.photos/300/300?random=9',
          link: '/products/9'
        }
      ]
    }
  ]

  return {
    code: 200,
    data: usageList,
    message: lang === 'zh' ? '获取按用途产品数据成功' : '用途別製品データの取得に成功しました'
  }
}) 