<?php

namespace Database\Seeders;

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

class TradingSymbolSeeder extends Seeder
{
    /**
     * Run the database seeds.
     */
    public function run(): void
    {
        $symbols = [
            ['symbol' => 'EURUSD', 'display_name' => 'EUR/USD', 'category' => 'forex', 'base_currency' => 'EUR', 'quote_currency' => 'USD', 'contract_size' => 100000, 'pip_size' => 0.0001, 'default_price' => 1],
            ['symbol' => 'GBPUSD', 'display_name' => 'GBP/USD', 'category' => 'forex', 'base_currency' => 'GBP', 'quote_currency' => 'USD', 'contract_size' => 100000, 'pip_size' => 0.0001, 'default_price' => 1],
            ['symbol' => 'USDJPY', 'display_name' => 'USD/JPY', 'category' => 'forex', 'base_currency' => 'USD', 'quote_currency' => 'JPY', 'contract_size' => 100000, 'pip_size' => 0.01, 'default_price' => 150],
            ['symbol' => 'AUDUSD', 'display_name' => 'AUD/USD', 'category' => 'forex', 'base_currency' => 'AUD', 'quote_currency' => 'USD', 'contract_size' => 100000, 'pip_size' => 0.0001, 'default_price' => 1],
            ['symbol' => 'USDCAD', 'display_name' => 'USD/CAD', 'category' => 'forex', 'base_currency' => 'USD', 'quote_currency' => 'CAD', 'contract_size' => 100000, 'pip_size' => 0.0001, 'default_price' => 1.35],
            ['symbol' => 'USDCHF', 'display_name' => 'USD/CHF', 'category' => 'forex', 'base_currency' => 'USD', 'quote_currency' => 'CHF', 'contract_size' => 100000, 'pip_size' => 0.0001, 'default_price' => 0.9],
            ['symbol' => 'NZDUSD', 'display_name' => 'NZD/USD', 'category' => 'forex', 'base_currency' => 'NZD', 'quote_currency' => 'USD', 'contract_size' => 100000, 'pip_size' => 0.0001, 'default_price' => 1],
            ['symbol' => 'XAUUSD', 'display_name' => 'XAUUSD / Gold', 'category' => 'metal', 'base_currency' => 'XAU', 'quote_currency' => 'USD', 'contract_size' => 100, 'pip_size' => 0.01, 'default_price' => 1],
            ['symbol' => 'XAGUSD', 'display_name' => 'XAGUSD / Silver', 'category' => 'metal', 'base_currency' => 'XAG', 'quote_currency' => 'USD', 'contract_size' => 5000, 'pip_size' => 0.01, 'default_price' => 1],
            ['symbol' => 'NASDAQ', 'display_name' => 'NASDAQ', 'category' => 'index', 'base_currency' => null, 'quote_currency' => 'USD', 'contract_size' => 1, 'pip_size' => 1, 'default_price' => 1],
            ['symbol' => 'USOIL', 'display_name' => 'USOIL / Crude Oil', 'category' => 'commodity', 'base_currency' => null, 'quote_currency' => 'USD', 'contract_size' => 1000, 'pip_size' => 0.01, 'default_price' => 1],
        ];

        foreach ($symbols as $symbol) {
            TradingSymbol::updateOrCreate(
                ['symbol' => $symbol['symbol']],
                $symbol + ['is_active' => true]
            );
        }
    }
}
