<?php

namespace Database\Seeders;

use App\Domains\Catalog\Models\Brand;
use App\Domains\Tenant\Models\Tenant;
use Illuminate\Database\Seeder;

class BrandSeeder extends Seeder
{
    /**
     * Run the database seeds.
     */
    public function run(): void
    {
        $brands = [
            'Le Coq',
            'Adidas',
            'Under Armour',
            'Rosario Central',
            'Topper',
            'Nike',
        ];

        $tenants = Tenant::all();

        if ($tenants->isEmpty()) {
            return;
        }

        foreach ($tenants as $tenant) {
            foreach ($brands as $nombre) {
                Brand::firstOrCreate([
                    'tenant_codigo' => $tenant->codigo,
                    'nombre' => $nombre,
                ]);
            }
        }
    }
}
