<?php

namespace Database\Seeders;

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

class ClubSeeder extends Seeder
{
    public function run(): void
    {
        $clubs = [
            // ─── KLUB LIGA ────────────────────────────────────────────
            // Elite (87-90)
            ['type'=>'club','name' => 'FC Barcelona',          'short_name' => 'BAR', 'nationality' => 'Spain',       'overall' => 89],
            ['type'=>'club','name' => 'Real Madrid',            'short_name' => 'RMA', 'nationality' => 'Spain',       'overall' => 90],
            ['type'=>'club','name' => 'Manchester City',        'short_name' => 'MCI', 'nationality' => 'England',     'overall' => 90],
            ['type'=>'club','name' => 'Bayern Munich',          'short_name' => 'BAY', 'nationality' => 'Germany',     'overall' => 88],
            ['type'=>'club','name' => 'Liverpool',              'short_name' => 'LIV', 'nationality' => 'England',     'overall' => 88],
            ['type'=>'club','name' => 'PSG',                    'short_name' => 'PSG', 'nationality' => 'France',      'overall' => 87],
            ['type'=>'club','name' => 'Arsenal',                'short_name' => 'ARS', 'nationality' => 'England',     'overall' => 87],
            ['type'=>'club','name' => 'Chelsea',                'short_name' => 'CHE', 'nationality' => 'England',     'overall' => 86],
            ['type'=>'club','name' => 'Atletico Madrid',        'short_name' => 'ATM', 'nationality' => 'Spain',       'overall' => 86],
            ['type'=>'club','name' => 'Inter Milan',            'short_name' => 'INT', 'nationality' => 'Italy',       'overall' => 86],
            // Very Good (83-85)
            ['type'=>'club','name' => 'AC Milan',               'short_name' => 'MIL', 'nationality' => 'Italy',       'overall' => 85],
            ['type'=>'club','name' => 'Juventus',               'short_name' => 'JUV', 'nationality' => 'Italy',       'overall' => 84],
            ['type'=>'club','name' => 'Borussia Dortmund',      'short_name' => 'BVB', 'nationality' => 'Germany',     'overall' => 84],
            ['type'=>'club','name' => 'Manchester United',      'short_name' => 'MUN', 'nationality' => 'England',     'overall' => 84],
            ['type'=>'club','name' => 'Tottenham Hotspur',      'short_name' => 'TOT', 'nationality' => 'England',     'overall' => 83],
            ['type'=>'club','name' => 'Napoli',                 'short_name' => 'NAP', 'nationality' => 'Italy',       'overall' => 84],
            ['type'=>'club','name' => 'AS Roma',                'short_name' => 'ROM', 'nationality' => 'Italy',       'overall' => 83],
            ['type'=>'club','name' => 'Sevilla',                'short_name' => 'SEV', 'nationality' => 'Spain',       'overall' => 83],
            ['type'=>'club','name' => 'Real Betis',             'short_name' => 'BET', 'nationality' => 'Spain',       'overall' => 82],
            ['type'=>'club','name' => 'Bayer Leverkusen',       'short_name' => 'B04', 'nationality' => 'Germany',     'overall' => 83],
            // Good (79-82)
            ['type'=>'club','name' => 'RB Leipzig',             'short_name' => 'RBL', 'nationality' => 'Germany',     'overall' => 82],
            ['type'=>'club','name' => 'Villarreal',             'short_name' => 'VIL', 'nationality' => 'Spain',       'overall' => 82],
            ['type'=>'club','name' => 'Lazio',                  'short_name' => 'LAZ', 'nationality' => 'Italy',       'overall' => 81],
            ['type'=>'club','name' => 'Ajax',                   'short_name' => 'AJX', 'nationality' => 'Netherlands', 'overall' => 82],
            ['type'=>'club','name' => 'Porto',                  'short_name' => 'POR', 'nationality' => 'Portugal',    'overall' => 82],
            ['type'=>'club','name' => 'Benfica',                'short_name' => 'SLB', 'nationality' => 'Portugal',    'overall' => 83],
            ['type'=>'club','name' => 'Sporting CP',            'short_name' => 'SCP', 'nationality' => 'Portugal',    'overall' => 81],
            ['type'=>'club','name' => 'Celtic',                 'short_name' => 'CEL', 'nationality' => 'Scotland',    'overall' => 79],
            ['type'=>'club','name' => 'West Ham United',        'short_name' => 'WHU', 'nationality' => 'England',     'overall' => 80],
            ['type'=>'club','name' => 'Aston Villa',            'short_name' => 'AVL', 'nationality' => 'England',     'overall' => 82],
            ['type'=>'club','name' => 'Newcastle United',       'short_name' => 'NEW', 'nationality' => 'England',     'overall' => 81],
            ['type'=>'club','name' => 'Brighton',               'short_name' => 'BHA', 'nationality' => 'England',     'overall' => 80],
            ['type'=>'club','name' => 'Fiorentina',             'short_name' => 'FIO', 'nationality' => 'Italy',       'overall' => 80],
            ['type'=>'club','name' => 'Atalanta',               'short_name' => 'ATA', 'nationality' => 'Italy',       'overall' => 82],
            ['type'=>'club','name' => 'Monaco',                 'short_name' => 'MON', 'nationality' => 'France',      'overall' => 80],
            ['type'=>'club','name' => 'Lyon',                   'short_name' => 'OL',  'nationality' => 'France',      'overall' => 79],
            ['type'=>'club','name' => 'Marseille',              'short_name' => 'OM',  'nationality' => 'France',      'overall' => 80],
            ['type'=>'club','name' => 'Valencia',               'short_name' => 'VAL', 'nationality' => 'Spain',       'overall' => 79],
            ['type'=>'club','name' => 'Galatasaray',            'short_name' => 'GAL', 'nationality' => 'Turkey',      'overall' => 79],
            ['type'=>'club','name' => 'Fenerbahce',             'short_name' => 'FEN', 'nationality' => 'Turkey',      'overall' => 78],
            ['type'=>'club','name' => 'Al-Hilal',               'short_name' => 'HIL', 'nationality' => 'Saudi Arabia','overall' => 80],
            ['type'=>'club','name' => 'Al-Nassr',               'short_name' => 'ANS', 'nationality' => 'Saudi Arabia','overall' => 79],
            ['type'=>'club','name' => 'Flamengo',               'short_name' => 'FLA', 'nationality' => 'Brazil',      'overall' => 80],
            ['type'=>'club','name' => 'Boca Juniors',           'short_name' => 'BJR', 'nationality' => 'Argentina',   'overall' => 78],
            ['type'=>'club','name' => 'River Plate',            'short_name' => 'RIV', 'nationality' => 'Argentina',   'overall' => 79],

            // ─── TIM NASIONAL ─────────────────────────────────────────
            ['type'=>'national','name' => 'Brazil',             'short_name' => 'BRA', 'nationality' => 'South America',  'overall' => 88],
            ['type'=>'national','name' => 'Argentina',          'short_name' => 'ARG', 'nationality' => 'South America',  'overall' => 90],
            ['type'=>'national','name' => 'France',             'short_name' => 'FRA', 'nationality' => 'Europe',         'overall' => 88],
            ['type'=>'national','name' => 'England',            'short_name' => 'ENG', 'nationality' => 'Europe',         'overall' => 86],
            ['type'=>'national','name' => 'Spain',              'short_name' => 'ESP', 'nationality' => 'Europe',         'overall' => 87],
            ['type'=>'national','name' => 'Germany',            'short_name' => 'GER', 'nationality' => 'Europe',         'overall' => 85],
            ['type'=>'national','name' => 'Portugal',           'short_name' => 'POR', 'nationality' => 'Europe',         'overall' => 86],
            ['type'=>'national','name' => 'Netherlands',        'short_name' => 'NED', 'nationality' => 'Europe',         'overall' => 85],
            ['type'=>'national','name' => 'Italy',              'short_name' => 'ITA', 'nationality' => 'Europe',         'overall' => 85],
            ['type'=>'national','name' => 'Belgium',            'short_name' => 'BEL', 'nationality' => 'Europe',         'overall' => 84],
            ['type'=>'national','name' => 'Croatia',            'short_name' => 'CRO', 'nationality' => 'Europe',         'overall' => 83],
            ['type'=>'national','name' => 'Uruguay',            'short_name' => 'URU', 'nationality' => 'South America',  'overall' => 83],
            ['type'=>'national','name' => 'Colombia',           'short_name' => 'COL', 'nationality' => 'South America',  'overall' => 82],
            ['type'=>'national','name' => 'Morocco',            'short_name' => 'MAR', 'nationality' => 'Africa',         'overall' => 82],
            ['type'=>'national','name' => 'Japan',              'short_name' => 'JPN', 'nationality' => 'Asia',           'overall' => 81],
            ['type'=>'national','name' => 'South Korea',        'short_name' => 'KOR', 'nationality' => 'Asia',           'overall' => 80],
            ['type'=>'national','name' => 'United States',      'short_name' => 'USA', 'nationality' => 'North America',  'overall' => 80],
            ['type'=>'national','name' => 'Mexico',             'short_name' => 'MEX', 'nationality' => 'North America',  'overall' => 79],
            ['type'=>'national','name' => 'Senegal',            'short_name' => 'SEN', 'nationality' => 'Africa',         'overall' => 80],
            ['type'=>'national','name' => 'Saudi Arabia',       'short_name' => 'KSA', 'nationality' => 'Asia',           'overall' => 76],
            ['type'=>'national','name' => 'Australia',          'short_name' => 'AUS', 'nationality' => 'Asia',           'overall' => 76],
            ['type'=>'national','name' => 'Indonesia',          'short_name' => 'IDN', 'nationality' => 'Asia',           'overall' => 70],
        ];

        foreach ($clubs as $club) {
            Club::firstOrCreate(
                ['name' => $club['name']],
                array_merge($club, ['is_active' => true])
            );
        }

        $this->command->info('✅ ' . count($clubs) . ' klub berhasil di-seed.');
    }
}
