<?php

/**
 * 文件功能：商店初始商品数据填充器
 * 初始化9种商品：4种单次特效卡 + 4种周卡 + 改名卡
 *
 * @package  Database\Seeders
 */

namespace Database\Seeders;

use App\Models\ShopItem;
use Illuminate\Database\Seeder;

class ShopItemSeeder extends Seeder
{
    /**
     * 填充商店商品初始数据
     */
    public function run(): void
    {
        $items = [
            // ── 单次特效卡（立即播放一次，888金币）────────────────
            ['name' => '烟花单次卡', 'slug' => 'once_fireworks', 'icon' => '🎆',
                'description' => '购买即刻在聊天室绽放一场烟花（仅自己可见），喜庆氛围拉满！',
                'price' => 888, 'type' => 'instant', 'duration_days' => null, 'sort_order' => 1],
            ['name' => '下雨单次卡', 'slug' => 'once_rain', 'icon' => '🌧',
                'description' => '立刻召唤一场滂沱大雨，感受诗意雨天（仅自己可见）。',
                'price' => 888, 'type' => 'instant', 'duration_days' => null, 'sort_order' => 2],
            ['name' => '雷电单次卡', 'slug' => 'once_lightning', 'icon' => '⚡',
                'description' => '电闪雷鸣，瞬间震撼全场！立即触发雷电特效（仅自己可见）。',
                'price' => 888, 'type' => 'instant', 'duration_days' => null, 'sort_order' => 3],
            ['name' => '下雪单次卡', 'slug' => 'once_snow', 'icon' => '❄️',
                'description' => '银装素裹，漫天飞雪！立即触发下雪特效（仅自己可见）。',
                'price' => 888, 'type' => 'instant', 'duration_days' => null, 'sort_order' => 4],

            // ── 周卡（登录自动播放7天，8888金币）──────────────────
            ['name' => '烟花周卡', 'slug' => 'week_fireworks', 'icon' => '🎆',
                'description' => '连续7天，每次进入聊天室自动绽放烟花！同时只能激活一种周卡。',
                'price' => 8888, 'type' => 'duration', 'duration_days' => 7, 'sort_order' => 11],
            ['name' => '下雨周卡', 'slug' => 'week_rain', 'icon' => '🌧',
                'description' => '连续7天，每次进入聊天室自动下雨。同时只能激活一种周卡。',
                'price' => 8888, 'type' => 'duration', 'duration_days' => 7, 'sort_order' => 12],
            ['name' => '雷电周卡', 'slug' => 'week_lightning', 'icon' => '⚡',
                'description' => '连续7天，每次进入聊天室自动触发雷电特效。同时只能激活一种周卡。',
                'price' => 8888, 'type' => 'duration', 'duration_days' => 7, 'sort_order' => 13],
            ['name' => '下雪周卡', 'slug' => 'week_snow', 'icon' => '❄️',
                'description' => '连续7天，每次进入聊天室自动下雪。同时只能激活一种周卡。',
                'price' => 8888, 'type' => 'duration', 'duration_days' => 7, 'sort_order' => 14],

            // ── 改名卡（一次性，5000金币）────────────────────────
            ['name' => '改名卡', 'slug' => 'rename_card', 'icon' => '🎭',
                'description' => '使用后可修改一次昵称（旧名保留30天黑名单，不可被他人注册）。注意：历史聊天记录中的旧名不会更改。',
                'price' => 5000, 'type' => 'one_time', 'duration_days' => null, 'sort_order' => 20],
        ];

        foreach ($items as $item) {
            ShopItem::firstOrCreate(['slug' => $item['slug']], $item + ['is_active' => true]);
        }
    }
}
