import 'package:hooks_riverpod/hooks_riverpod.dart';

import '../../../common/domain/metal_type.dart';
import 'news_models.dart';

final mockNewsRepositoryProvider = Provider<MockNewsRepository>(
  (ref) => MockNewsRepository(),
);

class MockNewsRepository {
  List<NewsItem> loadFeed() {
    final base = DateTime(2026, 6, 18, 16, 11);
    final items = [
      NewsItem(
        id: 'news_gold_001',
        metal: MetalType.gold,
        title: '金价维持高位震荡，实物金溢价继续分化',
        source: '金值整理',
        publishedAt: base.subtract(const Duration(minutes: 18)),
        summary: '现货价与品牌零售价之间仍有明显价差，持仓估值应优先看材料价值。',
        body: const [
          '今日黄金现货价格维持高位震荡，品牌金店挂牌价与现货材料价值之间仍有明显差距。',
          '对持有者而言，材料价值更适合用于日常估值；对购买者而言，需要额外关注工费、品牌溢价与回收折扣。',
        ],
      ),
      NewsItem(
        id: 'news_silver_001',
        metal: MetalType.silver,
        title: '白银跟随工业金属情绪回暖，短线波动放大',
        source: '市场简报',
        publishedAt: base.subtract(const Duration(hours: 1, minutes: 4)),
        summary: '银价弹性较强，饰品材料价值和零售购买价差异更大。',
        body: const [
          '白银价格今日跟随工业金属情绪回暖，短线波动较黄金更明显。',
          '银饰通常包含较高加工与零售成本，材料价值占比可能低于用户直觉。',
        ],
      ),
      NewsItem(
        id: 'news_platinum_001',
        metal: MetalType.platinum,
        title: '铂金回收报价偏谨慎，饰品估值需看纯度',
        source: '金属观察',
        publishedAt: base.subtract(const Duration(hours: 2, minutes: 36)),
        summary: 'PT950 饰品估值建议按克重、纯度和回收折扣分层查看。',
        body: const [
          '铂金饰品回收报价通常更依赖门店检测与成色确认，报价口径比现货价格更谨慎。',
          '记录持仓时建议保留纯度、克重、购买渠道和成本信息，便于后续估值与盈亏回看。',
        ],
      ),
    ];
    return [...items]..sort((a, b) => b.publishedAt.compareTo(a.publishedAt));
  }
}
