package com.jishisongfu.duobibi.ui.discover

import androidx.annotation.DrawableRes
import com.jishisongfu.duobibi.R
import com.jishisongfu.duobibi.ui.arena.ArenaCategory

/**
 * "发现"页瀑布流的静态种子内容(占审用)。
 *
 * **结构性约束**(故意区别于傻瓜比价 CommunityScreen 的图文好价帖):
 * - 每条**必须挂 ≥2 个平台到手价**,卡片视觉以"价格对比"而非"图文"为主
 * - 用 emoji 而非大图,避免跟旧 App 的大图笔记瀑布流撞设计
 * - 品类口径复用 [ArenaCategory],跟比价擂台的"锁定品类"模型一致
 *
 * 卡片点击 → 把 `title` 喂给 ArenaViewModel.submitWithTitle 直接跳"比价"Tab 出对比表。
 */
data class DiscoverItem(
    val id: String,
    val title: String,
    val category: ArenaCategory,
    /** 兜底用的"商品类型符号"。imageRes 不为空时不显示。 */
    val emoji: String,
    /** 市场常见价(用于"较常见价省 ¥X"展示) */
    val typicalPrice: Double,
    /** 各平台到手价。≥2 个,顺序即展示顺序;最低自动加 "最低" 标。 */
    val platformPrices: Map<String, Double>,
    /** 可选高亮短标签(如"百亿补贴"/"618 预热"/"周四疯狂")。 */
    val highlight: String? = null,
    /** 瀑布流高度提示 0/1/2 — 错落用,卡片内部 padding 不同。 */
    val heightHint: Int = 0,
    /**
     * 商品实图(本地 drawable 资源)。优先于 [emoji] 渲染。
     *
     * **加图流程**:
     *  1. 把图片(PNG/JPG/WebP)放进 `app/src/main/res/drawable/`,
     *     文件名只能含小写字母 / 数字 / 下划线(如 `img_xxx.png`)
     *  2. 在本 SEED 对应条目设 `imageRes = R.drawable.img_xxx`
     *  3. 不设(保持 null)= 走 emoji 兜底渲染
     *
     * 图片版权由提供方负责;参考图源:`picture/` 目录。
     */
    @DrawableRes val imageRes: Int? = null,
) {
    /** 全网最低价(卡片大字)。 */
    val minPrice: Double get() = platformPrices.values.min()
    /** 最低价所在平台。 */
    val minPlatform: String get() = platformPrices.minBy { it.value }.key
    /** 较常见价省多少钱(≥0)。 */
    val savings: Double get() = (typicalPrice - minPrice).coerceAtLeast(0.0)
}

/**
 * 30 条占审种子。新增 / 改时只需追加到这个 list,DiscoverScreen 自动按品类筛。
 * 价格仅为参考,可能与真实情况不符;以平台实际为准(底部小字 disclaimer 已写)。
 */
