<?php

/**
 * 文件功能：初始化商店戒指商品数据
 *
 * 共 5 档戒指，对应不同价格、亲密度加成、魅力加成。
 * 可重复运行（updateOrCreate 幂等）。
 */

namespace Database\Seeders;

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

class RingItemsSeeder extends Seeder
{
    /**
     * 写入 5 档结婚戒指数据。
     */
    public function run(): void
    {
        $rings = [
            [
                'slug' => 'ring_silver',
                'name' => '银质戒指',
                'icon' => '💍',
                'description' => '朴素银戒，见证两心相许。',
                'price' => 500,
                'type' => 'ring',
                'intimacy_bonus' => 10,
                'charm_bonus' => 30,
                'sort_order' => 101,
            ],
            [
                'slug' => 'ring_gold',
                'name' => '黄金戒指',
                'icon' => '💛',
                'description' => '18K黄金，情比金坚。',
                'price' => 2000,
                'type' => 'ring',
                'intimacy_bonus' => 30,
                'charm_bonus' => 80,
                'sort_order' => 102,
            ],
            [
                'slug' => 'ring_ruby',
                'name' => '红宝石戒指',
                'icon' => '❤️',
                'description' => '鸽血红宝，热烈如初恋。',
                'price' => 8000,
                'type' => 'ring',
                'intimacy_bonus' => 80,
                'charm_bonus' => 200,
                'sort_order' => 103,
            ],
            [
                'slug' => 'ring_diamond',
                'name' => '钻石戒指',
                'icon' => '💎',
                'description' => '一克拉钻石，誓言永恒。',
                'price' => 30000,
                'type' => 'ring',
                'intimacy_bonus' => 200,
                'charm_bonus' => 500,
                'sort_order' => 104,
            ],
            [
                'slug' => 'ring_legendary',
                'name' => '传说神戒',
                'icon' => '🌟',
                'description' => '世间仅此一款，天命之环，天作之合。',
                'price' => 100000,
                'type' => 'ring',
                'intimacy_bonus' => 500,
                'charm_bonus' => 1000,
                'sort_order' => 105,
            ],
        ];

        foreach ($rings as $ring) {
            ShopItem::updateOrCreate(
                ['slug' => $ring['slug']],
                array_merge($ring, [
                    'is_active' => true,
                    'duration_days' => null,
                ])
            );
        }

        $this->command->info('✅ 5 枚结婚戒指已写入 shop_items。');
    }
}
