<?php

namespace Database\Seeders;

use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;

/**
 * 写入 `currencies`，与 `docs/04`、`LOTTERY_DEFAULT_CURRENCY` 对齐。
 */
final class CurrencySeeder extends Seeder
{
    public function run(): void
    {
        $rows = [
            [
                'code' => 'NPR',
                'name' => 'Nepalese Rupee',
                'decimal_places' => 2,
                'is_enabled' => true,
                'is_bettable' => true,
            ],
            [
                'code' => 'USD',
                'name' => 'US Dollar',
                'decimal_places' => 2,
                'is_enabled' => true,
                'is_bettable' => false,
            ],
        ];

        foreach ($rows as $row) {
            DB::table('currencies')->updateOrInsert(
                ['code' => $row['code']],
                [
                    'name' => $row['name'],
                    'decimal_places' => $row['decimal_places'],
                    'is_enabled' => $row['is_enabled'],
                    'is_bettable' => $row['is_bettable'],
                    'created_at' => now(),
                    'updated_at' => now(),
                ],
            );
        }
    }
}
