<?php

namespace Database\Seeders;

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

class AssetSettingSeeder extends Seeder
{
    public function run(): void
    {
        $assets = [
            // Forex — 85%
            ['symbol' => 'EURUSD',   'name' => 'EUR/USD',    'category' => 'Forex',       'payout_percent' => 85.00],
            ['symbol' => 'GBPUSD',   'name' => 'GBP/USD',    'category' => 'Forex',       'payout_percent' => 85.00],
            ['symbol' => 'USDJPY',   'name' => 'USD/JPY',    'category' => 'Forex',       'payout_percent' => 85.00],
            ['symbol' => 'AUDUSD',   'name' => 'AUD/USD',    'category' => 'Forex',       'payout_percent' => 85.00],
            ['symbol' => 'USDCAD',   'name' => 'USD/CAD',    'category' => 'Forex',       'payout_percent' => 85.00],
            ['symbol' => 'USDCHF',   'name' => 'USD/CHF',    'category' => 'Forex',       'payout_percent' => 85.00],
            ['symbol' => 'NZDUSD',   'name' => 'NZD/USD',    'category' => 'Forex',       'payout_percent' => 85.00],
            ['symbol' => 'EURGBP',   'name' => 'EUR/GBP',    'category' => 'Forex',       'payout_percent' => 85.00],
            ['symbol' => 'EURJPY',   'name' => 'EUR/JPY',    'category' => 'Forex',       'payout_percent' => 85.00],
            ['symbol' => 'GBPJPY',   'name' => 'GBP/JPY',    'category' => 'Forex',       'payout_percent' => 85.00],
            ['symbol' => 'EURCHF',   'name' => 'EUR/CHF',    'category' => 'Forex',       'payout_percent' => 85.00],
            ['symbol' => 'AUDCAD',   'name' => 'AUD/CAD',    'category' => 'Forex',       'payout_percent' => 85.00],
            ['symbol' => 'AUDJPY',   'name' => 'AUD/JPY',    'category' => 'Forex',       'payout_percent' => 85.00],
            ['symbol' => 'CADJPY',   'name' => 'CAD/JPY',    'category' => 'Forex',       'payout_percent' => 85.00],
            ['symbol' => 'CHFJPY',   'name' => 'CHF/JPY',    'category' => 'Forex',       'payout_percent' => 85.00],
            ['symbol' => 'GBPAUD',   'name' => 'GBP/AUD',    'category' => 'Forex',       'payout_percent' => 85.00],
            ['symbol' => 'GBPCAD',   'name' => 'GBP/CAD',    'category' => 'Forex',       'payout_percent' => 85.00],
            ['symbol' => 'GBPCHF',   'name' => 'GBP/CHF',    'category' => 'Forex',       'payout_percent' => 85.00],
            ['symbol' => 'NZDCAD',   'name' => 'NZD/CAD',    'category' => 'Forex',       'payout_percent' => 85.00],
            ['symbol' => 'NZDJPY',   'name' => 'NZD/JPY',    'category' => 'Forex',       'payout_percent' => 85.00],

            // Crypto — 80%
            ['symbol' => 'BTCUSDT',   'name' => 'BTC/USDT',   'category' => 'Crypto', 'payout_percent' => 80.00],
            ['symbol' => 'ETHUSDT',   'name' => 'ETH/USDT',   'category' => 'Crypto', 'payout_percent' => 80.00],
            ['symbol' => 'BNBUSDT',   'name' => 'BNB/USDT',   'category' => 'Crypto', 'payout_percent' => 80.00],
            ['symbol' => 'SOLUSDT',   'name' => 'SOL/USDT',   'category' => 'Crypto', 'payout_percent' => 80.00],
            ['symbol' => 'XRPUSDT',   'name' => 'XRP/USDT',   'category' => 'Crypto', 'payout_percent' => 80.00],
            ['symbol' => 'ADAUSDT',   'name' => 'ADA/USDT',   'category' => 'Crypto', 'payout_percent' => 80.00],
            ['symbol' => 'DOGEUSDT',  'name' => 'DOGE/USDT',  'category' => 'Crypto', 'payout_percent' => 80.00],
            ['symbol' => 'DOTUSDT',   'name' => 'DOT/USDT',   'category' => 'Crypto', 'payout_percent' => 80.00],
            ['symbol' => 'LINKUSDT',  'name' => 'LINK/USDT',  'category' => 'Crypto', 'payout_percent' => 80.00],
            ['symbol' => 'AVAXUSDT',  'name' => 'AVAX/USDT',  'category' => 'Crypto', 'payout_percent' => 80.00],
            ['symbol' => 'MATICUSDT', 'name' => 'MATIC/USDT', 'category' => 'Crypto', 'payout_percent' => 80.00],
            ['symbol' => 'LTCUSDT',   'name' => 'LTC/USDT',   'category' => 'Crypto', 'payout_percent' => 80.00],
            ['symbol' => 'UNIUSDT',   'name' => 'UNI/USDT',   'category' => 'Crypto', 'payout_percent' => 80.00],
            ['symbol' => 'ATOMUSDT',  'name' => 'ATOM/USDT',  'category' => 'Crypto', 'payout_percent' => 80.00],
            ['symbol' => 'NEARUSDT',  'name' => 'NEAR/USDT',  'category' => 'Crypto', 'payout_percent' => 80.00],

            // Commodities — 83%
            ['symbol' => 'XAUUSD',    'name' => 'Gold',      'category' => 'Commodities', 'payout_percent' => 83.00],
            ['symbol' => 'XAGUSD',    'name' => 'Silver',    'category' => 'Commodities', 'payout_percent' => 83.00],
            ['symbol' => 'USOIL',     'name' => 'WTI Oil',   'category' => 'Commodities', 'payout_percent' => 83.00],
            ['symbol' => 'UKOIL',     'name' => 'Brent Oil', 'category' => 'Commodities', 'payout_percent' => 83.00],
            ['symbol' => 'NATGAS',    'name' => 'Nat. Gas',  'category' => 'Commodities', 'payout_percent' => 83.00],
            ['symbol' => 'COPPER',    'name' => 'Copper',    'category' => 'Commodities', 'payout_percent' => 83.00],
            ['symbol' => 'PLATINUM',  'name' => 'Platinum',  'category' => 'Commodities', 'payout_percent' => 83.00],
            ['symbol' => 'PALLADIUM', 'name' => 'Palladium', 'category' => 'Commodities', 'payout_percent' => 83.00],

            // Indices — 79%
            ['symbol' => 'SPX',    'name' => 'S&P 500',    'category' => 'Indices', 'payout_percent' => 79.00],
            ['symbol' => 'NAS100', 'name' => 'Nasdaq 100', 'category' => 'Indices', 'payout_percent' => 79.00],
            ['symbol' => 'DJI',    'name' => 'Dow Jones',  'category' => 'Indices', 'payout_percent' => 79.00],
            ['symbol' => 'DAX',    'name' => 'DAX 40',     'category' => 'Indices', 'payout_percent' => 79.00],
            ['symbol' => 'FTSE',   'name' => 'FTSE 100',   'category' => 'Indices', 'payout_percent' => 79.00],
            ['symbol' => 'NI225',  'name' => 'Nikkei 225', 'category' => 'Indices', 'payout_percent' => 79.00],
            ['symbol' => 'HSI',    'name' => 'Hang Seng',  'category' => 'Indices', 'payout_percent' => 79.00],
        ];

        $now = now();
        $rows = array_map(fn ($a) => array_merge($a, [
            'is_open'        => true,
            'closed_message' => 'This market is currently closed.',
            'created_at'     => $now,
            'updated_at'     => $now,
        ]), $assets);

        DB::table('asset_settings')->insertOrIgnore($rows);
    }
}