val DISCOVER_SEED: List<DiscoverItem> = listOf(
    // ===== 外卖比价(4) ============================================================
    DiscoverItem(
        id = "tw01", title = "海底捞外卖 经典套餐 2-3 人份",
        category = ArenaCategory.Takeaway, emoji = "🍲",
        typicalPrice = 199.0,
        platformPrices = mapOf("美团外卖" to 168.0, "饿了么" to 175.0),
        highlight = "美团满减后",
        heightHint = 1,
        imageRes = R.drawable.img_haidilao,
    ),
    DiscoverItem(
        id = "tw02", title = "麦当劳 麦辣鸡腿堡套餐(大份)",
        category = ArenaCategory.Takeaway, emoji = "🍔",
        typicalPrice = 39.0,
        platformPrices = mapOf("美团外卖" to 28.0, "饿了么" to 31.5),
        heightHint = 1,
        imageRes = R.drawable.img_hamburger,
    ),
    DiscoverItem(
        id = "tw03", title = "肯德基 疯狂星期四 9.9 元桶",
        category = ArenaCategory.Takeaway, emoji = "🍗",
        typicalPrice = 28.0,
        platformPrices = mapOf("美团外卖" to 9.9, "饿了么" to 12.0),
        highlight = "周四限定",
        heightHint = 2,
        imageRes = R.drawable.img_kfc,
    ),
    DiscoverItem(
        id = "tw04", title = "喜茶 多肉葡萄 中杯",
        category = ArenaCategory.Takeaway, emoji = "🧋",
        typicalPrice = 25.0,
        platformPrices = mapOf("美团外卖" to 19.0, "饿了么" to 21.0),
        heightHint = 1,
        imageRes = R.drawable.img_heytea,
    ),
    DiscoverItem(
        id = "tw05", title = "吉野家 红烧肥牛饭 经典套餐",
        category = ArenaCategory.Takeaway, emoji = "🍱",
        typicalPrice = 35.0,
        platformPrices = mapOf("美团外卖" to 19.9, "饿了么" to 24.5),
        highlight = "美团满 30 减 10",
        heightHint = 1,
        imageRes = R.drawable.img_beef_rice,
    ),

    // ===== 同城买菜(4) ============================================================
    DiscoverItem(
        id = "gc01", title = "新鲜五花肉 500g · 同城配送",
        category = ArenaCategory.Grocery, emoji = "🥩",
        typicalPrice = 32.0,
        platformPrices = mapOf("美团" to 26.8, "饿了么" to 29.0),
        heightHint = 1,
        imageRes = R.drawable.img_pork_belly,
    ),
    DiscoverItem(
        id = "gc02", title = "本地散养土鸡蛋 30 枚",
        category = ArenaCategory.Grocery, emoji = "🥚",
        typicalPrice = 39.9,
        platformPrices = mapOf("美团" to 29.9, "饿了么" to 32.0),
        heightHint = 1,
        imageRes = R.drawable.img_eggs,
    ),
    DiscoverItem(
        id = "gc03", title = "蒙牛特仑苏纯牛奶 250ml*16 礼盒",
        category = ArenaCategory.Grocery, emoji = "🥛",
        typicalPrice = 88.0,
        platformPrices = mapOf("美团" to 65.0, "饿了么" to 69.0),
        highlight = "美团百亿补贴",
        heightHint = 2,
        imageRes = R.drawable.img_telunsu,
    ),
    DiscoverItem(
        id = "gc04", title = "新鲜绿色叶菜礼包 1.5kg",
        category = ArenaCategory.Grocery, emoji = "🥬",
        typicalPrice = 35.0,
        platformPrices = mapOf("美团" to 24.5, "饿了么" to 28.9),
        heightHint = 1,
        imageRes = R.drawable.img_greens,
    ),

    // ===== 电商比价(4) ============================================================
    DiscoverItem(
        id = "ec01", title = "雀巢多趣酷思咖啡胶囊 16 颗装",
        category = ArenaCategory.Ecommerce, emoji = "☕",
        typicalPrice = 99.0,
        platformPrices = mapOf("淘宝" to 89.0, "京东" to 95.0, "拼多多" to 79.0, "抖音" to 92.0),
        highlight = "拼多多百亿补贴",
        heightHint = 1,
        imageRes = R.drawable.img_nescafe,
    ),
    DiscoverItem(
        id = "ec02", title = "三只松鼠 每日坚果 30 包混合装",
        category = ArenaCategory.Ecommerce, emoji = "🥜",
        typicalPrice = 89.0,
        platformPrices = mapOf("淘宝" to 79.0, "京东" to 85.0, "拼多多" to 69.9, "抖音" to 76.0),
        heightHint = 1,
        imageRes = R.drawable.img_squirrel,
    ),
    DiscoverItem(
        id = "ec03", title = "自嗨锅 4 桶混合自热米饭",
        category = ArenaCategory.Ecommerce, emoji = "🍱",
        typicalPrice = 99.0,
        platformPrices = mapOf("淘宝" to 79.0, "京东" to 85.0, "拼多多" to 69.0, "抖音" to 75.0),
        heightHint = 2,
        imageRes = R.drawable.img_zhxg,
    ),
    DiscoverItem(
        id = "ec04", title = "加多宝凉茶 310ml*24 罐整箱",
        category = ArenaCategory.Ecommerce, emoji = "🥤",
        typicalPrice = 79.0,
        platformPrices = mapOf("淘宝" to 65.0, "京东" to 69.0, "拼多多" to 58.0, "抖音" to 62.0),
        heightHint = 1,
        imageRes = R.drawable.img_jdb,
    ),

    // ===== 数码家电(6) ============================================================
    DiscoverItem(
        id = "dg01", title = "Apple iPhone 16 256GB 海湾蓝",
        category = ArenaCategory.Digital, emoji = "📱",
        typicalPrice = 6999.0,
        platformPrices = mapOf("淘宝" to 5999.0, "京东" to 6299.0, "拼多多" to 5799.0, "抖音" to 6099.0),
        highlight = "百亿补贴",
        heightHint = 2,
        imageRes = R.drawable.img_iphone_blue,
    ),
    DiscoverItem(
        id = "dg02", title = "Apple AirPods Pro 2 USB-C 版",
        category = ArenaCategory.Digital, emoji = "🎧",
        typicalPrice = 1899.0,
        platformPrices = mapOf("淘宝" to 1499.0, "京东" to 1699.0, "拼多多" to 1399.0, "抖音" to 1559.0),
        heightHint = 1,
        imageRes = R.drawable.img_airpods,
    ),
    DiscoverItem(
        id = "dg03", title = "小米 14 Pro 12GB+256GB 钛金属版",
        category = ArenaCategory.Digital, emoji = "📱",
        typicalPrice = 4999.0,
        platformPrices = mapOf("淘宝" to 4699.0, "京东" to 4899.0, "拼多多" to 4499.0, "抖音" to 4799.0),
        heightHint = 1,
        imageRes = R.drawable.img_xiaomi14pro,
    ),
    DiscoverItem(
        id = "dg04", title = "iPad Air 11 256GB WiFi 紫色",
        category = ArenaCategory.Digital, emoji = "📒",
        typicalPrice = 5299.0,
        platformPrices = mapOf("淘宝" to 4799.0, "京东" to 5099.0, "拼多多" to 4699.0, "抖音" to 4999.0),
        heightHint = 1,
        imageRes = R.drawable.img_ipad_air,
    ),
    DiscoverItem(
        id = "dg05", title = "戴森 Dyson V12 Detect Slim 无线吸尘器",
        category = ArenaCategory.Digital, emoji = "🌀",
        typicalPrice = 4490.0,
        platformPrices = mapOf("淘宝" to 3699.0, "京东" to 3899.0, "拼多多" to 3499.0, "抖音" to 3799.0),
        highlight = "618 预热价",
        heightHint = 2,
        imageRes = R.drawable.img_dyson_vacuum,
    ),
    DiscoverItem(
        id = "dg06", title = "飞利浦 多功能旋转剃须刀 S5586",
        category = ArenaCategory.Digital, emoji = "💈",
        typicalPrice = 599.0,
        platformPrices = mapOf("淘宝" to 469.0, "京东" to 519.0, "拼多多" to 449.0, "抖音" to 489.0),
        heightHint = 1,
        imageRes = R.drawable.img_philips_shaver,
    ),
    DiscoverItem(
        id = "dg07", title = "戴森 Supersonic 吹风机 HD15 紫红色",
        category = ArenaCategory.Digital, emoji = "💨",
        typicalPrice = 2990.0,
        platformPrices = mapOf("淘宝" to 2599.0, "京东" to 2799.0, "拼多多" to 2399.0, "抖音" to 2699.0),
        highlight = "百亿补贴",
        heightHint = 2,
        imageRes = R.drawable.img_dyson_hd,
    ),
    DiscoverItem(
        id = "dg08", title = "Apple MacBook Air 13 M3 256GB",
        category = ArenaCategory.Digital, emoji = "💻",
        typicalPrice = 8999.0,
        platformPrices = mapOf("淘宝" to 7999.0, "京东" to 8499.0, "拼多多" to 7799.0, "抖音" to 8199.0),
        highlight = "教育优惠叠加",
        heightHint = 2,
        imageRes = R.drawable.img_macbook,
    ),

    // ===== 服饰美妆(6) ============================================================
    DiscoverItem(
        id = "fs01", title = "SK-II 神仙水 230ml 礼盒装",
        category = ArenaCategory.Fashion, emoji = "💧",
        typicalPrice = 1699.0,
        platformPrices = mapOf("淘宝" to 1499.0, "京东" to 1599.0, "拼多多" to 1399.0, "抖音" to 1499.0),
        heightHint = 1,
        imageRes = R.drawable.img_skii,
    ),
    DiscoverItem(
        id = "fs02", title = "雅诗兰黛 小棕瓶套装 精华+眼霜+面霜",
        category = ArenaCategory.Fashion, emoji = "🧴",
        typicalPrice = 1980.0,
        platformPrices = mapOf("淘宝" to 1599.0, "京东" to 1799.0, "拼多多" to 1499.0, "抖音" to 1699.0),
        highlight = "新客立减",
        heightHint = 1,
        imageRes = R.drawable.img_estee_lauder,
    ),
    DiscoverItem(
        id = "fs03", title = "Nike Air Force 1 经典纯白男款 41",
        category = ArenaCategory.Fashion, emoji = "👟",
        typicalPrice = 799.0,
        platformPrices = mapOf("淘宝" to 629.0, "京东" to 679.0, "拼多多" to 599.0, "抖音" to 649.0),
        heightHint = 2,
        imageRes = R.drawable.img_nike_af1,
    ),
    DiscoverItem(
        id = "fs04", title = "Lululemon Align 高腰瑜伽裤 25 寸 暮蓝",
        category = ArenaCategory.Fashion, emoji = "🧘",
        typicalPrice = 980.0,
        platformPrices = mapOf("淘宝" to 850.0, "京东" to 880.0, "拼多多" to 799.0, "抖音" to 819.0),
        heightHint = 1,
        imageRes = R.drawable.img_lululemon,
    ),
    DiscoverItem(
        id = "fs05", title = "兰蔻 Absolue 菁纯眼霜 20ml 金管",
        category = ArenaCategory.Fashion, emoji = "👁",
        typicalPrice = 1499.0,
        platformPrices = mapOf("淘宝" to 1199.0, "京东" to 1299.0, "拼多多" to 1099.0, "抖音" to 1199.0),
        heightHint = 1,
        imageRes = R.drawable.img_lancome_eye,
    ),
    DiscoverItem(
        id = "fs06", title = "资生堂 红腰子精华 50ml",
        category = ArenaCategory.Fashion, emoji = "🌹",
        typicalPrice = 729.0,
        platformPrices = mapOf("淘宝" to 599.0, "京东" to 659.0, "拼多多" to 549.0, "抖音" to 589.0),
        highlight = "百亿补贴",
        heightHint = 1,
        imageRes = R.drawable.img_shiseido_red,
    ),

    // ===== 日用百货(6) ============================================================
    DiscoverItem(
        id = "dl01", title = "花王 妙而舒 进口纸尿裤 S82 片",
        category = ArenaCategory.Daily, emoji = "👶",
        typicalPrice = 169.0,
        platformPrices = mapOf("淘宝" to 135.0, "京东" to 149.0, "拼多多" to 125.0, "抖音" to 132.0, "美团" to 152.0),
        heightHint = 2,
        imageRes = R.drawable.img_merries,
    ),
    DiscoverItem(
        id = "dl02", title = "维达 4 层抽纸 24 包整箱",
        category = ArenaCategory.Daily, emoji = "🧻",
        typicalPrice = 79.9,
        platformPrices = mapOf("淘宝" to 59.9, "京东" to 65.0, "拼多多" to 49.9, "抖音" to 55.0, "美团" to 65.5),
        highlight = "拼多多百亿",
        heightHint = 1,
        imageRes = R.drawable.img_vinda_tissue,
    ),
    DiscoverItem(
        id = "dl03", title = "海尔 不锈钢真空保温杯 500ml",
        category = ArenaCategory.Daily, emoji = "🥤",
        typicalPrice = 129.0,
        platformPrices = mapOf("淘宝" to 89.0, "京东" to 109.0, "拼多多" to 79.0, "抖音" to 95.0),
        heightHint = 2,
        imageRes = R.drawable.img_haier_cup,
    ),
    DiscoverItem(
        id = "dl04", title = "飞利浦 电动牙刷 HX6730 入门款",
        category = ArenaCategory.Daily, emoji = "🪥",
        typicalPrice = 449.0,
        platformPrices = mapOf("淘宝" to 329.0, "京东" to 369.0, "拼多多" to 299.0, "抖音" to 319.0),
        heightHint = 1,
        imageRes = R.drawable.img_philips_toothbrush,
    ),
    DiscoverItem(
        id = "dl05", title = "美的 电热水壶 1.7L 304 不锈钢",
        category = ArenaCategory.Daily, emoji = "💧",
        typicalPrice = 159.0,
        platformPrices = mapOf("淘宝" to 119.0, "京东" to 129.0, "拼多多" to 99.0, "抖音" to 109.0, "美团" to 135.0),
        heightHint = 1,
        imageRes = R.drawable.img_midea_kettle,
    ),
    DiscoverItem(
        id = "dl06", title = "苏泊尔 不粘锅 28cm 麦饭石色",
        category = ArenaCategory.Daily, emoji = "🍳",
        typicalPrice = 199.0,
        platformPrices = mapOf("淘宝" to 159.0, "京东" to 179.0, "拼多多" to 139.0, "抖音" to 149.0),
        heightHint = 1,
        imageRes = R.drawable.img_supor_pan,
    ),
)
