<?php

declare(strict_types=1);

namespace Database\Seeders;

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

class CurrencySeeder extends Seeder
{
    public function run(): void
    {
        $currencies = [
            ['code' => 'USD', 'symbol' => '$', 'name' => 'US Dollar', 'decimal_places' => 2, 'exchange_rate' => 1.000000, 'is_base' => true, 'is_enabled' => true],
            ['code' => 'EUR', 'symbol' => '€', 'name' => 'Euro', 'decimal_places' => 2, 'exchange_rate' => 0.920000, 'is_base' => false, 'is_enabled' => true],
            ['code' => 'GBP', 'symbol' => '£', 'name' => 'British Pound', 'decimal_places' => 2, 'exchange_rate' => 0.790000, 'is_base' => false, 'is_enabled' => true],
            ['code' => 'CAD', 'symbol' => 'C$', 'name' => 'Canadian Dollar', 'decimal_places' => 2, 'exchange_rate' => 1.360000, 'is_base' => false, 'is_enabled' => true],
            ['code' => 'AUD', 'symbol' => 'A$', 'name' => 'Australian Dollar', 'decimal_places' => 2, 'exchange_rate' => 1.540000, 'is_base' => false, 'is_enabled' => true],
        ];

        foreach ($currencies as $data) {
            Currency::query()->updateOrCreate(
                ['code' => $data['code']],
                $data,
            );
        }
    }
}
